Tighten up recode tolerance for very low rate frames.
This small change reduces the recode tolerance by a small amount.
The main impact is for very low rate frames where previously the
rate error threshold was (target rate * X%) + 200 it is now
max ((target rate x X%), 100).
This will not have much impact at all at higher rates and will mainly
affect leaf frames where the target rate may only be a few hundred
bits.
STATS_CHANGED
Change-Id: I2ec9f031904d9430fae3dc78dedeaae26cc67e18
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index f0a107d..7a895ca 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -1486,10 +1486,11 @@
} else {
// For very small rate targets where the fractional adjustment
// may be tiny make sure there is at least a minimum range.
- const int tolerance = (cpi->sf.hl_sf.recode_tolerance * frame_target) / 100;
- *frame_under_shoot_limit = AOMMAX(frame_target - tolerance - 200, 0);
+ const int tolerance =
+ AOMMAX(100, (cpi->sf.hl_sf.recode_tolerance * frame_target) / 100);
+ *frame_under_shoot_limit = AOMMAX(frame_target - tolerance, 0);
*frame_over_shoot_limit =
- AOMMIN(frame_target + tolerance + 200, cpi->rc.max_frame_bandwidth);
+ AOMMIN(frame_target + tolerance, cpi->rc.max_frame_bandwidth);
}
}