From 36c30e42e64c37712540d2bb161372a17e2ad686 Mon Sep 17 00:00:00 2001 From: Youenn Fablet Date: Fri, 7 Apr 2023 14:01:05 -0700 Subject: [PATCH] Cherry-pick aom 3154860bdbe978da9271ba55eea60973b0be06b5 https://bugs.webkit.org/show_bug.cgi?id=253015 rdar://105507028 Reviewed by Geoffrey Garen. Cherry-pick patch from upstream. * Source/ThirdParty/libwebrtc/Source/third_party/libaom/source/libaom/av1/encoder/encodeframe_utils.c: (av1_source_content_sb): Cherry-pick: 259548.317@safari-7615-branch (92bb5fbd72e5). rdar://107755462 Canonical link: https://commits.webkit.org/262739@main --- .../source/libaom/av1/encoder/encodeframe_utils.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/ThirdParty/libwebrtc/Source/third_party/libaom/source/libaom/av1/encoder/encodeframe_utils.c b/Source/ThirdParty/libwebrtc/Source/third_party/libaom/source/libaom/av1/encoder/encodeframe_utils.c index fdfddcb585b1..d258a96308ec 100644 --- a/Source/ThirdParty/libwebrtc/Source/third_party/libaom/source/libaom/av1/encoder/encodeframe_utils.c +++ b/Source/ThirdParty/libwebrtc/Source/third_party/libaom/source/libaom/av1/encoder/encodeframe_utils.c @@ -1317,10 +1317,11 @@ void av1_source_content_sb(AV1_COMP *cpi, MACROBLOCK *x, int mi_row, unsigned int tmp_variance; const BLOCK_SIZE bsize = cpi->common.seq_params->sb_size; uint8_t *src_y = cpi->source->y_buffer; - int src_ystride = cpi->source->y_stride; + const int src_ystride = cpi->source->y_stride; + const int src_offset = src_ystride * (mi_row << 2) + (mi_col << 2); uint8_t *last_src_y = cpi->last_source->y_buffer; - int last_src_ystride = cpi->last_source->y_stride; - const int offset = cpi->source->y_stride * (mi_row << 2) + (mi_col << 2); + const int last_src_ystride = cpi->last_source->y_stride; + const int last_src_offset = last_src_ystride * (mi_row << 2) + (mi_col << 2); uint64_t avg_source_sse_threshold[2] = { 100000, // ~5*5*(64*64) 36000 }; // ~3*3*(64*64) uint64_t avg_source_sse_threshold_high = 1000000; // ~15*15*(64*64) @@ -1329,8 +1330,8 @@ void av1_source_content_sb(AV1_COMP *cpi, MACROBLOCK *x, int mi_row, MACROBLOCKD *xd = &x->e_mbd; if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) return; #endif - src_y += offset; - last_src_y += offset; + src_y += src_offset; + last_src_y += last_src_offset; tmp_variance = cpi->ppi->fn_ptr[bsize].vf(src_y, src_ystride, last_src_y, last_src_ystride, &tmp_sse); // rd thresholds