comparison libpostproc/postprocess.c @ 2967:ef2149182f1c libavcodec

COSMETICS: Remove all trailing whitespace.
author diego
date Sat, 17 Dec 2005 18:14:38 +0000
parents e99703305233
children bfabfdf9ce55
comparison
equal deleted inserted replaced
2966:564788471dd4 2967:ef2149182f1c
20 20
21 /** 21 /**
22 * @file postprocess.c 22 * @file postprocess.c
23 * postprocessing. 23 * postprocessing.
24 */ 24 */
25 25
26 /* 26 /*
27 C MMX MMX2 3DNow AltiVec 27 C MMX MMX2 3DNow AltiVec
28 isVertDC Ec Ec Ec 28 isVertDC Ec Ec Ec
29 isVertMinMaxOk Ec Ec Ec 29 isVertMinMaxOk Ec Ec Ec
30 doVertLowPass E e e Ec 30 doVertLowPass E e e Ec
265 if((unsigned)(src[4] - src[1] + 2*QP) > 4*QP) return 0; 265 if((unsigned)(src[4] - src[1] + 2*QP) > 4*QP) return 0;
266 src += stride; 266 src += stride;
267 if((unsigned)(src[6] - src[3] + 2*QP) > 4*QP) return 0; 267 if((unsigned)(src[6] - src[3] + 2*QP) > 4*QP) return 0;
268 src += stride; 268 src += stride;
269 } 269 }
270 #else 270 #else
271 for(i=0; i<8; i++){ 271 for(i=0; i<8; i++){
272 if((unsigned)(src[0] - src[7] + 2*QP) > 4*QP) return 0; 272 if((unsigned)(src[0] - src[7] + 2*QP) > 4*QP) return 0;
273 src += stride; 273 src += stride;
274 } 274 }
275 #endif 275 #endif
501 if(((unsigned)(src[ 5*step] - src[6*step] + dcOffset)) < dcThreshold) numEq++; 501 if(((unsigned)(src[ 5*step] - src[6*step] + dcOffset)) < dcThreshold) numEq++;
502 if(((unsigned)(src[ 6*step] - src[7*step] + dcOffset)) < dcThreshold) numEq++; 502 if(((unsigned)(src[ 6*step] - src[7*step] + dcOffset)) < dcThreshold) numEq++;
503 if(((unsigned)(src[ 7*step] - src[8*step] + dcOffset)) < dcThreshold) numEq++; 503 if(((unsigned)(src[ 7*step] - src[8*step] + dcOffset)) < dcThreshold) numEq++;
504 if(numEq > c->ppMode.flatnessThreshold){ 504 if(numEq > c->ppMode.flatnessThreshold){
505 int min, max, x; 505 int min, max, x;
506 506
507 if(src[0] > src[step]){ 507 if(src[0] > src[step]){
508 max= src[0]; 508 max= src[0];
509 min= src[step]; 509 min= src[step];
510 }else{ 510 }else{
511 max= src[step]; 511 max= src[step];
521 } 521 }
522 } 522 }
523 if(max-min < 2*QP){ 523 if(max-min < 2*QP){
524 const int first= ABS(src[-1*step] - src[0]) < QP ? src[-1*step] : src[0]; 524 const int first= ABS(src[-1*step] - src[0]) < QP ? src[-1*step] : src[0];
525 const int last= ABS(src[8*step] - src[7*step]) < QP ? src[8*step] : src[7*step]; 525 const int last= ABS(src[8*step] - src[7*step]) < QP ? src[8*step] : src[7*step];
526 526
527 int sums[10]; 527 int sums[10];
528 sums[0] = 4*first + src[0*step] + src[1*step] + src[2*step] + 4; 528 sums[0] = 4*first + src[0*step] + src[1*step] + src[2*step] + 4;
529 sums[1] = sums[0] - first + src[3*step]; 529 sums[1] = sums[0] - first + src[3*step];
530 sums[2] = sums[1] - first + src[4*step]; 530 sums[2] = sums[1] - first + src[4*step];
531 sums[3] = sums[2] - first + src[5*step]; 531 sums[3] = sums[2] - first + src[5*step];
554 const int leftEnergy= 5*(src[2*step] - src[1*step]) + 2*(src[0*step] - src[3*step]); 554 const int leftEnergy= 5*(src[2*step] - src[1*step]) + 2*(src[0*step] - src[3*step]);
555 const int rightEnergy= 5*(src[6*step] - src[5*step]) + 2*(src[4*step] - src[7*step]); 555 const int rightEnergy= 5*(src[6*step] - src[5*step]) + 2*(src[4*step] - src[7*step]);
556 556
557 int d= ABS(middleEnergy) - MIN( ABS(leftEnergy), ABS(rightEnergy) ); 557 int d= ABS(middleEnergy) - MIN( ABS(leftEnergy), ABS(rightEnergy) );
558 d= MAX(d, 0); 558 d= MAX(d, 0);
559 559
560 d= (5*d + 32) >> 6; 560 d= (5*d + 32) >> 6;
561 d*= SIGN(-middleEnergy); 561 d*= SIGN(-middleEnergy);
562 562
563 if(q>0) 563 if(q>0)
564 { 564 {
565 d= d<0 ? 0 : d; 565 d= d<0 ? 0 : d;
566 d= d>q ? q : d; 566 d= d>q ? q : d;
567 } 567 }
568 else 568 else
569 { 569 {
570 d= d>0 ? 0 : d; 570 d= d>0 ? 0 : d;
571 d= d<q ? q : d; 571 d= d<q ? q : d;
572 } 572 }
573 573
574 src[3*step]-= d; 574 src[3*step]-= d;
575 src[4*step]+= d; 575 src[4*step]+= d;
576 } 576 }
577 } 577 }
578 578
769 char *optionDelimiters= ":"; 769 char *optionDelimiters= ":";
770 struct PPMode *ppMode; 770 struct PPMode *ppMode;
771 char *filterToken; 771 char *filterToken;
772 772
773 ppMode= memalign(8, sizeof(PPMode)); 773 ppMode= memalign(8, sizeof(PPMode));
774 774
775 ppMode->lumMode= 0; 775 ppMode->lumMode= 0;
776 ppMode->chromMode= 0; 776 ppMode->chromMode= 0;
777 ppMode->maxTmpNoise[0]= 700; 777 ppMode->maxTmpNoise[0]= 700;
778 ppMode->maxTmpNoise[1]= 1500; 778 ppMode->maxTmpNoise[1]= 1500;
779 ppMode->maxTmpNoise[2]= 3000; 779 ppMode->maxTmpNoise[2]= 3000;
905 numOfUnknownOptions--; 905 numOfUnknownOptions--;
906 if(numOfNoises >= 3) break; 906 if(numOfNoises >= 3) break;
907 } 907 }
908 } 908 }
909 } 909 }
910 else if(filters[i].mask == V_DEBLOCK || filters[i].mask == H_DEBLOCK 910 else if(filters[i].mask == V_DEBLOCK || filters[i].mask == H_DEBLOCK
911 || filters[i].mask == V_A_DEBLOCK || filters[i].mask == H_A_DEBLOCK) 911 || filters[i].mask == V_A_DEBLOCK || filters[i].mask == H_A_DEBLOCK)
912 { 912 {
913 int o; 913 int o;
914 914
915 for(o=0; options[o]!=NULL && o<2; o++) 915 for(o=0; options[o]!=NULL && o<2; o++)
1002 1002
1003 pp_context_t *pp_get_context(int width, int height, int cpuCaps){ 1003 pp_context_t *pp_get_context(int width, int height, int cpuCaps){
1004 PPContext *c= memalign(32, sizeof(PPContext)); 1004 PPContext *c= memalign(32, sizeof(PPContext));
1005 int stride= (width+15)&(~15); //assumed / will realloc if needed 1005 int stride= (width+15)&(~15); //assumed / will realloc if needed
1006 int qpStride= (width+15)/16 + 2; //assumed / will realloc if needed 1006 int qpStride= (width+15)/16 + 2; //assumed / will realloc if needed
1007 1007
1008 global_init(); 1008 global_init();
1009 1009
1010 memset(c, 0, sizeof(PPContext)); 1010 memset(c, 0, sizeof(PPContext));
1011 c->cpuCaps= cpuCaps; 1011 c->cpuCaps= cpuCaps;
1012 if(cpuCaps&PP_FORMAT){ 1012 if(cpuCaps&PP_FORMAT){
1016 c->hChromaSubSample= 1; 1016 c->hChromaSubSample= 1;
1017 c->vChromaSubSample= 1; 1017 c->vChromaSubSample= 1;
1018 } 1018 }
1019 1019
1020 reallocBuffers(c, width, height, stride, qpStride); 1020 reallocBuffers(c, width, height, stride, qpStride);
1021 1021
1022 c->frameNum=-1; 1022 c->frameNum=-1;
1023 1023
1024 return c; 1024 return c;
1025 } 1025 }
1026 1026
1027 void pp_free_context(void *vc){ 1027 void pp_free_context(void *vc){
1028 PPContext *c = (PPContext*)vc; 1028 PPContext *c = (PPContext*)vc;
1029 int i; 1029 int i;
1030 1030
1031 for(i=0; i<3; i++) free(c->tempBlured[i]); 1031 for(i=0; i<3; i++) free(c->tempBlured[i]);
1032 for(i=0; i<3; i++) free(c->tempBluredPast[i]); 1032 for(i=0; i<3; i++) free(c->tempBluredPast[i]);
1033 1033
1034 free(c->tempBlocks); 1034 free(c->tempBlocks);
1035 free(c->yHistogram); 1035 free(c->yHistogram);
1036 free(c->tempDst); 1036 free(c->tempDst);
1037 free(c->tempSrc); 1037 free(c->tempSrc);
1038 free(c->deintTemp); 1038 free(c->deintTemp);
1039 free(c->stdQPTable); 1039 free(c->stdQPTable);
1040 free(c->nonBQPTable); 1040 free(c->nonBQPTable);
1041 free(c->forcedQPTable); 1041 free(c->forcedQPTable);
1042 1042
1043 memset(c, 0, sizeof(PPContext)); 1043 memset(c, 0, sizeof(PPContext));
1044 1044
1045 free(c); 1045 free(c);
1046 } 1046 }
1047 1047
1058 int minStride= MAX(ABS(srcStride[0]), ABS(dstStride[0])); 1058 int minStride= MAX(ABS(srcStride[0]), ABS(dstStride[0]));
1059 int absQPStride = ABS(QPStride); 1059 int absQPStride = ABS(QPStride);
1060 1060
1061 // c->stride and c->QPStride are always positive 1061 // c->stride and c->QPStride are always positive
1062 if(c->stride < minStride || c->qpStride < absQPStride) 1062 if(c->stride < minStride || c->qpStride < absQPStride)
1063 reallocBuffers(c, width, height, 1063 reallocBuffers(c, width, height,
1064 MAX(minStride, c->stride), 1064 MAX(minStride, c->stride),
1065 MAX(c->qpStride, absQPStride)); 1065 MAX(c->qpStride, absQPStride));
1066 1066
1067 if(QP_store==NULL || (mode->lumMode & FORCE_QUANT)) 1067 if(QP_store==NULL || (mode->lumMode & FORCE_QUANT))
1068 { 1068 {
1069 int i; 1069 int i;
1070 QP_store= c->forcedQPTable; 1070 QP_store= c->forcedQPTable;
1071 absQPStride = QPStride = 0; 1071 absQPStride = QPStride = 0;
1072 if(mode->lumMode & FORCE_QUANT) 1072 if(mode->lumMode & FORCE_QUANT)
1084 } 1084 }
1085 for(i<<=2; i<count; i++){ 1085 for(i<<=2; i<count; i++){
1086 c->stdQPTable[i] = QP_store[i]>>1; 1086 c->stdQPTable[i] = QP_store[i]>>1;
1087 } 1087 }
1088 QP_store= c->stdQPTable; 1088 QP_store= c->stdQPTable;
1089 QPStride= absQPStride; 1089 QPStride= absQPStride;
1090 } 1090 }
1091 1091
1092 if(0){ 1092 if(0){
1093 int x,y; 1093 int x,y;
1094 for(y=0; y<mbHeight; y++){ 1094 for(y=0; y<mbHeight; y++){