Fix mismatch with striped loop restoration+superres
When upscaling a frame, we extend frame borders to stop the upscale to
save boundary lines convolving with uninitialised data off the edges,
which was causing encode/decode mismatches. With this patch, we only
do the extension when there's going to be an upscale (otherwise
there's no need), which should give a small coding gain when not
upscaling.
More importantly, it forces us to extend in the decode path whether or
not we are using loop restoration, which matches what the encoder does
and fixes a mismatch.
Change-Id: Ie5a0791b0cbedbf254f9080f3cbf668318673f2f
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 022b9b4..f96350c 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -3698,12 +3698,12 @@
}
#if CONFIG_STRIPED_LOOP_RESTORATION
+#if CONFIG_FRAME_SUPERRES && CONFIG_HORZONLY_FRAME_SUPERRES
+ if (!av1_superres_unscaled(cm)) aom_extend_frame_borders(&pbi->cur_buf->buf);
+#endif
if (cm->rst_info[0].frame_restoration_type != RESTORE_NONE ||
cm->rst_info[1].frame_restoration_type != RESTORE_NONE ||
cm->rst_info[2].frame_restoration_type != RESTORE_NONE) {
-#if CONFIG_FRAME_SUPERRES && CONFIG_HORZONLY_FRAME_SUPERRES
- aom_extend_frame_borders(&pbi->cur_buf->buf);
-#endif
av1_loop_restoration_save_boundary_lines(&pbi->cur_buf->buf, cm);
}
#endif
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 1ba3096..cdcbccc 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -4685,7 +4685,7 @@
#if CONFIG_STRIPED_LOOP_RESTORATION
#if CONFIG_FRAME_SUPERRES && CONFIG_HORZONLY_FRAME_SUPERRES
- aom_extend_frame_borders(cm->frame_to_show);
+ if (!av1_superres_unscaled(cm)) aom_extend_frame_borders(cm->frame_to_show);
#endif
av1_loop_restoration_save_boundary_lines(cm->frame_to_show, cm);
#endif