mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
postproc/postprocess_template: Compute packedYScale and QPCorrecture without floats
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
c41e0aedf5
commit
ebe919cce2
@ -3372,7 +3372,7 @@ static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[
|
|||||||
int i;
|
int i;
|
||||||
uint64_t maxClipped;
|
uint64_t maxClipped;
|
||||||
uint64_t clipped;
|
uint64_t clipped;
|
||||||
double scale;
|
AVRational scale;
|
||||||
|
|
||||||
c.frameNum++;
|
c.frameNum++;
|
||||||
// first frame is fscked so we ignore it
|
// first frame is fscked so we ignore it
|
||||||
@ -3397,13 +3397,13 @@ static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[
|
|||||||
clipped-= yHistogram[white];
|
clipped-= yHistogram[white];
|
||||||
}
|
}
|
||||||
|
|
||||||
scale= (double)(c.ppMode.maxAllowedY - c.ppMode.minAllowedY) / (double)(white-black);
|
scale = (AVRational){c.ppMode.maxAllowedY - c.ppMode.minAllowedY, white - black};
|
||||||
|
|
||||||
#if TEMPLATE_PP_MMXEXT
|
#if TEMPLATE_PP_MMXEXT
|
||||||
c.packedYScale= (uint16_t)(scale*256.0 + 0.5);
|
c.packedYScale = (uint16_t)av_rescale(scale.num, 256, scale.den);
|
||||||
c.packedYOffset= (((black*c.packedYScale)>>8) - c.ppMode.minAllowedY) & 0xFFFF;
|
c.packedYOffset= (((black*c.packedYScale)>>8) - c.ppMode.minAllowedY) & 0xFFFF;
|
||||||
#else
|
#else
|
||||||
c.packedYScale= (uint16_t)(scale*1024.0 + 0.5);
|
c.packedYScale = (uint16_t)av_rescale(scale.num, 1024, scale.den);
|
||||||
c.packedYOffset= (black - c.ppMode.minAllowedY) & 0xFFFF;
|
c.packedYOffset= (black - c.ppMode.minAllowedY) & 0xFFFF;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3413,7 +3413,7 @@ static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[
|
|||||||
c.packedYScale|= c.packedYScale<<32;
|
c.packedYScale|= c.packedYScale<<32;
|
||||||
c.packedYScale|= c.packedYScale<<16;
|
c.packedYScale|= c.packedYScale<<16;
|
||||||
|
|
||||||
if(mode & LEVEL_FIX) QPCorrecture= (int)(scale*256*256 + 0.5);
|
if(mode & LEVEL_FIX) QPCorrecture= (int)av_rescale(scale.num, 256*256, scale.den);
|
||||||
else QPCorrecture= 256*256;
|
else QPCorrecture= 256*256;
|
||||||
}else{
|
}else{
|
||||||
c.packedYScale= 0x0100010001000100LL;
|
c.packedYScale= 0x0100010001000100LL;
|
||||||
|
Loading…
Reference in New Issue
Block a user