SUPERRES_AUTO: enable dual search for q mode
Dual search is useful for certain clips, e.g. clips where global motion
is used, because superres mode disables global motion.
Baseline vs SUPERRES_AUTO BDRate, Q mode:
- Before = +0.977 (worst clip: +5.745)
- After = +0.106 (worst clip: +0.705)
BUG=aomedia:2844
Change-Id: I37b1de81a16914801aa0bf8d0b91ebc782dd3000
(cherry picked from commit b53d238da83cd595d472be8bc1cff20ffe32e91f)
diff --git a/aom_scale/generic/yv12extend.c b/aom_scale/generic/yv12extend.c
index 834a59d..e5fe38a 100644
--- a/aom_scale/generic/yv12extend.c
+++ b/aom_scale/generic/yv12extend.c
@@ -22,6 +22,7 @@
static void extend_plane(uint8_t *const src, int src_stride, int width,
int height, int extend_top, int extend_left,
int extend_bottom, int extend_right) {
+ assert(src != NULL);
int i;
const int linesize = extend_left + extend_right + width;
diff --git a/av1/encoder/encoder_utils.c b/av1/encoder/encoder_utils.c
index d4b264d..eab3442 100644
--- a/av1/encoder/encoder_utils.c
+++ b/av1/encoder/encoder_utils.c
@@ -1133,6 +1133,7 @@
AV1_COMMON *cm = &cpi->common;
const YV12_BUFFER_CONFIG *ybf = &cm->cur_frame->buf;
memset(&cc->copy_buffer, 0, sizeof(cc->copy_buffer));
+ if (ybf->y_crop_width == 0 && ybf->y_crop_height == 0) return;
if (aom_alloc_frame_buffer(&cc->copy_buffer, ybf->y_crop_width,
ybf->y_crop_height, ybf->subsampling_x,
ybf->subsampling_y,
diff --git a/av1/encoder/encoder_utils.h b/av1/encoder/encoder_utils.h
index e59c671..b25afbb 100644
--- a/av1/encoder/encoder_utils.h
+++ b/av1/encoder/encoder_utils.h
@@ -831,6 +831,9 @@
static AOM_INLINE void restore_cur_buf(AV1_COMP *cpi) {
CODING_CONTEXT *const cc = &cpi->coding_context;
AV1_COMMON *cm = &cpi->common;
+ if (cc->copy_buffer.y_crop_width == 0 && cc->copy_buffer.y_crop_height == 0) {
+ return;
+ }
aom_yv12_copy_frame(&cc->copy_buffer, &cm->cur_frame->buf,
av1_num_planes(cm));
}
diff --git a/av1/encoder/superres_scale.c b/av1/encoder/superres_scale.c
index 5cadbee..66e871c 100644
--- a/av1/encoder/superres_scale.c
+++ b/av1/encoder/superres_scale.c
@@ -98,9 +98,8 @@
#if CONFIG_SUPERRES_IN_RECODE
int av1_superres_in_recode_allowed(const AV1_COMP *const cpi) {
const AV1EncoderConfig *const oxcf = &cpi->oxcf;
- // Empirically found to not be beneficial for AOM_Q mode and images coding.
+ // Empirically found to not be beneficial for image coding.
return oxcf->superres_cfg.superres_mode == AOM_SUPERRES_AUTO &&
- (oxcf->rc_cfg.mode == AOM_VBR || oxcf->rc_cfg.mode == AOM_CQ) &&
cpi->rc.frames_to_key > 1;
}
#endif // CONFIG_SUPERRES_IN_RECODE