Computing DS-filter only once per seqence
Currently DS-filter is computed for every I-frame which is not correct,
and it causes encode/decode mismatch for few-kf. This MR forces
DS-filter computation for every IDR frame when we are flusing all
frames.
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index d96aa1f..657564f 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -3848,9 +3848,15 @@
cpi->is_screen_content_type = features->allow_screen_content_tools;
}
#endif // CONFIG_IBC_SR_EXT
- if (cpi->common.current_frame.frame_type == KEY_FRAME) {
+ const bool compute_ds_filter =
+ ((cpi->common.current_frame.frame_type == KEY_FRAME &&
+ cpi->common.show_frame) ||
+ cpi->common.current_frame.frame_type == S_FRAME) &&
+ !cpi->common.show_existing_frame;
+ if (compute_ds_filter) {
av1_set_downsample_filter_options(cpi);
}
+
// frame type has been decided outside of this function call
cm->cur_frame->frame_type = current_frame->frame_type;
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index 4681cb1..869d84b 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -1077,9 +1077,16 @@
av1_set_screen_content_options(cpi, features);
cpi->is_screen_content_type = features->allow_screen_content_tools;
}
- if (cpi->common.current_frame.frame_type == KEY_FRAME) {
+
+ const bool compute_ds_filter =
+ ((cpi->common.current_frame.frame_type == KEY_FRAME &&
+ cpi->common.show_frame) ||
+ cpi->common.current_frame.frame_type == S_FRAME) &&
+ !cpi->common.show_existing_frame;
+ if (compute_ds_filter) {
av1_set_downsample_filter_options(cpi);
}
+
// First pass coding proceeds in raster scan order with unit size of 16x16.
const BLOCK_SIZE fp_block_size = BLOCK_16X16;