comparison libpostproc/postprocess_template.c @ 2527:ace6e273f318 libavcodec

support for negative strides
author henry
date Sun, 27 Feb 2005 08:56:26 +0000
parents c8f35aaeb857
children 240e17c3cb2d
comparison
equal deleted inserted replaced
2526:e55fcddd8392 2527:ace6e273f318
3364 const int qpHShift= isColor ? 4-c.hChromaSubSample : 4; 3364 const int qpHShift= isColor ? 4-c.hChromaSubSample : 4;
3365 const int qpVShift= isColor ? 4-c.vChromaSubSample : 4; 3365 const int qpVShift= isColor ? 4-c.vChromaSubSample : 4;
3366 3366
3367 //FIXME remove 3367 //FIXME remove
3368 uint64_t * const yHistogram= c.yHistogram; 3368 uint64_t * const yHistogram= c.yHistogram;
3369 uint8_t * const tempSrc= c.tempSrc; 3369 uint8_t * const tempSrc= srcStride > 0 ? c.tempSrc : c.tempSrc - 23*srcStride;
3370 uint8_t * const tempDst= c.tempDst; 3370 uint8_t * const tempDst= dstStride > 0 ? c.tempDst : c.tempDst - 23*dstStride;
3371 //const int mbWidth= isColor ? (width+7)>>3 : (width+15)>>4; 3371 //const int mbWidth= isColor ? (width+7)>>3 : (width+15)>>4;
3372 3372
3373 #ifdef HAVE_MMX 3373 #ifdef HAVE_MMX
3374 for(i=0; i<57; i++){ 3374 for(i=0; i<57; i++){
3375 int offset= ((i*c.ppMode.baseDcDiff)>>8) + 1; 3375 int offset= ((i*c.ppMode.baseDcDiff)>>8) + 1;
3527 RENAME(deInterlaceBlendCubic)(dstBlock, dstStride); 3527 RENAME(deInterlaceBlendCubic)(dstBlock, dstStride);
3528 */ 3528 */
3529 dstBlock+=8; 3529 dstBlock+=8;
3530 srcBlock+=8; 3530 srcBlock+=8;
3531 } 3531 }
3532 if(width==dstStride) 3532 if(width==ABS(dstStride))
3533 memcpy(dst, tempDst + 9*dstStride, copyAhead*dstStride); 3533 linecpy(dst, tempDst + 9*dstStride, copyAhead, dstStride);
3534 else 3534 else
3535 { 3535 {
3536 int i; 3536 int i;
3537 for(i=0; i<copyAhead; i++) 3537 for(i=0; i<copyAhead; i++)
3538 { 3538 {
3550 #ifdef HAVE_MMX 3550 #ifdef HAVE_MMX
3551 uint8_t *tempBlock1= c.tempBlocks; 3551 uint8_t *tempBlock1= c.tempBlocks;
3552 uint8_t *tempBlock2= c.tempBlocks + 8; 3552 uint8_t *tempBlock2= c.tempBlocks + 8;
3553 #endif 3553 #endif
3554 int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride]; 3554 int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride];
3555 int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*QPStride]; 3555 int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*ABS(QPStride)];
3556 int QP=0; 3556 int QP=0;
3557 /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards 3557 /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards
3558 if not than use a temporary buffer */ 3558 if not than use a temporary buffer */
3559 if(y+15 >= height) 3559 if(y+15 >= height)
3560 { 3560 {
3561 int i; 3561 int i;
3562 /* copy from line (copyAhead) to (copyAhead+7) of src, these will be copied with 3562 /* copy from line (copyAhead) to (copyAhead+7) of src, these will be copied with
3563 blockcopy to dst later */ 3563 blockcopy to dst later */
3564 memcpy(tempSrc + srcStride*copyAhead, srcBlock + srcStride*copyAhead, 3564 linecpy(tempSrc + srcStride*copyAhead, srcBlock + srcStride*copyAhead,
3565 srcStride*MAX(height-y-copyAhead, 0) ); 3565 MAX(height-y-copyAhead, 0), srcStride);
3566 3566
3567 /* duplicate last line of src to fill the void upto line (copyAhead+7) */ 3567 /* duplicate last line of src to fill the void upto line (copyAhead+7) */
3568 for(i=MAX(height-y, 8); i<copyAhead+8; i++) 3568 for(i=MAX(height-y, 8); i<copyAhead+8; i++)
3569 memcpy(tempSrc + srcStride*i, src + srcStride*(height-1), srcStride); 3569 memcpy(tempSrc + srcStride*i, src + srcStride*(height-1), ABS(srcStride));
3570 3570
3571 /* copy up to (copyAhead+1) lines of dst (line -1 to (copyAhead-1))*/ 3571 /* copy up to (copyAhead+1) lines of dst (line -1 to (copyAhead-1))*/
3572 memcpy(tempDst, dstBlock - dstStride, dstStride*MIN(height-y+1, copyAhead+1) ); 3572 linecpy(tempDst, dstBlock - dstStride, MIN(height-y+1, copyAhead+1), dstStride);
3573 3573
3574 /* duplicate last line of dst to fill the void upto line (copyAhead) */ 3574 /* duplicate last line of dst to fill the void upto line (copyAhead) */
3575 for(i=height-y+1; i<=copyAhead; i++) 3575 for(i=height-y+1; i<=copyAhead; i++)
3576 memcpy(tempDst + dstStride*i, dst + dstStride*(height-1), dstStride); 3576 memcpy(tempDst + dstStride*i, dst + dstStride*(height-1), ABS(dstStride));
3577 3577
3578 dstBlock= tempDst + dstStride; 3578 dstBlock= tempDst + dstStride;
3579 srcBlock= tempSrc; 3579 srcBlock= tempSrc;
3580 } 3580 }
3581 //printf("\n"); 3581 //printf("\n");
3783 3783
3784 /* did we use a tmp buffer for the last lines*/ 3784 /* did we use a tmp buffer for the last lines*/
3785 if(y+15 >= height) 3785 if(y+15 >= height)
3786 { 3786 {
3787 uint8_t *dstBlock= &(dst[y*dstStride]); 3787 uint8_t *dstBlock= &(dst[y*dstStride]);
3788 if(width==dstStride) 3788 if(width==ABS(dstStride))
3789 memcpy(dstBlock, tempDst + dstStride, dstStride*(height-y)); 3789 linecpy(dstBlock, tempDst + dstStride, height-y, dstStride);
3790 else 3790 else
3791 { 3791 {
3792 int i; 3792 int i;
3793 for(i=0; i<height-y; i++) 3793 for(i=0; i<height-y; i++)
3794 { 3794 {