Mercurial > libavcodec.hg
diff libpostproc/postprocess.c @ 2527:ace6e273f318 libavcodec
support for negative strides
author | henry |
---|---|
date | Sun, 27 Feb 2005 08:56:26 +0000 |
parents | 805cbcf4dc8a |
children | 910cd8bd981f |
line wrap: on
line diff
--- a/libpostproc/postprocess.c Sat Feb 26 03:40:29 2005 +0000 +++ b/libpostproc/postprocess.c Sun Feb 27 08:56:26 2005 +0000 @@ -1051,18 +1051,20 @@ int mbHeight= (height+15)>>4; PPMode *mode = (PPMode*)vm; PPContext *c = (PPContext*)vc; - int minStride= MAX(srcStride[0], dstStride[0]); + int minStride= MAX(ABS(srcStride[0]), ABS(dstStride[0])); + int absQPStride = ABS(QPStride); - if(c->stride < minStride || c->qpStride < QPStride) + // c->stride and c->QPStride are always positive + if(c->stride < minStride || c->qpStride < absQPStride) reallocBuffers(c, width, height, MAX(minStride, c->stride), - MAX(c->qpStride, QPStride)); + MAX(c->qpStride, absQPStride)); if(QP_store==NULL || (mode->lumMode & FORCE_QUANT)) { int i; QP_store= c->forcedQPTable; - QPStride= 0; + absQPStride = QPStride = 0; if(mode->lumMode & FORCE_QUANT) for(i=0; i<mbWidth; i++) QP_store[i]= mode->forcedQuant; else @@ -1072,7 +1074,7 @@ if(pict_type & PP_PICT_TYPE_QP2){ int i; - const int count= mbHeight * QPStride; + const int count= mbHeight * absQPStride; for(i=0; i<(count>>2); i++){ ((uint32_t*)c->stdQPTable)[i] = (((uint32_t*)QP_store)[i]>>1) & 0x7F7F7F7F; } @@ -1080,6 +1082,7 @@ c->stdQPTable[i] = QP_store[i]>>1; } QP_store= c->stdQPTable; + QPStride= absQPStride; } if(0){ @@ -1095,13 +1098,22 @@ if((pict_type&7)!=3) { - int i; - const int count= mbHeight * QPStride; - for(i=0; i<(count>>2); i++){ - ((uint32_t*)c->nonBQPTable)[i] = ((uint32_t*)QP_store)[i] & 0x3F3F3F3F; - } - for(i<<=2; i<count; i++){ - c->nonBQPTable[i] = QP_store[i] & 0x3F; + if (QPStride >= 0) { + int i; + const int count= mbHeight * QPStride; + for(i=0; i<(count>>2); i++){ + ((uint32_t*)c->nonBQPTable)[i] = ((uint32_t*)QP_store)[i] & 0x3F3F3F3F; + } + for(i<<=2; i<count; i++){ + c->nonBQPTable[i] = QP_store[i] & 0x3F; + } + } else { + int i,j; + for(i=0; i<mbHeight; i++) { + for(j=0; j<absQPStride; j++) { + c->nonBQPTable[i*absQPStride+j] = QP_store[i*QPStride+j] & 0x3F; + } + } } } @@ -1125,8 +1137,8 @@ } else if(srcStride[1] == dstStride[1] && srcStride[2] == dstStride[2]) { - memcpy(dst[1], src[1], srcStride[1]*height); - memcpy(dst[2], src[2], srcStride[2]*height); + linecpy(dst[1], src[1], height, srcStride[1]); + linecpy(dst[2], src[2], height, srcStride[2]); } else {