Add encoder support to fwd-kf

Encoder now writes the binary symbol for show_existing_frame to
indicate the value of reset_decoder_state. The default value now
is set as zero regardless. This enables the bitstream match with
the decoder.

With this patch when fwd-kf is enabled, one additional bit is
signaled at the frame header for show_existing_frame, but without
any coding performance impact.

Change-Id: Ib0137e6a513011c0ac9506837d32e9ad405508af
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index ede1c9c..95aaf00 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -3579,6 +3579,15 @@
     }
 #endif  // CONFIG_REFERENCE_BUFFER
 
+#if CONFIG_FWD_KF
+    if (cm->reset_decoder_state && !frame_bufs[frame_to_show].intra_only) {
+      aom_internal_error(
+          &cm->error, AOM_CODEC_UNSUP_BITSTREAM,
+          "show_existing_frame to reset state on non-intra_only");
+    }
+    aom_wb_write_bit(wb, cm->reset_decoder_state);
+#endif  // CONFIG_FWD_KF
+
     return;
   } else {
     aom_wb_write_bit(wb, 0);  // show_existing_frame
@@ -3902,6 +3911,15 @@
     }
 #endif  // CONFIG_REFERENCE_BUFFER
 
+#if CONFIG_FWD_KF
+    if (cm->reset_decoder_state && !frame_bufs[frame_to_show].intra_only) {
+      aom_internal_error(
+          &cm->error, AOM_CODEC_UNSUP_BITSTREAM,
+          "show_existing_frame to reset state on non-intra_only");
+    }
+    aom_wb_write_bit(wb, cm->reset_decoder_state);
+#endif  // CONFIG_FWD_KF
+
     return;
   } else {
     aom_wb_write_bit(wb, 0);  // show_existing_frame