From ed80dec621f621794e9d7ec7c1769bbf9a58a500 Mon Sep 17 00:00:00 2001 From: Pedro Arthur Date: Tue, 18 Aug 2015 15:06:49 -0300 Subject: [PATCH] swscale: fixed compiler warnings Signed-off-by: Michael Niedermayer --- libswscale/swscale.c | 24 ++++++++++++++++-------- libswscale/swscale_internal.h | 2 ++ libswscale/x86/swscale.c | 15 +++++++-------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index e5bab9cd95..03019d4c12 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -321,35 +321,45 @@ static int swscale(SwsContext *c, const uint8_t *src[], { /* load a few things into local vars to make the code more readable? * and faster */ +#ifndef NEW_FILTER const int srcW = c->srcW; +#endif const int dstW = c->dstW; const int dstH = c->dstH; const int chrDstW = c->chrDstW; +#ifndef NEW_FILTER const int chrSrcW = c->chrSrcW; const int lumXInc = c->lumXInc; const int chrXInc = c->chrXInc; +#endif const enum AVPixelFormat dstFormat = c->dstFormat; const int flags = c->flags; int32_t *vLumFilterPos = c->vLumFilterPos; int32_t *vChrFilterPos = c->vChrFilterPos; +#ifndef NEW_FILTER int32_t *hLumFilterPos = c->hLumFilterPos; int32_t *hChrFilterPos = c->hChrFilterPos; int16_t *hLumFilter = c->hLumFilter; int16_t *hChrFilter = c->hChrFilter; +#endif int32_t *lumMmxFilter = c->lumMmxFilter; int32_t *chrMmxFilter = c->chrMmxFilter; const int vLumFilterSize = c->vLumFilterSize; const int vChrFilterSize = c->vChrFilterSize; +#ifndef NEW_FILTER const int hLumFilterSize = c->hLumFilterSize; const int hChrFilterSize = c->hChrFilterSize; int16_t **lumPixBuf = c->lumPixBuf; int16_t **chrUPixBuf = c->chrUPixBuf; int16_t **chrVPixBuf = c->chrVPixBuf; +#endif int16_t **alpPixBuf = c->alpPixBuf; const int vLumBufSize = c->vLumBufSize; const int vChrBufSize = c->vChrBufSize; +#ifndef NEW_FILTER uint8_t *formatConvBuffer = c->formatConvBuffer; uint32_t *pal = c->pal_yuv; +#endif yuv2planar1_fn yuv2plane1 = c->yuv2plane1; yuv2planarX_fn yuv2planeX = c->yuv2planeX; yuv2interleavedX_fn yuv2nv12cX = c->yuv2nv12cX; @@ -369,9 +379,8 @@ static int swscale(SwsContext *c, const uint8_t *src[], int chrBufIndex = c->chrBufIndex; int lastInLumBuf = c->lastInLumBuf; int lastInChrBuf = c->lastInChrBuf; - int perform_gamma = c->is_internal_gamma; +// int perform_gamma = c->is_internal_gamma; - int numDesc = c->numDesc; int lumStart = 0; int lumEnd = c->descIndex[0]; int chrStart = lumEnd; @@ -382,10 +391,11 @@ static int swscale(SwsContext *c, const uint8_t *src[], int hasLumHoles = 1; int hasChrHoles = 1; - +#ifndef NEW_FILTER if (!usePal(c->srcFormat)) { pal = c->input_rgb2yuv_table; } +#endif if (isPacked(c->srcFormat)) { src[0] = @@ -450,8 +460,6 @@ static int swscale(SwsContext *c, const uint8_t *src[], } lastDstY = dstY; -#define NEW_FILTER 1 - ff_init_slice_from_src(src_slice, (uint8_t**)src, srcStride, c->srcW, srcSliceY, srcSliceH, chrSrcSliceY, chrSrcSliceH); @@ -532,7 +540,7 @@ static int swscale(SwsContext *c, const uint8_t *src[], lastLumSrcY, lastChrSrcY); } -#if NEW_FILTER +#ifdef NEW_FILTER posY = dst_slice->plane[0].sliceY + dst_slice->plane[0].sliceH; if (posY <= lastLumSrcY && !hasLumHoles) { firstPosY = FFMAX(firstLumSrcY, posY); @@ -645,7 +653,7 @@ static int swscale(SwsContext *c, const uint8_t *src[], } { -#if NEW_FILTER +#ifdef NEW_FILTER const int16_t **lumSrcPtr = (const int16_t **)(void*) dst_slice->plane[0].line + firstLumSrcY - dst_slice->plane[0].sliceY; const int16_t **chrUSrcPtr = (const int16_t **)(void*) dst_slice->plane[1].line + firstChrSrcY - dst_slice->plane[1].sliceY; const int16_t **chrVSrcPtr = (const int16_t **)(void*) dst_slice->plane[2].line + firstChrSrcY - dst_slice->plane[2].sliceY; @@ -722,7 +730,7 @@ static int swscale(SwsContext *c, const uint8_t *src[], } } } else if (yuv2packedX) { -#if !NEW_FILTER +#ifndef NEW_FILTER av_assert1(lumSrcPtr + vLumFilterSize - 1 < (const int16_t **)lumPixBuf + vLumBufSize * 2); av_assert1(chrUSrcPtr + vChrFilterSize - 1 < (const int16_t **)chrUPixBuf + vChrBufSize * 2); #endif diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index f46bb78bd7..bf6be1860a 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -1036,4 +1036,6 @@ int ff_init_desc_no_chr(SwsFilterDescriptor *desc, SwsSlice * src, SwsSlice *dst //number of extra lines to process #define MAX_LINES_AHEAD 4 + +#define NEW_FILTER #endif /* SWSCALE_SWSCALE_INTERNAL_H */ diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c index 83c01a0f9e..df29e23d43 100644 --- a/libswscale/x86/swscale.c +++ b/libswscale/x86/swscale.c @@ -85,8 +85,7 @@ void ff_updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrB { const int dstH= c->dstH; const int flags= c->flags; -#define NEW_FILTER 1 -#if NEW_FILTER +#ifdef NEW_FILTER SwsPlane *lumPlane = &c->slice[c->numSlice-1].plane[0]; SwsPlane *chrUPlane = &c->slice[c->numSlice-1].plane[1]; SwsPlane *alpPlane = &c->slice[c->numSlice-1].plane[3]; @@ -94,10 +93,10 @@ void ff_updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrB int16_t **lumPixBuf= c->lumPixBuf; int16_t **chrUPixBuf= c->chrUPixBuf; int16_t **alpPixBuf= c->alpPixBuf; -#endif - int hasAlpha = c->alpPixBuf != NULL; const int vLumBufSize= c->vLumBufSize; const int vChrBufSize= c->vChrBufSize; +#endif + int hasAlpha = c->alpPixBuf != NULL; int32_t *vLumFilterPos= c->vLumFilterPos; int32_t *vChrFilterPos= c->vChrFilterPos; int16_t *vLumFilter= c->vLumFilter; @@ -118,7 +117,7 @@ void ff_updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrB c->greenDither= ff_dither4[dstY&1]; c->redDither= ff_dither8[(dstY+1)&1]; if (dstY < dstH - 2) { -#if NEW_FILTER +#ifdef NEW_FILTER const int16_t **lumSrcPtr = (const int16_t **)(void*) lumPlane->line + firstLumSrcY - lumPlane->sliceY; const int16_t **chrUSrcPtr = (const int16_t **)(void*) chrUPlane->line + firstChrSrcY - chrUPlane->sliceY; const int16_t **alpSrcPtr = (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) ? (const int16_t **)(void*) alpPlane->line + firstLumSrcY - alpPlane->sliceY : NULL; @@ -129,7 +128,7 @@ void ff_updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrB #endif int i; if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->srcH) { -#if NEW_FILTER +#ifdef NEW_FILTER const int16_t **tmpY = (const int16_t **) lumPlane->tmp; #else const int16_t **tmpY = (const int16_t **) lumPixBuf + 2 * vLumBufSize; @@ -144,7 +143,7 @@ void ff_updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrB lumSrcPtr = tmpY; if (alpSrcPtr) { -#if NEW_FILTER +#ifdef NEW_FILTER const int16_t **tmpA = (const int16_t **) alpPlane->tmp; #else const int16_t **tmpA = (const int16_t **) alpPixBuf + 2 * vLumBufSize; @@ -159,7 +158,7 @@ void ff_updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrB } } if (firstChrSrcY < 0 || firstChrSrcY + vChrFilterSize > c->chrSrcH) { -#if NEW_FILTER +#ifdef NEW_FILTER const int16_t **tmpU = (const int16_t **) chrUPlane->tmp; #else const int16_t **tmpU = (const int16_t **) chrUPixBuf + 2 * vChrBufSize;