ref: f64e14047dfcf6acd563ad7c2702132174620b49
parent: 372336d1e5db555808de74159aae03d6a8a20a19
parent: b814e2d898a6d10019cf1419569ca221214641f5
author: Paul Wilkins <[email protected]>
date: Wed Aug 16 14:25:57 EDT 2017
Merge "Prevent parameters that can cause invalid ARF groups."
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -867,9 +867,10 @@
}
#endif
+#define MIN_LOOKAHEAD_FOR_ARFS 4
static INLINE int is_altref_enabled(const VP9_COMP *const cpi) {
return !(cpi->oxcf.mode == REALTIME && cpi->oxcf.rc_mode == VPX_CBR) &&
- cpi->oxcf.lag_in_frames > 0 &&
+ cpi->oxcf.lag_in_frames >= MIN_LOOKAHEAD_FOR_ARFS &&
(cpi->oxcf.enable_auto_arf &&
(!is_two_pass_svc(cpi) ||
cpi->oxcf.ss_enable_auto_arf[cpi->svc.spatial_layer_id]));
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -191,6 +191,13 @@
(MAX_LAG_BUFFERS - 1));
}
+ // For formation of valid ARF groups lag_in _frames should be 0 or greater
+ // than the max_gf_interval + 2
+ if (cfg->g_lag_in_frames > 0 && extra_cfg->max_gf_interval > 0 &&
+ cfg->g_lag_in_frames < extra_cfg->max_gf_interval + 2) {
+ ERROR("Set lag in frames to 0 (low delay) or >= (max-gf-interval + 2)");
+ }
+
if (cfg->rc_resize_allowed == 1) {
RANGE_CHECK(cfg, rc_scaled_width, 0, cfg->g_w);
RANGE_CHECK(cfg, rc_scaled_height, 0, cfg->g_h);