Set seq_params.film_grain_params_present when noise modeling
Allow frame grain_params_present to vary per-frame based on results of
the modeling.
This fixes an issue where no grain is found on first frame, causing
sequence parameters to have film_grain_params_present=0 despite the
second frame having film_grain_params_present=1.
Change-Id: I00f937a30f0f8e6c1665048be89e539de6e86fbb
diff --git a/av1/encoder/encode_strategy.c b/av1/encoder/encode_strategy.c
index dc07880..8108109 100644
--- a/av1/encoder/encode_strategy.c
+++ b/av1/encoder/encode_strategy.c
@@ -1163,13 +1163,13 @@
cpi->twopass.gf_group.rf_level[cpi->twopass.gf_group.index];
if (cpi->film_grain_table) {
- cm->seq_params.film_grain_params_present = aom_film_grain_table_lookup(
+ cm->cur_frame->film_grain_params_present = aom_film_grain_table_lookup(
cpi->film_grain_table, *time_stamp, *time_end, 0 /* =erase */,
&cm->film_grain_params);
+ } else {
+ cm->cur_frame->film_grain_params_present =
+ cm->seq_params.film_grain_params_present;
}
- cm->cur_frame->film_grain_params_present =
- cm->seq_params.film_grain_params_present;
-
// only one operating point supported now
const int64_t pts64 = ticks_to_timebase_units(timebase, *time_stamp);
if (pts64 < 0 || pts64 > UINT32_MAX) return AOM_CODEC_ERROR;