Mercurial > mplayer.hg
comparison postproc/postprocess_template.c @ 4399:a4098aec828a
minor QP bugfix
author | michael |
---|---|
date | Mon, 28 Jan 2002 22:38:15 +0000 |
parents | 4b39bde9f7ad |
children | f3dc8bf8383a |
comparison
equal
deleted
inserted
replaced
4398:4039f5580f76 | 4399:a4098aec828a |
---|---|
1 /* | 1 /* |
2 Copyright (C) 2001 Michael Niedermayer (michaelni@gmx.at) | 2 Copyright (C) 2001-2002 Michael Niedermayer (michaelni@gmx.at) |
3 | 3 |
4 This program is free software; you can redistribute it and/or modify | 4 This program is free software; you can redistribute it and/or modify |
5 it under the terms of the GNU General Public License as published by | 5 it under the terms of the GNU General Public License as published by |
6 the Free Software Foundation; either version 2 of the License, or | 6 the Free Software Foundation; either version 2 of the License, or |
7 (at your option) any later version. | 7 (at your option) any later version. |
2585 #endif | 2585 #endif |
2586 /* we need 64bit here otherwise weŽll going to have a problem | 2586 /* we need 64bit here otherwise weŽll going to have a problem |
2587 after watching a black picture for 5 hours*/ | 2587 after watching a black picture for 5 hours*/ |
2588 static uint64_t *yHistogram= NULL; | 2588 static uint64_t *yHistogram= NULL; |
2589 int black=0, white=255; // blackest black and whitest white in the picture | 2589 int black=0, white=255; // blackest black and whitest white in the picture |
2590 int QPCorrecture= 256; | 2590 int QPCorrecture= 256*256; |
2591 | 2591 |
2592 /* Temporary buffers for handling the last row(s) */ | 2592 /* Temporary buffers for handling the last row(s) */ |
2593 static uint8_t *tempDst= NULL; | 2593 static uint8_t *tempDst= NULL; |
2594 static uint8_t *tempSrc= NULL; | 2594 static uint8_t *tempSrc= NULL; |
2595 | 2595 |
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 | |
2619 dcOffset= ppMode->maxDcDiff; | 2618 dcOffset= ppMode->maxDcDiff; |
2620 dcThreshold= ppMode->maxDcDiff*2 + 1; | 2619 dcThreshold= ppMode->maxDcDiff*2 + 1; |
2621 | 2620 |
2622 #ifdef HAVE_MMX | 2621 #ifdef HAVE_MMX |
2623 maxTmpNoise[0]= ppMode->maxTmpNoise[0]; | 2622 maxTmpNoise[0]= ppMode->maxTmpNoise[0]; |
2725 packedYOffset|= packedYOffset<<32; | 2724 packedYOffset|= packedYOffset<<32; |
2726 packedYOffset|= packedYOffset<<16; | 2725 packedYOffset|= packedYOffset<<16; |
2727 | 2726 |
2728 packedYScale|= packedYScale<<32; | 2727 packedYScale|= packedYScale<<32; |
2729 packedYScale|= packedYScale<<16; | 2728 packedYScale|= packedYScale<<16; |
2729 | |
2730 if(mode & LEVEL_FIX) QPCorrecture= (int)(scale*256*256 + 0.5); | |
2731 else QPCorrecture= 256*256; | |
2730 } | 2732 } |
2731 else | 2733 else |
2732 { | 2734 { |
2733 packedYScale= 0x0100010001000100LL; | 2735 packedYScale= 0x0100010001000100LL; |
2734 packedYOffset= 0; | 2736 packedYOffset= 0; |
2737 QPCorrecture= 256*256; | |
2735 } | 2738 } |
2736 | |
2737 if(mode & LEVEL_FIX) QPCorrecture= packedYScale &0xFFFF; | |
2738 else QPCorrecture= 256; | |
2739 | 2739 |
2740 /* copy & deinterlace first row of blocks */ | 2740 /* copy & deinterlace first row of blocks */ |
2741 y=-BLOCK_SIZE; | 2741 y=-BLOCK_SIZE; |
2742 { | 2742 { |
2743 //1% speedup if these are here instead of the inner loop | 2743 //1% speedup if these are here instead of the inner loop |
2817 uint8_t *tempBlock1= tempBlocks; | 2817 uint8_t *tempBlock1= tempBlocks; |
2818 uint8_t *tempBlock2= tempBlocks + 8; | 2818 uint8_t *tempBlock2= tempBlocks + 8; |
2819 #endif | 2819 #endif |
2820 #ifdef ARCH_X86 | 2820 #ifdef ARCH_X86 |
2821 int *QPptr= isColor ? &QPs[(y>>3)*QPStride] :&QPs[(y>>4)*QPStride]; | 2821 int *QPptr= isColor ? &QPs[(y>>3)*QPStride] :&QPs[(y>>4)*QPStride]; |
2822 int QPDelta= isColor ? 1<<(32-3) : 1<<(32-4); | 2822 int QPDelta= isColor ? (-1) : 1<<31; |
2823 int QPFrac= QPDelta; | 2823 int QPFrac= 1<<30; |
2824 #endif | 2824 #endif |
2825 int QP=0; | 2825 int QP=0; |
2826 /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards | 2826 /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards |
2827 if not than use a temporary buffer */ | 2827 if not than use a temporary buffer */ |
2828 if(y+15 >= height) | 2828 if(y+15 >= height) |
2873 QPs[(y>>3)*QPStride + (x>>3)]: | 2873 QPs[(y>>3)*QPStride + (x>>3)]: |
2874 QPs[(y>>4)*QPStride + (x>>4)]; | 2874 QPs[(y>>4)*QPStride + (x>>4)]; |
2875 #endif | 2875 #endif |
2876 if(!isColor) | 2876 if(!isColor) |
2877 { | 2877 { |
2878 QP= (QP* QPCorrecture)>>8; | 2878 QP= (QP* QPCorrecture + 256*128)>>16; |
2879 yHistogram[ srcBlock[srcStride*12 + 4] ]++; | 2879 yHistogram[ srcBlock[srcStride*12 + 4] ]++; |
2880 } | 2880 } |
2881 #ifdef HAVE_MMX | 2881 #ifdef HAVE_MMX |
2882 asm volatile( | 2882 asm volatile( |
2883 "movd %0, %%mm7 \n\t" | 2883 "movd %0, %%mm7 \n\t" |