comparison postprocess_template.c @ 27:c83a71c1729d libpostproc

Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
author diego
date Tue, 10 Oct 2006 08:09:12 +0000
parents da3bfee1fa67
children 2e855f3f4e0b
comparison
equal deleted inserted replaced
26:300e4c8b39ab 27:c83a71c1729d
588 int a= src[l3] - src[l4]; 588 int a= src[l3] - src[l4];
589 int b= src[l4] - src[l5]; 589 int b= src[l4] - src[l5];
590 int c= src[l5] - src[l6]; 590 int c= src[l5] - src[l6];
591 591
592 int d= ABS(b) - ((ABS(a) + ABS(c))>>1); 592 int d= ABS(b) - ((ABS(a) + ABS(c))>>1);
593 d= MAX(d, 0); 593 d= FFMAX(d, 0);
594 594
595 if(d < co->QP*2) 595 if(d < co->QP*2)
596 { 596 {
597 int v = d * SIGN(-b); 597 int v = d * SIGN(-b);
598 598
849 { 849 {
850 const int q=(src[l4] - src[l5])/2; 850 const int q=(src[l4] - src[l5])/2;
851 const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]); 851 const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]);
852 const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]); 852 const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]);
853 853
854 int d= ABS(middleEnergy) - MIN( ABS(leftEnergy), ABS(rightEnergy) ); 854 int d= ABS(middleEnergy) - FFMIN( ABS(leftEnergy), ABS(rightEnergy) );
855 d= MAX(d, 0); 855 d= FFMAX(d, 0);
856 856
857 d= (5*d + 32) >> 6; 857 d= (5*d + 32) >> 6;
858 d*= SIGN(-middleEnergy); 858 d*= SIGN(-middleEnergy);
859 859
860 if(q>0) 860 if(q>0)
1153 { 1153 {
1154 const int q=(src[l4] - src[l5])/2; 1154 const int q=(src[l4] - src[l5])/2;
1155 const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]); 1155 const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]);
1156 const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]); 1156 const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]);
1157 1157
1158 int d= ABS(middleEnergy) - MIN( ABS(leftEnergy), ABS(rightEnergy) ); 1158 int d= ABS(middleEnergy) - FFMIN( ABS(leftEnergy), ABS(rightEnergy) );
1159 d= MAX(d, 0); 1159 d= FFMAX(d, 0);
1160 1160
1161 d= (5*d + 32) >> 6; 1161 d= (5*d + 32) >> 6;
1162 d*= SIGN(-middleEnergy); 1162 d*= SIGN(-middleEnergy);
1163 1163
1164 if(q>0) 1164 if(q>0)
1530 int t = 0; 1530 int t = 0;
1531 p= src + stride*y; 1531 p= src + stride*y;
1532 for(x=1; x<9; x++) 1532 for(x=1; x<9; x++)
1533 { 1533 {
1534 p++; 1534 p++;
1535 *p = MIN(*p + 20, 255); 1535 *p = FFMIN(*p + 20, 255);
1536 } 1536 }
1537 } 1537 }
1538 // src[0] = src[7]=src[stride*7]=src[stride*7 + 7]=255; 1538 // src[0] = src[7]=src[stride*7]=src[stride*7 + 7]=255;
1539 } 1539 }
1540 #endif 1540 #endif
3564 { 3564 {
3565 int i; 3565 int i;
3566 /* copy from line (copyAhead) to (copyAhead+7) of src, these will be copied with 3566 /* copy from line (copyAhead) to (copyAhead+7) of src, these will be copied with
3567 blockcopy to dst later */ 3567 blockcopy to dst later */
3568 linecpy(tempSrc + srcStride*copyAhead, srcBlock + srcStride*copyAhead, 3568 linecpy(tempSrc + srcStride*copyAhead, srcBlock + srcStride*copyAhead,
3569 MAX(height-y-copyAhead, 0), srcStride); 3569 FFMAX(height-y-copyAhead, 0), srcStride);
3570 3570
3571 /* duplicate last line of src to fill the void upto line (copyAhead+7) */ 3571 /* duplicate last line of src to fill the void upto line (copyAhead+7) */
3572 for(i=MAX(height-y, 8); i<copyAhead+8; i++) 3572 for(i=FFMAX(height-y, 8); i<copyAhead+8; i++)
3573 memcpy(tempSrc + srcStride*i, src + srcStride*(height-1), ABS(srcStride)); 3573 memcpy(tempSrc + srcStride*i, src + srcStride*(height-1), ABS(srcStride));
3574 3574
3575 /* copy up to (copyAhead+1) lines of dst (line -1 to (copyAhead-1))*/ 3575 /* copy up to (copyAhead+1) lines of dst (line -1 to (copyAhead-1))*/
3576 linecpy(tempDst, dstBlock - dstStride, MIN(height-y+1, copyAhead+1), dstStride); 3576 linecpy(tempDst, dstBlock - dstStride, FFMIN(height-y+1, copyAhead+1), dstStride);
3577 3577
3578 /* duplicate last line of dst to fill the void upto line (copyAhead) */ 3578 /* duplicate last line of dst to fill the void upto line (copyAhead) */
3579 for(i=height-y+1; i<=copyAhead; i++) 3579 for(i=height-y+1; i<=copyAhead; i++)
3580 memcpy(tempDst + dstStride*i, dst + dstStride*(height-1), ABS(dstStride)); 3580 memcpy(tempDst + dstStride*i, dst + dstStride*(height-1), ABS(dstStride));
3581 3581