comparison postprocess_template.c @ 98:e565483b1193 libpostproc

typo fixes: tempBlured --> tempBlurred
author diego
date Sat, 22 Mar 2008 17:36:31 +0000
parents 2653d9f33b8a
children 83d51d1fb580
comparison
equal deleted inserted replaced
97:2653d9f33b8a 98:e565483b1193
2180 #endif //HAVE_MMX 2180 #endif //HAVE_MMX
2181 //static long test=0; 2181 //static long test=0;
2182 2182
2183 #ifndef HAVE_ALTIVEC 2183 #ifndef HAVE_ALTIVEC
2184 static inline void RENAME(tempNoiseReducer)(uint8_t *src, int stride, 2184 static inline void RENAME(tempNoiseReducer)(uint8_t *src, int stride,
2185 uint8_t *tempBlured, uint32_t *tempBluredPast, int *maxNoise) 2185 uint8_t *tempBlurred, uint32_t *tempBlurredPast, int *maxNoise)
2186 { 2186 {
2187 // to save a register (FIXME do this outside of the loops) 2187 // to save a register (FIXME do this outside of the loops)
2188 tempBluredPast[127]= maxNoise[0]; 2188 tempBlurredPast[127]= maxNoise[0];
2189 tempBluredPast[128]= maxNoise[1]; 2189 tempBlurredPast[128]= maxNoise[1];
2190 tempBluredPast[129]= maxNoise[2]; 2190 tempBlurredPast[129]= maxNoise[2];
2191 2191
2192 #define FAST_L2_DIFF 2192 #define FAST_L2_DIFF
2193 //#define L1_DIFF //u should change the thresholds too if u try that one 2193 //#define L1_DIFF //u should change the thresholds too if u try that one
2194 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) 2194 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
2195 asm volatile( 2195 asm volatile(
2474 "movq %%mm2, (%0, %%"REG_a", 2) \n\t" // L6 2474 "movq %%mm2, (%0, %%"REG_a", 2) \n\t" // L6
2475 "movq %%mm3, (%0, %%"REG_c") \n\t" // L7 2475 "movq %%mm3, (%0, %%"REG_c") \n\t" // L7
2476 2476
2477 "4: \n\t" 2477 "4: \n\t"
2478 2478
2479 :: "r" (src), "r" (tempBlured), "r"((long)stride), "m" (tempBluredPast) 2479 :: "r" (src), "r" (tempBlurred), "r"((long)stride), "m" (tempBlurredPast)
2480 : "%"REG_a, "%"REG_d, "%"REG_c, "memory" 2480 : "%"REG_a, "%"REG_d, "%"REG_c, "memory"
2481 ); 2481 );
2482 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW) 2482 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
2483 { 2483 {
2484 int y; 2484 int y;
2487 int i; 2487 int i;
2488 2488
2489 for(y=0; y<8; y++){ 2489 for(y=0; y<8; y++){
2490 int x; 2490 int x;
2491 for(x=0; x<8; x++){ 2491 for(x=0; x<8; x++){
2492 int ref= tempBlured[ x + y*stride ]; 2492 int ref= tempBlurred[ x + y*stride ];
2493 int cur= src[ x + y*stride ]; 2493 int cur= src[ x + y*stride ];
2494 int d1=ref - cur; 2494 int d1=ref - cur;
2495 // if(x==0 || x==7) d1+= d1>>1; 2495 // if(x==0 || x==7) d1+= d1>>1;
2496 // if(y==0 || y==7) d1+= d1>>1; 2496 // if(y==0 || y==7) d1+= d1>>1;
2497 // d+= FFABS(d1); 2497 // d+= FFABS(d1);
2500 } 2500 }
2501 } 2501 }
2502 i=d; 2502 i=d;
2503 d= ( 2503 d= (
2504 4*d 2504 4*d
2505 +(*(tempBluredPast-256)) 2505 +(*(tempBlurredPast-256))
2506 +(*(tempBluredPast-1))+ (*(tempBluredPast+1)) 2506 +(*(tempBlurredPast-1))+ (*(tempBlurredPast+1))
2507 +(*(tempBluredPast+256)) 2507 +(*(tempBlurredPast+256))
2508 +4)>>3; 2508 +4)>>3;
2509 *tempBluredPast=i; 2509 *tempBlurredPast=i;
2510 // ((*tempBluredPast)*3 + d + 2)>>2; 2510 // ((*tempBlurredPast)*3 + d + 2)>>2;
2511 2511
2512 /* 2512 /*
2513 Switch between 2513 Switch between
2514 1 0 0 0 0 0 0 (0) 2514 1 0 0 0 0 0 0 (0)
2515 64 32 16 8 4 2 1 (1) 2515 64 32 16 8 4 2 1 (1)
2519 if(d > maxNoise[1]){ 2519 if(d > maxNoise[1]){
2520 if(d < maxNoise[2]){ 2520 if(d < maxNoise[2]){
2521 for(y=0; y<8; y++){ 2521 for(y=0; y<8; y++){
2522 int x; 2522 int x;
2523 for(x=0; x<8; x++){ 2523 for(x=0; x<8; x++){
2524 int ref= tempBlured[ x + y*stride ]; 2524 int ref= tempBlurred[ x + y*stride ];
2525 int cur= src[ x + y*stride ]; 2525 int cur= src[ x + y*stride ];
2526 tempBlured[ x + y*stride ]= 2526 tempBlurred[ x + y*stride ]=
2527 src[ x + y*stride ]= 2527 src[ x + y*stride ]=
2528 (ref + cur + 1)>>1; 2528 (ref + cur + 1)>>1;
2529 } 2529 }
2530 } 2530 }
2531 }else{ 2531 }else{
2532 for(y=0; y<8; y++){ 2532 for(y=0; y<8; y++){
2533 int x; 2533 int x;
2534 for(x=0; x<8; x++){ 2534 for(x=0; x<8; x++){
2535 tempBlured[ x + y*stride ]= src[ x + y*stride ]; 2535 tempBlurred[ x + y*stride ]= src[ x + y*stride ];
2536 } 2536 }
2537 } 2537 }
2538 } 2538 }
2539 }else{ 2539 }else{
2540 if(d < maxNoise[0]){ 2540 if(d < maxNoise[0]){
2541 for(y=0; y<8; y++){ 2541 for(y=0; y<8; y++){
2542 int x; 2542 int x;
2543 for(x=0; x<8; x++){ 2543 for(x=0; x<8; x++){
2544 int ref= tempBlured[ x + y*stride ]; 2544 int ref= tempBlurred[ x + y*stride ];
2545 int cur= src[ x + y*stride ]; 2545 int cur= src[ x + y*stride ];
2546 tempBlured[ x + y*stride ]= 2546 tempBlurred[ x + y*stride ]=
2547 src[ x + y*stride ]= 2547 src[ x + y*stride ]=
2548 (ref*7 + cur + 4)>>3; 2548 (ref*7 + cur + 4)>>3;
2549 } 2549 }
2550 } 2550 }
2551 }else{ 2551 }else{
2552 for(y=0; y<8; y++){ 2552 for(y=0; y<8; y++){
2553 int x; 2553 int x;
2554 for(x=0; x<8; x++){ 2554 for(x=0; x<8; x++){
2555 int ref= tempBlured[ x + y*stride ]; 2555 int ref= tempBlurred[ x + y*stride ];
2556 int cur= src[ x + y*stride ]; 2556 int cur= src[ x + y*stride ];
2557 tempBlured[ x + y*stride ]= 2557 tempBlurred[ x + y*stride ]=
2558 src[ x + y*stride ]= 2558 src[ x + y*stride ]=
2559 (ref*3 + cur + 2)>>2; 2559 (ref*3 + cur + 2)>>2;
2560 } 2560 }
2561 } 2561 }
2562 } 2562 }
3648 } 3648 }
3649 3649
3650 if(mode & TEMP_NOISE_FILTER) 3650 if(mode & TEMP_NOISE_FILTER)
3651 { 3651 {
3652 RENAME(tempNoiseReducer)(dstBlock-8, stride, 3652 RENAME(tempNoiseReducer)(dstBlock-8, stride,
3653 c.tempBlured[isColor] + y*dstStride + x, 3653 c.tempBlurred[isColor] + y*dstStride + x,
3654 c.tempBluredPast[isColor] + (y>>3)*256 + (x>>3), 3654 c.tempBlurredPast[isColor] + (y>>3)*256 + (x>>3),
3655 c.ppMode.maxTmpNoise); 3655 c.ppMode.maxTmpNoise);
3656 } 3656 }
3657 } 3657 }
3658 3658
3659 dstBlock+=8; 3659 dstBlock+=8;
3670 if(y > 0) RENAME(dering)(dstBlock - dstStride - 8, dstStride, &c); 3670 if(y > 0) RENAME(dering)(dstBlock - dstStride - 8, dstStride, &c);
3671 } 3671 }
3672 3672
3673 if((mode & TEMP_NOISE_FILTER)){ 3673 if((mode & TEMP_NOISE_FILTER)){
3674 RENAME(tempNoiseReducer)(dstBlock-8, dstStride, 3674 RENAME(tempNoiseReducer)(dstBlock-8, dstStride,
3675 c.tempBlured[isColor] + y*dstStride + x, 3675 c.tempBlurred[isColor] + y*dstStride + x,
3676 c.tempBluredPast[isColor] + (y>>3)*256 + (x>>3), 3676 c.tempBlurredPast[isColor] + (y>>3)*256 + (x>>3),
3677 c.ppMode.maxTmpNoise); 3677 c.ppMode.maxTmpNoise);
3678 } 3678 }
3679 3679
3680 /* did we use a tmp buffer for the last lines*/ 3680 /* did we use a tmp buffer for the last lines*/
3681 if(y+15 >= height){ 3681 if(y+15 >= height){