diff options
author | Bohan Li <bohanli@google.com> | 2023-11-30 15:49:38 -0800 |
---|---|---|
committer | Jerome Jiang <jianj@google.com> | 2023-12-06 14:01:33 -0500 |
commit | 6f1001a894cfdd1977dc7069d3a599b26ef04260 (patch) | |
tree | a801292dfe7cf2d69f0f99451d3de8a2b9a53216 | |
parent | a05cfd672d4b4d89e7ed0f0d645fa014c99793c3 (diff) | |
download | libvpx-6f1001a894cfdd1977dc7069d3a599b26ef04260.tar.gz |
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)
-rw-r--r-- | test/encode_api_test.cc | 59 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodeframe.c | 3 |
2 files changed, 60 insertions, 2 deletions
diff --git a/test/encode_api_test.cc b/test/encode_api_test.cc index 7ca2b5941..6205a56ce 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<const libvpx_test::CodecFactory *> { diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index b98fd8457..ddf47c128 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; |