Add encoder support for frame_refs_signaling
Currently set cm->frame_refs_short_signaling as 0 by default. It will
write the one extra bit to the frame header, and leave all the encoder
setup the same as the baseline. It is in the TODO list for the encoder
side implementation for cm->frame_refs_short_signaling == 1.
BUG=aomedia:1392
Change-Id: Iabcc7618c9a52b7bb975b69e2d134f49a969944b
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 95e576d..9424f5c 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -3593,6 +3593,10 @@
aom_wb_write_bit(wb, frame_size_override_flag);
#endif
+#if CONFIG_FRAME_REFS_SIGNALING
+ cm->frame_refs_short_signaling = 0;
+#endif // CONFIG_FRAME_REFS_SIGNALING
+
if (cm->frame_type == KEY_FRAME) {
write_bitdepth_colorspace_sampling(cm, wb);
#if CONFIG_TIMING_INFO_IN_SEQ_HEADERS
@@ -3676,11 +3680,36 @@
cm->is_reference_frame = 0;
}
+#if CONFIG_FRAME_REFS_SIGNALING
+ // TODO(zoeliu@google.com): To complete the encoder-side implementation
+ // for the scenario cm->frame_refs_short_signaling == 1.
+ assert(cm->frame_refs_short_signaling == 0);
+ // NOTE: Error resilient mode turns off frame_refs_short_signaling
+ // automatically.
+ if (!cm->error_resilient_mode)
+ aom_wb_write_bit(wb, cm->frame_refs_short_signaling);
+ else
+ assert(cm->frame_refs_short_signaling == 0);
+
+ if (cm->frame_refs_short_signaling) {
+ assert(get_ref_frame_map_idx(cpi, LAST_FRAME) != INVALID_IDX);
+ aom_wb_write_literal(wb, get_ref_frame_map_idx(cpi, LAST_FRAME),
+ REF_FRAMES_LOG2);
+ assert(get_ref_frame_map_idx(cpi, GOLDEN_FRAME) != INVALID_IDX);
+ aom_wb_write_literal(wb, get_ref_frame_map_idx(cpi, GOLDEN_FRAME),
+ REF_FRAMES_LOG2);
+ }
+#endif // CONFIG_FRAME_REFS_SIGNALING
+
for (MV_REFERENCE_FRAME ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME;
++ref_frame) {
assert(get_ref_frame_map_idx(cpi, ref_frame) != INVALID_IDX);
- aom_wb_write_literal(wb, get_ref_frame_map_idx(cpi, ref_frame),
- REF_FRAMES_LOG2);
+#if CONFIG_FRAME_REFS_SIGNALING
+ if (!cm->frame_refs_short_signaling)
+#endif // CONFIG_FRAME_REFS_SIGNALING
+ aom_wb_write_literal(wb, get_ref_frame_map_idx(cpi, ref_frame),
+ REF_FRAMES_LOG2);
+
#if CONFIG_REFERENCE_BUFFER
if (cm->seq_params.frame_id_numbers_present_flag) {
int i = get_ref_frame_map_idx(cpi, ref_frame);