diff options
author | Michael Niedermayer | 2015-05-31 00:50:45 +0200 |
---|---|---|
committer | Michael Niedermayer | 2015-05-31 00:59:34 +0200 |
commit | ebe919cce2f46eedeb54948a3e49fa33f68bfbb0 (patch) | |
tree | 7d6fa20a80f386a00537eb7f6fb8790c0c31c9a3 /libpostproc | |
parent | c41e0aedf5fc2a92502bc400010e64b8fea89d4e (diff) |
postproc/postprocess_template: Compute packedYScale and QPCorrecture without floats
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libpostproc')
-rw-r--r-- | libpostproc/postprocess_template.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libpostproc/postprocess_template.c b/libpostproc/postprocess_template.c index b7296c4da1..fc49e19337 100644 --- a/libpostproc/postprocess_template.c +++ b/libpostproc/postprocess_template.c @@ -3372,7 +3372,7 @@ static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[ int i; uint64_t maxClipped; uint64_t clipped; - double scale; + AVRational scale; c.frameNum++; // 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]; } - 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 - 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; #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; #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<<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{ c.packedYScale= 0x0100010001000100LL; |