[NORMATIVE] Move frame_offset setup upwards
This CL is to set up the frame_offset (which is OrderHint in the spec)
earlier, inside the read_uncompressed_header(), as is needed by the
later handling of frame_refs_short_signaling.
BUG=aomedia:1484
Change-Id: Ie5d85c1caa36354ec3f98129eb247eb700389081
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c
index fe92a02..f37879d 100644
--- a/av1/common/mvref_common.c
+++ b/av1/common/mvref_common.c
@@ -1944,7 +1944,7 @@
int lst_frame_offset = -1;
int gld_frame_offset = -1;
- const int cur_frame_offset = (int)cm->cur_frame->cur_frame_offset;
+ const int cur_frame_offset = (int)cm->frame_offset;
REF_FRAME_INFO ref_frame_info[REF_FRAMES];
int ref_flag_list[INTER_REFS_PER_FRAME] = { 0, 0, 0, 0, 0, 0, 0 };
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 98bfa97..843a323 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -2781,6 +2781,14 @@
#if CONFIG_NO_FRAME_CONTEXT_SIGNALING
cm->primary_ref_frame = PRIMARY_REF_NONE;
#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING
+
+ if (cm->show_frame == 0) {
+ cm->frame_offset =
+ cm->current_video_frame + aom_rb_read_literal(rb, FRAME_OFFSET_BITS);
+ } else {
+ cm->frame_offset = cm->current_video_frame;
+ }
+
if (cm->frame_type == KEY_FRAME) {
wrap_around_current_video_frame(pbi);
pbi->refresh_frame_flags = (1 << REF_FRAMES) - 1;
@@ -2968,12 +2976,6 @@
}
}
- if (cm->show_frame == 0) {
- cm->frame_offset =
- cm->current_video_frame + aom_rb_read_literal(rb, FRAME_OFFSET_BITS);
- } else {
- cm->frame_offset = cm->current_video_frame;
- }
av1_setup_frame_buf_refs(cm);
if (cm->frame_type != S_FRAME) av1_setup_frame_sign_bias(cm);
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 11512a4..0f4334a 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -3083,6 +3083,17 @@
cm->frame_refs_short_signaling = 0;
#endif // CONFIG_FRAME_REFS_SIGNALING
+ if (cm->show_frame == 0) {
+ int arf_offset = AOMMIN(
+ (MAX_GF_INTERVAL - 1),
+ cpi->twopass.gf_group.arf_src_offset[cpi->twopass.gf_group.index]);
+ int brf_offset =
+ cpi->twopass.gf_group.brf_src_offset[cpi->twopass.gf_group.index];
+
+ arf_offset = AOMMIN((MAX_GF_INTERVAL - 1), arf_offset + brf_offset);
+ aom_wb_write_literal(wb, arf_offset, FRAME_OFFSET_BITS);
+ }
+
if (cm->frame_type == KEY_FRAME) {
write_frame_size(cm, frame_size_override_flag, wb);
assert(av1_superres_unscaled(cm) ||
@@ -3234,17 +3245,6 @@
}
}
- if (cm->show_frame == 0) {
- int arf_offset = AOMMIN(
- (MAX_GF_INTERVAL - 1),
- cpi->twopass.gf_group.arf_src_offset[cpi->twopass.gf_group.index]);
- int brf_offset =
- cpi->twopass.gf_group.brf_src_offset[cpi->twopass.gf_group.index];
-
- arf_offset = AOMMIN((MAX_GF_INTERVAL - 1), arf_offset + brf_offset);
- aom_wb_write_literal(wb, arf_offset, FRAME_OFFSET_BITS);
- }
-
if (cm->seq_params.frame_id_numbers_present_flag) {
cm->refresh_mask =
cm->frame_type == KEY_FRAME ? 0xFF : get_refresh_mask(cpi);