Commit b499120e authored by Zoe Liu's avatar Zoe Liu

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
parent 818b0064
......@@ -3579,6 +3579,15 @@ static void write_uncompressed_header_frame(AV1_COMP *cpi,
}
#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 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
}
#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
......
......@@ -6024,13 +6024,15 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
set_arf_sign_bias(cpi);
#endif // !CONFIG_FRAME_SIGN_BIAS
#if CONFIG_TEMPMV_SIGNALING
#if CONFIG_TEMPMV_SIGNALING || CONFIG_FWD_KF
// frame type has been decided outside of this function call
cm->cur_frame->intra_only = cm->frame_type == KEY_FRAME || cm->intra_only;
#endif // CONFIG_TEMPMV_SIGNALING || CONFIG_FWD_KF
#if CONFIG_TEMPMV_SIGNALING
cm->use_ref_frame_mvs =
!cpi->oxcf.disable_tempmv && !cm->cur_frame->intra_only;
cm->use_prev_frame_mvs = cm->use_ref_frame_mvs;
#endif
#endif // CONFIG_TEMPMV_SIGNALING
// Reset the frame packet stamp index.
if (cm->frame_type == KEY_FRAME) cm->current_video_frame = 0;
......@@ -7011,6 +7013,12 @@ int av1_get_compressed_data(AV1_COMP *cpi, unsigned int *frame_flags,
cpi->refresh_alt2_ref_frame = 0;
cpi->refresh_alt_ref_frame = 0;
#if CONFIG_FWD_KF
// TODO(zoeliu@gmail.com): To support forward-KEY_FRAME and set up the
// following flag accordingly.
cm->reset_decoder_state = 0;
#endif // CONFIG_FWD_KF
#if !CONFIG_XIPHRC
if (oxcf->pass == 2 && cm->show_existing_frame) {
// Manage the source buffer and flush out the source frame that has been
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment