[NORMATIVE] Check primary_ref_frame in more places
There are a few cases where we should treat frames with
primary_ref_frame == PRIMARY_REF_NONE the same way as intra-only
and/or error-resilient frames, even if the frame of interest
is neither intra-only nor error resilient.
Note, however, that they shouldn't be treated the same in all cases.
This patch changes the following cases:
* Always signal segmentation map + features when using PRIMARY_REF_NONE
* Call setup_past_independence() when using PRIMARY_REF_NONE, so that
we don't accidentally depend on old data. This should be equivalent
to the old behaviour, but makes it less likely to miss anything
in future.
* Simplify some code using the fact that, once cm->prev_frame has
been set up, the following are all equivalent:
"cm->prev_frame == NULL";
"cm->primary_ref_frame == PRIMARY_REF_NONE";
"cm->error_resilient_mode || cm->intra_only ||
[primary_ref_frame explicitly signalled as PRIMARY_REF_NONE]"
Change-Id: If8e417a11040ba8a4ad58fc6e37d985a94533d68
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 89a9150..ff1dcb0 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -2121,7 +2121,7 @@
if (!seg->enabled) return;
// Write update flags
- if (frame_is_intra_only(cm) || cm->error_resilient_mode) {
+ if (cm->primary_ref_frame == PRIMARY_REF_NONE) {
assert(seg->update_map == 1);
seg->temporal_update = 0;
assert(seg->update_data == 1);
@@ -2882,9 +2882,8 @@
int frame;
for (frame = LAST_FRAME; frame <= ALTREF_FRAME; ++frame) {
const WarpedMotionParams *ref_params =
- (cm->error_resilient_mode || cm->prev_frame == NULL)
- ? &default_warp_params
- : &cm->prev_frame->global_motion[frame];
+ cm->prev_frame ? &cm->prev_frame->global_motion[frame]
+ : &default_warp_params;
write_global_motion_params(&cm->global_motion[frame], ref_params, wb,
cm->allow_high_precision_mv);
// TODO(sarahparker, debargha): The logic in the commented out code below