[NORMATIVE] Clear film grain params if !showable
Reset the film grain parameters to all zeros if film grain is
enabled but show_frame and showable_frame are both 0
("unshowable" frames).
This avoids an accidental dependence on the decoding order -
unshowable frames would accidentally keep the film grain parameters
from the previous decoded frame. Note that, even though these
frames don't apply film grain themselves, they can potentially be
used as a source of film grain parameters by future frames.
Thus we still need to reset the parameters to default values.
BUG=aomedia:1730
Change-Id: I445d35e31eb9d264de394a7cc2af151127a5884b
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 0ba4410..d8b54e2 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -2168,7 +2168,7 @@
}
static void read_film_grain(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
- if (cm->film_grain_params_present) {
+ if (cm->film_grain_params_present && (cm->show_frame || cm->showable_frame)) {
av1_read_film_grain_params(cm, rb);
} else {
memset(&cm->film_grain_params, 0, sizeof(cm->film_grain_params));
@@ -3177,9 +3177,7 @@
if (!frame_is_intra_only(cm)) read_global_motion(cm, rb);
cm->cur_frame->film_grain_params_present = cm->film_grain_params_present;
- if (cm->show_frame || cm->showable_frame) {
- read_film_grain(cm, rb);
- }
+ read_film_grain(cm, rb);
set_single_tile_decoding_mode(&pbi->common);
return 0;