Commit fcc402b1 authored by Luca Barbato's avatar Luca Barbato

Remove ASSERT() macro. SoC Patch from Keiji Costantini

Originally committed as revision 27214 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
parent bc5a0444
...@@ -88,12 +88,6 @@ untested special converters ...@@ -88,12 +88,6 @@ untested special converters
#define RET 0xC3 //near return opcode for X86 #define RET 0xC3 //near return opcode for X86
#ifdef MP_DEBUG
#define ASSERT(x) assert(x);
#else
#define ASSERT(x) ;
#endif
#ifdef M_PI #ifdef M_PI
#define PI M_PI #define PI M_PI
#else #else
...@@ -1060,7 +1054,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF ...@@ -1060,7 +1054,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
else if (flags&SWS_BILINEAR) sizeFactor= 2.0; else if (flags&SWS_BILINEAR) sizeFactor= 2.0;
else { else {
sizeFactor= 0.0; //GCC warning killer sizeFactor= 0.0; //GCC warning killer
ASSERT(0) assert(0);
} }
if (xInc1 <= 1.0) filterSizeInSrc= sizeFactor; // upscale if (xInc1 <= 1.0) filterSizeInSrc= sizeFactor; // upscale
...@@ -1145,7 +1139,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF ...@@ -1145,7 +1139,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
} }
else { else {
coeff= 0.0; //GCC warning killer coeff= 0.0; //GCC warning killer
ASSERT(0) assert(0);
} }
filter[i*filterSize + j]= coeff; filter[i*filterSize + j]= coeff;
...@@ -1158,11 +1152,11 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF ...@@ -1158,11 +1152,11 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
/* apply src & dst Filter to filter -> filter2 /* apply src & dst Filter to filter -> filter2
av_free(filter); av_free(filter);
*/ */
ASSERT(filterSize>0) assert(filterSize>0);
filter2Size= filterSize; filter2Size= filterSize;
if (srcFilter) filter2Size+= srcFilter->length - 1; if (srcFilter) filter2Size+= srcFilter->length - 1;
if (dstFilter) filter2Size+= dstFilter->length - 1; if (dstFilter) filter2Size+= dstFilter->length - 1;
ASSERT(filter2Size>0) assert(filter2Size>0);
filter2= av_malloc(filter2Size*dstW*sizeof(double)); filter2= av_malloc(filter2Size*dstW*sizeof(double));
for (i=0; i<dstW; i++) for (i=0; i<dstW; i++)
...@@ -1177,7 +1171,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF ...@@ -1177,7 +1171,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
if (srcFilter) outVec= sws_getConvVec(srcFilter, &scaleFilter); if (srcFilter) outVec= sws_getConvVec(srcFilter, &scaleFilter);
else outVec= &scaleFilter; else outVec= &scaleFilter;
ASSERT(outVec->length == filter2Size) assert(outVec->length == filter2Size);
//FIXME dstFilter //FIXME dstFilter
for (j=0; j<outVec->length; j++) for (j=0; j<outVec->length; j++)
...@@ -1252,9 +1246,9 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF ...@@ -1252,9 +1246,9 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
filterAlign= 1; filterAlign= 1;
} }
ASSERT(minFilterSize > 0) assert(minFilterSize > 0);
filterSize= (minFilterSize +(filterAlign-1)) & (~(filterAlign-1)); filterSize= (minFilterSize +(filterAlign-1)) & (~(filterAlign-1));
ASSERT(filterSize > 0) assert(filterSize > 0);
filter= av_malloc(filterSize*dstW*sizeof(double)); filter= av_malloc(filterSize*dstW*sizeof(double));
if (filterSize >= MAX_FILTER_SIZE) if (filterSize >= MAX_FILTER_SIZE)
return -1; return -1;
...@@ -1746,7 +1740,7 @@ static int packedCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli ...@@ -1746,7 +1740,7 @@ static int packedCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli
/* universal length finder */ /* universal length finder */
while(length+c->srcW <= FFABS(dstStride[0]) while(length+c->srcW <= FFABS(dstStride[0])
&& length+c->srcW <= FFABS(srcStride[0])) length+= c->srcW; && length+c->srcW <= FFABS(srcStride[0])) length+= c->srcW;
ASSERT(length!=0); assert(length!=0);
for (i=0; i<srcSliceH; i++) for (i=0; i<srcSliceH; i++)
{ {
...@@ -2388,7 +2382,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH ...@@ -2388,7 +2382,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH
assert(2*VOFW == VOF); assert(2*VOFW == VOF);
ASSERT(c->chrDstH <= dstH) assert(c->chrDstH <= dstH);
if (flags&SWS_PRINT_INFO) if (flags&SWS_PRINT_INFO)
{ {
......
...@@ -3039,8 +3039,8 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s ...@@ -3039,8 +3039,8 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s
if (firstLumSrcY > lastInLumBuf) lastInLumBuf= firstLumSrcY-1; if (firstLumSrcY > lastInLumBuf) lastInLumBuf= firstLumSrcY-1;
if (firstChrSrcY > lastInChrBuf) lastInChrBuf= firstChrSrcY-1; if (firstChrSrcY > lastInChrBuf) lastInChrBuf= firstChrSrcY-1;
//printf("%d %d %d\n", firstChrSrcY, lastInChrBuf, vChrBufSize); //printf("%d %d %d\n", firstChrSrcY, lastInChrBuf, vChrBufSize);
ASSERT(firstLumSrcY >= lastInLumBuf - vLumBufSize + 1) assert(firstLumSrcY >= lastInLumBuf - vLumBufSize + 1);
ASSERT(firstChrSrcY >= lastInChrBuf - vChrBufSize + 1) assert(firstChrSrcY >= lastInChrBuf - vChrBufSize + 1);
// Do we have enough lines in this slice to output the dstY line // Do we have enough lines in this slice to output the dstY line
if (lastLumSrcY < srcSliceY + srcSliceH && lastChrSrcY < -((-srcSliceY - srcSliceH)>>c->chrSrcVSubSample)) if (lastLumSrcY < srcSliceY + srcSliceH && lastChrSrcY < -((-srcSliceY - srcSliceH)>>c->chrSrcVSubSample))
...@@ -3051,9 +3051,9 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s ...@@ -3051,9 +3051,9 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s
uint8_t *s= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0]; uint8_t *s= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0];
lumBufIndex++; lumBufIndex++;
//printf("%d %d %d %d\n", lumBufIndex, vLumBufSize, lastInLumBuf, lastLumSrcY); //printf("%d %d %d %d\n", lumBufIndex, vLumBufSize, lastInLumBuf, lastLumSrcY);
ASSERT(lumBufIndex < 2*vLumBufSize) assert(lumBufIndex < 2*vLumBufSize);
ASSERT(lastInLumBuf + 1 - srcSliceY < srcSliceH) assert(lastInLumBuf + 1 - srcSliceY < srcSliceH);
ASSERT(lastInLumBuf + 1 - srcSliceY >= 0) assert(lastInLumBuf + 1 - srcSliceY >= 0);
//printf("%d %d\n", lumBufIndex, vLumBufSize); //printf("%d %d\n", lumBufIndex, vLumBufSize);
RENAME(hyscale)(lumPixBuf[ lumBufIndex ], dstW, s, srcW, lumXInc, RENAME(hyscale)(lumPixBuf[ lumBufIndex ], dstW, s, srcW, lumXInc,
flags, canMMX2BeUsed, hLumFilter, hLumFilterPos, hLumFilterSize, flags, canMMX2BeUsed, hLumFilter, hLumFilterPos, hLumFilterSize,
...@@ -3066,9 +3066,9 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s ...@@ -3066,9 +3066,9 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s
uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1]; uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1];
uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2]; uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2];
chrBufIndex++; chrBufIndex++;
ASSERT(chrBufIndex < 2*vChrBufSize) assert(chrBufIndex < 2*vChrBufSize);
ASSERT(lastInChrBuf + 1 - chrSrcSliceY < (chrSrcSliceH)) assert(lastInChrBuf + 1 - chrSrcSliceY < (chrSrcSliceH));
ASSERT(lastInChrBuf + 1 - chrSrcSliceY >= 0) assert(lastInChrBuf + 1 - chrSrcSliceY >= 0);
//FIXME replace parameters through context struct (some at least) //FIXME replace parameters through context struct (some at least)
if (!(isGray(srcFormat) || isGray(dstFormat))) if (!(isGray(srcFormat) || isGray(dstFormat)))
...@@ -3094,9 +3094,9 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s ...@@ -3094,9 +3094,9 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s
{ {
uint8_t *s= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0]; uint8_t *s= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0];
lumBufIndex++; lumBufIndex++;
ASSERT(lumBufIndex < 2*vLumBufSize) assert(lumBufIndex < 2*vLumBufSize);
ASSERT(lastInLumBuf + 1 - srcSliceY < srcSliceH) assert(lastInLumBuf + 1 - srcSliceY < srcSliceH);
ASSERT(lastInLumBuf + 1 - srcSliceY >= 0) assert(lastInLumBuf + 1 - srcSliceY >= 0);
RENAME(hyscale)(lumPixBuf[ lumBufIndex ], dstW, s, srcW, lumXInc, RENAME(hyscale)(lumPixBuf[ lumBufIndex ], dstW, s, srcW, lumXInc,
flags, canMMX2BeUsed, hLumFilter, hLumFilterPos, hLumFilterSize, flags, canMMX2BeUsed, hLumFilter, hLumFilterPos, hLumFilterSize,
funnyYCode, c->srcFormat, formatConvBuffer, funnyYCode, c->srcFormat, formatConvBuffer,
...@@ -3108,9 +3108,9 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s ...@@ -3108,9 +3108,9 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s
uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1]; uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1];
uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2]; uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2];
chrBufIndex++; chrBufIndex++;
ASSERT(chrBufIndex < 2*vChrBufSize) assert(chrBufIndex < 2*vChrBufSize);
ASSERT(lastInChrBuf + 1 - chrSrcSliceY < chrSrcSliceH) assert(lastInChrBuf + 1 - chrSrcSliceY < chrSrcSliceH);
ASSERT(lastInChrBuf + 1 - chrSrcSliceY >= 0) assert(lastInChrBuf + 1 - chrSrcSliceY >= 0);
if (!(isGray(srcFormat) || isGray(dstFormat))) if (!(isGray(srcFormat) || isGray(dstFormat)))
RENAME(hcscale)(chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc, RENAME(hcscale)(chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc,
...@@ -3199,8 +3199,8 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s ...@@ -3199,8 +3199,8 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s
} }
else else
{ {
ASSERT(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2); assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2);
ASSERT(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2); assert(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2);
if (vLumFilterSize == 1 && vChrFilterSize == 2) //unscaled RGB if (vLumFilterSize == 1 && vChrFilterSize == 2) //unscaled RGB
{ {
int chrAlpha= vChrFilter[2*dstY+1]; int chrAlpha= vChrFilter[2*dstY+1];
...@@ -3250,8 +3250,8 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s ...@@ -3250,8 +3250,8 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s
} }
else else
{ {
ASSERT(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2); assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2);
ASSERT(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2); assert(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2);
yuv2packedXinC(c, yuv2packedXinC(c,
vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize,
vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment