diff options
author | Paul Wilkins <paulwilkins@google.com> | 2010-05-20 16:49:39 +0100 |
---|---|---|
committer | Paul Wilkins <paulwilkins@google.com> | 2010-05-20 16:49:39 +0100 |
commit | c012d63ec968ab4f20c0cb43f47f80d87bfaf475 (patch) | |
tree | 2d282ef96228e074325b580bd8c585adb239a2ec | |
parent | 0fc9abfbfd28f5cc423e286691aa8824cf3966c2 (diff) | |
download | libvpx-c012d63ec968ab4f20c0cb43f47f80d87bfaf475.tar libvpx-c012d63ec968ab4f20c0cb43f47f80d87bfaf475.tar.gz libvpx-c012d63ec968ab4f20c0cb43f47f80d87bfaf475.tar.bz2 libvpx-c012d63ec968ab4f20c0cb43f47f80d87bfaf475.zip |
Fixed incorrect casts that broke rate control in some situations.
-rw-r--r-- | vp8/encoder/ratectrl.c | 7 | ||||
-rw-r--r-- | vp8/encoder/rdopt.c | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c index ad54c5ee0..7ab9605e3 100644 --- a/vp8/encoder/ratectrl.c +++ b/vp8/encoder/ratectrl.c @@ -1170,7 +1170,8 @@ void vp8_update_rate_correction_factors(VP8_COMP *cpi, int damp_var) while (Z > 0) { Z --; - projected_size_based_on_q *= (int)Factor; + projected_size_based_on_q = + (int)(Factor * projected_size_based_on_q); Factor += factor_adjustment; if (Factor >= 0.999) @@ -1361,7 +1362,9 @@ int vp8_regulate_q(VP8_COMP *cpi, int target_bits_per_frame) if (cpi->zbin_over_quant > zbin_oqmax) cpi->zbin_over_quant = zbin_oqmax; - bits_per_mb_at_this_q *= (int)Factor; // Each over-ruin step is assumed to equate to approximately 3% reduction in bitrate + // Each over-run step is assumed to equate to approximately + // 3% reduction in bitrate + bits_per_mb_at_this_q = (int)(Factor * bits_per_mb_at_this_q); Factor += factor_adjustment; if (Factor >= 0.999) diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index 084699628..601c52978 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -265,7 +265,7 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, int Qvalue) if (oq_factor > (1.0 + ((double)cpi->zbin_over_quant / 64.0))) oq_factor = (1.0 + (double)cpi->zbin_over_quant / 64.0); - cpi->RDMULT *= (int)oq_factor; + cpi->RDMULT = (int)(oq_factor * cpi->RDMULT); } } |