From: Marco Paniconi Date: Sat, 14 Jan 2023 03:46:10 +0000 (-0800) Subject: Fix to segfault for external resize test in vp9 X-Git-Tag: v1.13.0-rc1~11^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=71d01660cc40306c2c7c80c8ed510e520a0c4b93;p=libvpx Fix to segfault for external resize test in vp9 Failure occurs for 1 pass non-realtime mode at speed 0. Due to speed feautre rd_ml_partition.var_pruning, which doesn't check for scaled reference in simple_motion_search(). Bug: webm:1768 Change-Id: Iddcb56033bac042faebb5196eed788317590b23f --- diff --git a/test/resize_test.cc b/test/resize_test.cc index e122a7474..715bb9d70 100644 --- a/test/resize_test.cc +++ b/test/resize_test.cc @@ -777,10 +777,7 @@ TEST_P(ResizeCspTest, TestResizeCspWorks) { } VP8_INSTANTIATE_TEST_SUITE(ResizeTest, ONE_PASS_TEST_MODES); -// TODO(https://crbug.com/webm/1768): VP9 should use ONE_PASS_TEST_MODES for -// the ResizeTest instantiation after segfault is fixed. -VP9_INSTANTIATE_TEST_SUITE(ResizeTest, - ::testing::Values(::libvpx_test::kRealTime)); +VP9_INSTANTIATE_TEST_SUITE(ResizeTest, ONE_PASS_TEST_MODES); VP9_INSTANTIATE_TEST_SUITE(ResizeInternalTest, ::testing::Values(::libvpx_test::kOnePassBest)); VP9_INSTANTIATE_TEST_SUITE(ResizeRealtimeTest, diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index a1ee9c678..1483ac069 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -3413,7 +3413,8 @@ static void simple_motion_search(const VP9_COMP *const cpi, MACROBLOCK *const x, const VP9_COMMON *const cm = &cpi->common; MACROBLOCKD *const xd = &x->e_mbd; MODE_INFO *const mi = xd->mi[0]; - const YV12_BUFFER_CONFIG *const yv12 = get_ref_frame_buffer(cpi, ref); + YV12_BUFFER_CONFIG *yv12; + YV12_BUFFER_CONFIG *scaled_ref_frame = vp9_get_scaled_ref_frame(cpi, ref); const int step_param = 1; const MvLimits tmp_mv_limits = x->mv_limits; const SEARCH_METHODS search_method = NSTEP; @@ -3422,6 +3423,11 @@ static void simple_motion_search(const VP9_COMP *const cpi, MACROBLOCK *const x, MV best_mv = { 0, 0 }; int cost_list[5]; + if (scaled_ref_frame) + yv12 = scaled_ref_frame; + else + yv12 = get_ref_frame_buffer(cpi, ref); + assert(yv12 != NULL); if (!yv12) return; vp9_setup_pre_planes(xd, 0, yv12, mi_row, mi_col,