Mercurial > libpostproc.hg
comparison postprocess.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 | 300e4c8b39ab |
children | 2e855f3f4e0b |
comparison
equal
deleted
inserted
replaced
26:300e4c8b39ab | 27:c83a71c1729d |
---|---|
97 | 97 |
98 #ifdef HAVE_ALTIVEC_H | 98 #ifdef HAVE_ALTIVEC_H |
99 #include <altivec.h> | 99 #include <altivec.h> |
100 #endif | 100 #endif |
101 | 101 |
102 #define MIN(a,b) ((a) > (b) ? (b) : (a)) | |
103 #define MAX(a,b) ((a) < (b) ? (b) : (a)) | |
104 | |
105 #define GET_MODE_BUFFER_SIZE 500 | 102 #define GET_MODE_BUFFER_SIZE 500 |
106 #define OPTIONS_ARRAY_SIZE 10 | 103 #define OPTIONS_ARRAY_SIZE 10 |
107 #define BLOCK_SIZE 8 | 104 #define BLOCK_SIZE 8 |
108 #define TEMP_STRIDE 8 | 105 #define TEMP_STRIDE 8 |
109 //#define NUM_BLOCKS_AT_ONCE 16 //not used yet | 106 //#define NUM_BLOCKS_AT_ONCE 16 //not used yet |
339 { | 336 { |
340 const int q=(dst[3] - dst[4])/2; | 337 const int q=(dst[3] - dst[4])/2; |
341 const int leftEnergy= 5*(dst[2] - dst[1]) + 2*(dst[0] - dst[3]); | 338 const int leftEnergy= 5*(dst[2] - dst[1]) + 2*(dst[0] - dst[3]); |
342 const int rightEnergy= 5*(dst[6] - dst[5]) + 2*(dst[4] - dst[7]); | 339 const int rightEnergy= 5*(dst[6] - dst[5]) + 2*(dst[4] - dst[7]); |
343 | 340 |
344 int d= ABS(middleEnergy) - MIN( ABS(leftEnergy), ABS(rightEnergy) ); | 341 int d= ABS(middleEnergy) - FFMIN( ABS(leftEnergy), ABS(rightEnergy) ); |
345 d= MAX(d, 0); | 342 d= FFMAX(d, 0); |
346 | 343 |
347 d= (5*d + 32) >> 6; | 344 d= (5*d + 32) >> 6; |
348 d*= SIGN(-middleEnergy); | 345 d*= SIGN(-middleEnergy); |
349 | 346 |
350 if(q>0) | 347 if(q>0) |
448 { | 445 { |
449 int a= src[1] - src[2]; | 446 int a= src[1] - src[2]; |
450 int b= src[3] - src[4]; | 447 int b= src[3] - src[4]; |
451 int c= src[5] - src[6]; | 448 int c= src[5] - src[6]; |
452 | 449 |
453 int d= MAX(ABS(b) - (ABS(a) + ABS(c))/2, 0); | 450 int d= FFMAX(ABS(b) - (ABS(a) + ABS(c))/2, 0); |
454 | 451 |
455 if(d < QP) | 452 if(d < QP) |
456 { | 453 { |
457 int v = d * SIGN(-b); | 454 int v = d * SIGN(-b); |
458 | 455 |
541 { | 538 { |
542 const int q=(src[3*step] - src[4*step])/2; | 539 const int q=(src[3*step] - src[4*step])/2; |
543 const int leftEnergy= 5*(src[2*step] - src[1*step]) + 2*(src[0*step] - src[3*step]); | 540 const int leftEnergy= 5*(src[2*step] - src[1*step]) + 2*(src[0*step] - src[3*step]); |
544 const int rightEnergy= 5*(src[6*step] - src[5*step]) + 2*(src[4*step] - src[7*step]); | 541 const int rightEnergy= 5*(src[6*step] - src[5*step]) + 2*(src[4*step] - src[7*step]); |
545 | 542 |
546 int d= ABS(middleEnergy) - MIN( ABS(leftEnergy), ABS(rightEnergy) ); | 543 int d= ABS(middleEnergy) - FFMIN( ABS(leftEnergy), ABS(rightEnergy) ); |
547 d= MAX(d, 0); | 544 d= FFMAX(d, 0); |
548 | 545 |
549 d= (5*d + 32) >> 6; | 546 d= (5*d + 32) >> 6; |
550 d*= SIGN(-middleEnergy); | 547 d*= SIGN(-middleEnergy); |
551 | 548 |
552 if(q>0) | 549 if(q>0) |
1042 { | 1039 { |
1043 int mbWidth = (width+15)>>4; | 1040 int mbWidth = (width+15)>>4; |
1044 int mbHeight= (height+15)>>4; | 1041 int mbHeight= (height+15)>>4; |
1045 PPMode *mode = (PPMode*)vm; | 1042 PPMode *mode = (PPMode*)vm; |
1046 PPContext *c = (PPContext*)vc; | 1043 PPContext *c = (PPContext*)vc; |
1047 int minStride= MAX(ABS(srcStride[0]), ABS(dstStride[0])); | 1044 int minStride= FFMAX(ABS(srcStride[0]), ABS(dstStride[0])); |
1048 int absQPStride = ABS(QPStride); | 1045 int absQPStride = ABS(QPStride); |
1049 | 1046 |
1050 // c->stride and c->QPStride are always positive | 1047 // c->stride and c->QPStride are always positive |
1051 if(c->stride < minStride || c->qpStride < absQPStride) | 1048 if(c->stride < minStride || c->qpStride < absQPStride) |
1052 reallocBuffers(c, width, height, | 1049 reallocBuffers(c, width, height, |
1053 MAX(minStride, c->stride), | 1050 FFMAX(minStride, c->stride), |
1054 MAX(c->qpStride, absQPStride)); | 1051 FFMAX(c->qpStride, absQPStride)); |
1055 | 1052 |
1056 if(QP_store==NULL || (mode->lumMode & FORCE_QUANT)) | 1053 if(QP_store==NULL || (mode->lumMode & FORCE_QUANT)) |
1057 { | 1054 { |
1058 int i; | 1055 int i; |
1059 QP_store= c->forcedQPTable; | 1056 QP_store= c->forcedQPTable; |