From: Bohan Li Date: Thu, 30 Nov 2023 23:49:38 +0000 (-0800) Subject: Fix scaled reference offsets. X-Git-Tag: accepted/tizen/7.0/unified/20240521.012539~1^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f1001a894cfdd1977dc7069d3a599b26ef04260;p=platform%2Fupstream%2Flibvpx.git Fix scaled reference offsets. Since the reference frame is already scaled, do not scale the offsets. BUG: b/311489136, b/312656387 Change-Id: Ib346242e7ec8c4d3ed26668fa4094271218278ed (cherry picked from commit 845a817c056c05e8fe7ae9298be47b949d8aceee) --- diff --git a/test/encode_api_test.cc b/test/encode_api_test.cc index 7ca2b59..6205a56 100644 --- a/test/encode_api_test.cc +++ b/test/encode_api_test.cc @@ -685,6 +685,65 @@ TEST(EncodeAPI, Buganizer312517065) { encoder.Encode(false); } +// This is a test case from clusterfuzz: based on b/311489136. +// Encode a few frames with multiple change config call +// with different frame size. +TEST(EncodeAPI, Buganizer311489136) { + VP9Encoder encoder(1); + + // Set initial config. + encoder.Configure(12, 1678, 620, VPX_VBR, VPX_DL_GOOD_QUALITY); + + // Encode first frame. + encoder.Encode(true); + + // Change config. + encoder.Configure(3, 1678, 202, VPX_CBR, VPX_DL_GOOD_QUALITY); + + // Encode 2nd frame with new config, set delta frame. + encoder.Encode(false); + + // Change config again. + encoder.Configure(8, 1037, 476, VPX_CBR, VPX_DL_REALTIME); + + // Encode 3rd frame with new config, set delta frame. + encoder.Encode(false); + + // Change config again. + encoder.Configure(0, 580, 620, VPX_CBR, VPX_DL_GOOD_QUALITY); + + // Encode 4th frame with same config, set delta frame. + encoder.Encode(false); +} + +// This is a test case from clusterfuzz: based on b/312656387. +// Encode a few frames with multiple change config call +// with different frame size. +TEST(EncodeAPI, Buganizer312656387) { + VP9Encoder encoder(1); + + // Set initial config. + encoder.Configure(16, 1, 1024, VPX_CBR, VPX_DL_REALTIME); + + // Change config. + encoder.Configure(15, 1, 1024, VPX_VBR, VPX_DL_REALTIME); + + // Encode first frame. + encoder.Encode(true); + + // Change config again. + encoder.Configure(14, 1, 595, VPX_VBR, VPX_DL_GOOD_QUALITY); + + // Encode 2nd frame with new config. + encoder.Encode(true); + + // Change config again. + encoder.Configure(2, 1, 1024, VPX_VBR, VPX_DL_GOOD_QUALITY); + + // Encode 3rd frame with new config, set delta frame. + encoder.Encode(false); +} + class EncodeApiGetTplStatsTest : public ::libvpx_test::EncoderTest, public ::testing::TestWithParam { diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index b98fd84..ddf47c1 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -3451,8 +3451,7 @@ static void simple_motion_search(const VP9_COMP *const cpi, MACROBLOCK *const x, assert(yv12 != NULL); if (!yv12) return; - vp9_setup_pre_planes(xd, 0, yv12, mi_row, mi_col, - &cm->frame_refs[ref - 1].sf); + vp9_setup_pre_planes(xd, 0, yv12, mi_row, mi_col, NULL); mi->ref_frame[0] = ref; mi->ref_frame[1] = NO_REF_FRAME; mi->sb_type = bsize;