comparison libpostproc/postprocess_template.c @ 182:3ccd74a91074 libavcodec

minor brightness/contrast bugfix / moved some global vars into ppMode non mmx compilation bugfix
author michael
date Fri, 28 Dec 2001 13:56:04 +0000
parents edc5f6cf1855
children c2b6d68a0671
comparison
equal deleted inserted replaced
181:edc5f6cf1855 182:3ccd74a91074
2613 #endif 2613 #endif
2614 #ifdef TIMING 2614 #ifdef TIMING
2615 long long memcpyTime=0, vertTime=0, horizTime=0, sumTime; 2615 long long memcpyTime=0, vertTime=0, horizTime=0, sumTime;
2616 sumTime= rdtsc(); 2616 sumTime= rdtsc();
2617 #endif 2617 #endif
2618 //mode= 0x7F; 2618
2619 dcOffset= ppMode->maxDcDiff;
2620 dcThreshold= ppMode->maxDcDiff*2 + 1;
2621
2619 #ifdef HAVE_MMX 2622 #ifdef HAVE_MMX
2620 maxTmpNoise[0]= ppMode->maxTmpNoise[0]; 2623 maxTmpNoise[0]= ppMode->maxTmpNoise[0];
2621 maxTmpNoise[1]= ppMode->maxTmpNoise[1]; 2624 maxTmpNoise[1]= ppMode->maxTmpNoise[1];
2622 maxTmpNoise[2]= ppMode->maxTmpNoise[2]; 2625 maxTmpNoise[2]= ppMode->maxTmpNoise[2];
2626
2627 mmxDCOffset= 0x7F - dcOffset;
2628 mmxDCThreshold= 0x7F - dcThreshold;
2629
2630 mmxDCOffset*= 0x0101010101010101LL;
2631 mmxDCThreshold*= 0x0101010101010101LL;
2623 #endif 2632 #endif
2624 2633
2625 if(mode & CUBIC_IPOL_DEINT_FILTER) copyAhead=16; 2634 if(mode & CUBIC_IPOL_DEINT_FILTER) copyAhead=16;
2626 else if(mode & LINEAR_BLEND_DEINT_FILTER) copyAhead=14; 2635 else if(mode & LINEAR_BLEND_DEINT_FILTER) copyAhead=14;
2627 else if( (mode & V_DEBLOCK) 2636 else if( (mode & V_DEBLOCK)
2660 yHistogram= (uint64_t*)malloc(8*256); 2669 yHistogram= (uint64_t*)malloc(8*256);
2661 for(i=0; i<256; i++) yHistogram[i]= width*height/64*15/256; 2670 for(i=0; i<256; i++) yHistogram[i]= width*height/64*15/256;
2662 2671
2663 if(mode & FULL_Y_RANGE) 2672 if(mode & FULL_Y_RANGE)
2664 { 2673 {
2665 maxAllowedY=255; 2674 ppMode->maxAllowedY=255;
2666 minAllowedY=0; 2675 ppMode->minAllowedY=0;
2667 } 2676 }
2668 } 2677 }
2669 2678
2670 if(!isColor) 2679 if(!isColor)
2671 { 2680 {
2701 { 2710 {
2702 if(clipped < maxClipped) break; 2711 if(clipped < maxClipped) break;
2703 clipped-= yHistogram[white]; 2712 clipped-= yHistogram[white];
2704 } 2713 }
2705 2714
2706 scale= (double)(maxAllowedY - minAllowedY) / (double)(white-black); 2715 scale= (double)(ppMode->maxAllowedY - ppMode->minAllowedY) / (double)(white-black);
2707 2716
2708 #ifdef HAVE_MMX2 2717 #ifdef HAVE_MMX2
2709 packedYScale= (uint16_t)(scale*256.0 + 0.5); 2718 packedYScale= (uint16_t)(scale*256.0 + 0.5);
2710 packedYOffset= (((black*packedYScale)>>8) - minAllowedY) & 0xFFFF; 2719 packedYOffset= (((black*packedYScale)>>8) - ppMode->minAllowedY) & 0xFFFF;
2711 #else 2720 #else
2712 packedYScale= (uint16_t)(scale*1024.0 + 0.5); 2721 packedYScale= (uint16_t)(scale*1024.0 + 0.5);
2713 packedYOffset= (black - minAllowedY) & 0xFFFF; 2722 packedYOffset= (black - ppMode->minAllowedY) & 0xFFFF;
2714 #endif 2723 #endif
2715 2724
2716 packedYOffset|= packedYOffset<<32; 2725 packedYOffset|= packedYOffset<<32;
2717 packedYOffset|= packedYOffset<<16; 2726 packedYOffset|= packedYOffset<<16;
2718 2727