Commit a9a24c56d8 for aom
commit a9a24c56d8754f72e4f26cc6ff0f3926d1b91163
Author: Wan-Teh Chang <wtc@google.com>
Date: Thu Jul 9 16:14:34 2026 -0700
Re-enable ResizeAndExtendTest for SSSE3
The scale_plane_1_to_2_phase_0() function, as its name suggests, assume
phase == 0. So has_normative_scaler_ssse3() should check phase == 0 when
the scaling ratio is 1 to 2 (upscaling). In addition, the
scale_plane_1_to_2_phase_0() function writes 16 bytes (__m128i) at a
time to the dst buffer, so has_normative_scaler_ssse3() should also
check src_w % 8 == 0 when the scaling ratio is 1 to 2 (upscaling).
Bug: 363916152
Change-Id: Id495cc0eb3e2434b25aff0f23f4b872b8176d33b
diff --git a/av1/common/x86/resize_ssse3.c b/av1/common/x86/resize_ssse3.c
index e8dfa4ad90..48afd25d25 100644
--- a/av1/common/x86/resize_ssse3.c
+++ b/av1/common/x86/resize_ssse3.c
@@ -742,6 +742,8 @@ static void scale_plane_1_to_2_phase_0(const uint8_t *src,
uint8_t *tmp[9];
__m128i f[4];
+ // The for loop below only works if src_w is a multiple of 8.
+ assert(src_w % 8 == 0);
max_width = (src_w + 7) & ~7;
tmp[0] = temp_buffer + 0 * max_width;
tmp[1] = temp_buffer + 1 * max_width;
@@ -814,12 +816,14 @@ static void scale_plane_1_to_2_phase_0(const uint8_t *src,
static inline bool has_normative_scaler_ssse3(const int src_width,
const int src_height,
const int dst_width,
- const int dst_height) {
+ const int dst_height,
+ const int phase) {
const bool has_normative_scaler =
(2 * dst_width == src_width && 2 * dst_height == src_height) ||
(4 * dst_width == src_width && 4 * dst_height == src_height) ||
(4 * dst_width == 3 * src_width && 4 * dst_height == 3 * src_height) ||
- (dst_width == src_width * 2 && dst_height == src_height * 2);
+ (dst_width == src_width * 2 && dst_height == src_height * 2 &&
+ phase == 0 && src_width % 8 == 0);
return has_normative_scaler;
}
@@ -830,13 +834,13 @@ void av1_resize_and_extend_frame_ssse3(const YV12_BUFFER_CONFIG *src,
const int phase, const int num_planes) {
bool has_normative_scaler =
has_normative_scaler_ssse3(src->y_crop_width, src->y_crop_height,
- dst->y_crop_width, dst->y_crop_height);
+ dst->y_crop_width, dst->y_crop_height, phase);
if (num_planes > 1) {
- has_normative_scaler =
- has_normative_scaler &&
- has_normative_scaler_ssse3(src->uv_crop_width, src->uv_crop_height,
- dst->uv_crop_width, dst->uv_crop_height);
+ has_normative_scaler = has_normative_scaler &&
+ has_normative_scaler_ssse3(
+ src->uv_crop_width, src->uv_crop_height,
+ dst->uv_crop_width, dst->uv_crop_height, phase);
}
if (!has_normative_scaler) {
@@ -949,8 +953,9 @@ void av1_resize_and_extend_frame_ssse3(const YV12_BUFFER_CONFIG *src,
dst_h, interp_kernel, phase, temp_buffer);
free(temp_buffer);
} else {
- assert(dst_w == src_w * 2 && dst_h == src_h * 2);
- // 1 to 2
+ assert(dst_w == src_w * 2 && dst_h == src_h * 2 && phase == 0 &&
+ src_w % 8 == 0);
+ // 1 to 2, phase 0, src_w a multiple of 8
uint8_t *const temp_buffer = (uint8_t *)malloc(8 * ((src_y_w + 7) & ~7));
if (!temp_buffer) {
malloc_failed = 1;
diff --git a/test/av1_scale_test.cc b/test/av1_scale_test.cc
index 14f5c4d6b8..d79ca985cf 100644
--- a/test/av1_scale_test.cc
+++ b/test/av1_scale_test.cc
@@ -274,10 +274,8 @@ TEST_P(ResizeAndExtendTest, ResizeFrame_EightTapSmooth) {
TEST_P(ResizeAndExtendTest, ResizeFrame_Bilinear) { RunTest(BILINEAR); }
TEST_P(ResizeAndExtendTest, DISABLED_Speed) { SpeedTest(); }
-// TODO: bug aomedia:363916152 - Enable SSSE3 unit tests when implementation of
-// av1_resize_and_extend_frame does not differ from scalar version
#if HAVE_SSSE3
-INSTANTIATE_TEST_SUITE_P(DISABLED_SSSE3, ResizeAndExtendTest,
+INSTANTIATE_TEST_SUITE_P(SSSE3, ResizeAndExtendTest,
::testing::Values(av1_resize_and_extend_frame_ssse3));
#endif // HAVE_SSSE3