aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Jiang <jianj@google.com>2023-12-06 10:35:18 -0500
committerWan-Teh Chang <wtc@google.com>2023-12-08 19:29:46 +0000
commit36b2dec5eebaffde48e9eee3bd39cee4f6bb6c4b (patch)
treefc2bedfa9792f97efcba43f36564f8240852852f
parenteba5ceb9d1ca12117aa50116a452786d92e32969 (diff)
downloadlibvpx-36b2dec5eebaffde48e9eee3bd39cee4f6bb6c4b.tar.gz
Set pred buffer stride correctly
Bug: b/312875957 Change-Id: I2eb5ab86d5fe30079b3ed1cbdb8b45bb2dc72a1d (cherry picked from commit 585798f756d60bef3761d76700f3a14e8d5d46d9)
-rw-r--r--test/encode_api_test.cc13
-rw-r--r--vp9/common/vp9_reconinter.c13
2 files changed, 20 insertions, 6 deletions
diff --git a/test/encode_api_test.cc b/test/encode_api_test.cc
index 0c8f56dbc..6b1012f3f 100644
--- a/test/encode_api_test.cc
+++ b/test/encode_api_test.cc
@@ -850,6 +850,19 @@ TEST(EncodeAPI, Buganizer314857577) {
encoder.Encode(false);
}
+TEST(EncodeAPI, Buganizer312875957PredBufferStride) {
+ VP9Encoder encoder(-1);
+
+ encoder.Configure(12, 1678, 620, VPX_VBR, VPX_DL_REALTIME);
+ encoder.Encode(true);
+ encoder.Encode(false);
+ encoder.Configure(0, 456, 486, VPX_VBR, VPX_DL_REALTIME);
+ encoder.Encode(true);
+ encoder.Configure(0, 1678, 620, VPX_CBR, 1000000);
+ encoder.Encode(false);
+ encoder.Encode(false);
+}
+
class EncodeApiGetTplStatsTest
: public ::libvpx_test::EncoderTest,
public ::testing::TestWithParam<const libvpx_test::CodecFactory *> {
diff --git a/vp9/common/vp9_reconinter.c b/vp9/common/vp9_reconinter.c
index ff59ff504..4878dc15e 100644
--- a/vp9/common/vp9_reconinter.c
+++ b/vp9/common/vp9_reconinter.c
@@ -158,18 +158,19 @@ static void build_inter_predictors(MACROBLOCKD *xd, int plane, int block,
// Co-ordinate of containing block to pixel precision.
const int x_start = (-xd->mb_to_left_edge >> (3 + pd->subsampling_x));
const int y_start = (-xd->mb_to_top_edge >> (3 + pd->subsampling_y));
+ const YV12_BUFFER_CONFIG *ref_buf = xd->block_refs[ref]->buf;
+ uint8_t *buf_array[] = { ref_buf->y_buffer, ref_buf->u_buffer,
+ ref_buf->v_buffer };
+ const int stride_array[] = { ref_buf->y_stride, ref_buf->uv_stride,
+ ref_buf->uv_stride };
#if 0 // CONFIG_BETTER_HW_COMPATIBILITY
assert(xd->mi[0]->sb_type != BLOCK_4X8 &&
xd->mi[0]->sb_type != BLOCK_8X4);
assert(mv_q4.row == mv.row * (1 << (1 - pd->subsampling_y)) &&
mv_q4.col == mv.col * (1 << (1 - pd->subsampling_x)));
#endif
- if (plane == 0)
- pre_buf->buf = xd->block_refs[ref]->buf->y_buffer;
- else if (plane == 1)
- pre_buf->buf = xd->block_refs[ref]->buf->u_buffer;
- else
- pre_buf->buf = xd->block_refs[ref]->buf->v_buffer;
+ pre_buf->buf = buf_array[plane];
+ pre_buf->stride = stride_array[plane];
pre_buf->buf +=
scaled_buffer_offset(x_start + x, y_start + y, pre_buf->stride, sf);