From 02aa36f1a273d30780e3ef5a3bab24fe460fe273 Mon Sep 17 00:00:00 2001 From: Joose Sainio Date: Tue, 5 Jul 2022 10:28:59 +0300 Subject: [PATCH] [tests] Fix final issue with avx2 satd and update test results --- src/strategies/avx2/picture-avx2.c | 6 ++++-- tests/satd_tests.c | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/strategies/avx2/picture-avx2.c b/src/strategies/avx2/picture-avx2.c index 8680590a..df90f149 100644 --- a/src/strategies/avx2/picture-avx2.c +++ b/src/strategies/avx2/picture-avx2.c @@ -233,7 +233,8 @@ static unsigned satd_4x4_8bit_avx2(const uint8_t *org, const uint8_t *cur) row3 = _mm_add_epi16(row3, _mm_shuffle_epi32(row3, _MM_SHUFFLE(0, 1, 0, 1) )); row3 = _mm_add_epi16(row3, _mm_shufflelo_epi16(row3, _MM_SHUFFLE(0, 1, 0, 1) )); - const int dc1 = abs(_mm_extract_epi16(row2, 0)); + const int16_t temp1 = _mm_extract_epi16(row2, 0); + const int dc1 = abs(temp1); unsigned sum = _mm_extract_epi16(row3, 0); sum -= dc1 - (dc1 >> 2); unsigned satd = (sum + 1) >> 1; @@ -573,7 +574,8 @@ static unsigned satd_8x8_subblock_8bit_avx2(const uint8_t * buf1, unsigned strid unsigned sad = sum_block_avx2(temp); - const int dc1 = abs(_mm_extract_epi16(temp[0], 0)); + const int16_t temp1 = _mm_extract_epi16(temp[0], 0); + const int dc1 = abs(temp1); sad -= dc1 - (dc1 >> 2); unsigned result = (sad + 2) >> 2; diff --git a/tests/satd_tests.c b/tests/satd_tests.c index 4ee21bc4..e2af1d49 100644 --- a/tests/satd_tests.c +++ b/tests/satd_tests.c @@ -119,7 +119,7 @@ static void satd_tear_down_tests() TEST satd_test_black_and_white(void) { - const int satd_results[5] = {2040, 4080, 16320, 65280, 261120}; + const int satd_results[5] = {510, 1020, 4080, 16320, 65280}; const int test = 0; @@ -137,7 +137,7 @@ TEST satd_test_black_and_white(void) TEST satd_test_checkers(void) { - const int satd_checkers_results[5] = { 2040, 4080, 16320, 65280, 261120 }; + const int satd_checkers_results[5] = { 1278, 2556, 10224, 40896, 163584 }; const int test = 1; @@ -156,7 +156,7 @@ TEST satd_test_checkers(void) TEST satd_test_gradient(void) { - const int satd_gradient_results[5] = {3140,9004,20481,67262,258672}; + const int satd_gradient_results[5] = {2728,7158,10775,23399,72780}; const int test = 2;