ref: b858f5cc47844bef342bf71de98675027e6570aa
parent: f767a5a29c35a96f09bbcb5193fa809994db4904
parent: c012d63ec968ab4f20c0cb43f47f80d87bfaf475
author: Paul Wilkins <paulwilkins@google.com>
date: Thu May 20 20:09:07 EDT 2010
Merge "Fixed incorrect casts that broke rate control in some situations."
--- a/vp8/encoder/ratectrl.c
+++ b/vp8/encoder/ratectrl.c
@@ -1170,7 +1170,8 @@
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 @@
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)
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -265,7 +265,7 @@
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);
}
}