Allow flow estimation on mismatched frame strides Now that aom_compute_flow_at_point uses the strides corresponding to the src and ref buffers, we can remove the requirement that the src and ref buffers have the same stride in av1_compute_global_motion_feature_match(), av1_compute_global_motion_disflow(), and update_valid_ref_frames_for_gm(). Delete the DisflowTest.MismatchedStrides test because mismatched strides are no longer an error condition for av1_compute_global_motion_disflow() and av1_compute_global_motion_feature_match(). Change-Id: I8ec4fcd7c88d618b7b411e49622f8155d664ad95
diff --git a/aom_dsp/flow_estimation/corner_match.c b/aom_dsp/flow_estimation/corner_match.c index 72b65b3..3679736 100644 --- a/aom_dsp/flow_estimation/corner_match.c +++ b/aom_dsp/flow_estimation/corner_match.c
@@ -289,8 +289,7 @@ assert(ref_pyramid->layers[0].height == src_height); const int ref_stride = ref_pyramid->layers[0].stride; - if (ref_stride != src_stride || src_corners->num_corners == 0 || - ref_corners->num_corners == 0) { + if (src_corners->num_corners == 0 || ref_corners->num_corners == 0) { return false; }
diff --git a/aom_dsp/flow_estimation/disflow.c b/aom_dsp/flow_estimation/disflow.c index 22d1d44..a275673 100644 --- a/aom_dsp/flow_estimation/disflow.c +++ b/aom_dsp/flow_estimation/disflow.c
@@ -812,9 +812,6 @@ return false; } - if (ref_pyramid->layers[0].stride != src_pyramid->layers[0].stride) { - return false; - } if (src_width < (1 << DOWNSAMPLE_SHIFT) || src_height < (1 << DOWNSAMPLE_SHIFT)) { return false;
diff --git a/av1/encoder/global_motion_facade.c b/av1/encoder/global_motion_facade.c index 7b1af9c..4fdad0b 100644 --- a/av1/encoder/global_motion_facade.c +++ b/av1/encoder/global_motion_facade.c
@@ -314,7 +314,6 @@ if (ref_buf[frame]->y_crop_width == cpi->source->y_crop_width && ref_buf[frame]->y_crop_height == cpi->source->y_crop_height && - ref_buf[frame]->y_stride == cpi->source->y_stride && do_gm_search_logic(&cpi->sf, frame) && !prune_ref_frames && ref_pyr_lvl <= pyr_lvl && !cur_frame_gm_disabled) { assert(ref_buf[frame] != NULL);
diff --git a/test/disflow_test.cc b/test/disflow_test.cc index 78f9565..f852608 100644 --- a/test/disflow_test.cc +++ b/test/disflow_test.cc
@@ -179,36 +179,6 @@ aom_free_frame_buffer(&src); aom_free_frame_buffer(&ref); } - -TEST(DisflowTest, MismatchedStrides) { - YV12_BUFFER_CONFIG src = {}; - YV12_BUFFER_CONFIG ref = {}; - - constexpr int kWidth = 165; - constexpr int kHeight = 513; - ASSERT_EQ(aom_alloc_frame_buffer(&src, kWidth, kHeight, 1, 1, 0, - AOM_BORDER_IN_PIXELS, 0, true, 0), - 0); - ASSERT_EQ( - aom_alloc_frame_buffer(&ref, kWidth, kHeight, 1, 1, 0, 96, 0, true, 0), - 0); - EXPECT_NE(src.y_stride, ref.y_stride); - - MotionModel motion_models[1]; - bool mem_alloc_failed = false; - bool ret = av1_compute_global_motion_disflow( - TRANSLATION, &src, &ref, 8, 0, motion_models, 1, &mem_alloc_failed); - EXPECT_FALSE(ret); - EXPECT_FALSE(mem_alloc_failed); - - ret = av1_compute_global_motion_feature_match( - TRANSLATION, &src, &ref, 8, 0, motion_models, 1, &mem_alloc_failed); - EXPECT_FALSE(ret); - EXPECT_FALSE(mem_alloc_failed); - - aom_free_frame_buffer(&src); - aom_free_frame_buffer(&ref); -} #endif // CONFIG_AV1_ENCODER && !CONFIG_REALTIME_ONLY } // namespace