diff --git a/Source/Lib/Common/ASM_AVX512/highbd_inv_txfm_avx512.c b/Source/Lib/Common/ASM_AVX512/highbd_inv_txfm_avx512.c index e9b57fe4ed..ffc60415dd 100644 --- a/Source/Lib/Common/ASM_AVX512/highbd_inv_txfm_avx512.c +++ b/Source/Lib/Common/ASM_AVX512/highbd_inv_txfm_avx512.c @@ -3152,7 +3152,6 @@ static const inv_transform_1d_avx512 row_invtxfm_16x32_arr[TX_TYPES] = { void av1_inv_txfm2d_add_16x32_avx512(const int32_t *coeff, uint16_t *output, int32_t stride, TxType tx_type, TxSize tx_size, int32_t eob, int32_t bd) { - (void)tx_type; (void)eob; __m512i in[32], out[32]; const int8_t *shift = inv_txfm_shift_ls[tx_size]; @@ -3185,7 +3184,6 @@ void av1_inv_txfm2d_add_16x32_avx512(const int32_t *coeff, uint16_t *output, void av1_inv_txfm2d_add_32x16_avx512(const int32_t *coeff, uint16_t *output, int32_t stride, TxType tx_type, TxSize tx_size, int32_t eob, int32_t bd) { - (void)tx_type; (void)eob; __m512i in[32], out[32]; const int8_t *shift = inv_txfm_shift_ls[tx_size]; diff --git a/test/InversetransformTests.cc b/test/InversetransformTests.cc index 81224fea23..26610f9783 100644 --- a/test/InversetransformTests.cc +++ b/test/InversetransformTests.cc @@ -4,12 +4,16 @@ #include "EbUnitTestUtility.h" typedef void (*av1_inv_txfm_highbd_func)(const int32_t *coeff, uint16_t *output,int32_t stride, TxType tx_type, int32_t bd); +typedef void (*av1_inv_txfm2d_highbd_rect_func)(const int32_t *input, uint16_t *output, int32_t stride, TxType tx_type, TxSize tx_size, int32_t eob, int32_t bd); av1_inv_txfm_highbd_func av1_inv_txfm_highbd_func_ptr_array_base[3] = { av1_inv_txfm2d_add_16x16_avx2 , av1_inv_txfm2d_add_32x32_avx2 , av1_inv_txfm2d_add_64x64_sse4_1 }; av1_inv_txfm_highbd_func av1_inv_txfm_highbd_func_ptr_array_opt[3] = { av1_inv_txfm2d_add_16x16_avx512, av1_inv_txfm2d_add_32x32_avx512 , av1_inv_txfm2d_add_64x64_avx512 }; +av1_inv_txfm2d_highbd_rect_func av1_inv_txfm_highbd_rect_func_ptr_array_base[6] = { av1_inv_txfm2d_add_32x16_c , av1_inv_txfm2d_add_16x32_c , av1_inv_txfm2d_add_16x64_c , av1_inv_txfm2d_add_32x64_c , av1_inv_txfm2d_add_64x32_c , av1_inv_txfm2d_add_64x16_c }; +av1_inv_txfm2d_highbd_rect_func av1_inv_txfm_highbd_rect_func_ptr_array_opt[6] = { av1_inv_txfm2d_add_32x16_avx512 , av1_inv_txfm2d_add_16x32_avx512 , av1_inv_txfm2d_add_16x64_avx512 , av1_inv_txfm2d_add_32x64_avx512 , av1_inv_txfm2d_add_64x32_avx512 , av1_inv_txfm2d_add_64x16_avx512 }; int txsize_16[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 ,9, 10, 11, 12, 13, 14, 15}; +int rect_types[] = { 10 , 9 , 17 , 11 , 12 , 18}; int txsize_32[] = { 0 , 9}; -int txsize_64[] = { 0 }; -int bd[] = {10, 12 }; +int txsize_64[] = { 0}; +int bd[] = { 10, 12}; static void init_data(int32_t **input, int32_t **input_opt, int32_t *input_stride) { *input_stride = eb_create_random_aligned_stride(MAX_SB_SIZE, 64); @@ -21,6 +25,16 @@ static void init_data(int32_t **input, int32_t **input_opt, int32_t *input_strid memcpy(*input_opt, *input, sizeof(**input) * MAX_SB_SIZE * *input_stride); } +static void init_data_with_max(int32_t **input, int32_t **input_opt, int32_t *input_stride) { + *input_stride = eb_create_random_aligned_stride(MAX_SB_SIZE, 64); + *input = (int32_t*)malloc(sizeof(**input) * MAX_SB_SIZE * *input_stride); + *input_opt = (int32_t*)malloc(sizeof(**input_opt) * MAX_SB_SIZE * *input_stride); + memset(*input, 0, MAX_SB_SIZE * *input_stride); + memset(*input_opt, 0, MAX_SB_SIZE * *input_stride); + eb_buf_random_s32_with_max(*input, MAX_SB_SIZE * *input_stride, 1023); + memcpy(*input_opt, *input, sizeof(**input) * MAX_SB_SIZE * *input_stride); +} + static void uninit_data(int32_t *coeff, int32_t *coeff_opt,int32_t *stride) { free(coeff); free(coeff_opt); @@ -38,15 +52,14 @@ static void init_output(uint16_t **output,uint16_t **output_opt,int32_t num) { memcpy(*output_opt, *output, sizeof(**output) * MAX_SB_SIZE * num); } -TEST(InverseTransformTest, av1_inv_txfm_2d_kernels) +TEST(InverseTransformTest, av1_inv_txfm_2d_square_kernels) { int32_t* coeff,* coeff_opt; uint16_t *output, *output_opt; int32_t stride; - EbBool Result = EB_FALSE; for (int loop = 0; loop < 3; loop++) { //Function Pairs for (int i = 0; i < 10; i++) { //Number of Test Runs - for (int x = 0; x < 3; x++) { //Bit Depth + for (int x = 0; x < 2; x++) { //Bit Depth switch (loop) { case 0://16x16 for (int j = 0; j < 16; j++) { @@ -92,3 +105,93 @@ TEST(InverseTransformTest, av1_inv_txfm_2d_kernels) } } } + +TEST(InverseTransformTest, av1_inv_txfm_2d_rect_kernels) +{ + int32_t* coeff, *coeff_opt; + uint16_t *output, *output_opt; + int32_t stride; + for (int loop = 0; loop < 6; loop++) { //Function Pairs + for (int i = 0; i < 10; i++) { //Number of Test Runs + for (int x = 0; x < 2; x++) { //Bit Depth + switch (loop) { + case 0://32x16 + for (int j = 0; j < 2; j++) { + init_data_with_max(&coeff, &coeff_opt, &stride); + ASSERT(eb_buf_compare_s32(coeff, coeff_opt, MAX_SB_SIZE * stride) == 1); + init_output(&output, &output_opt, stride); + av1_inv_txfm_highbd_rect_func_ptr_array_base[loop](coeff, output, stride, (TxType)txsize_32[j], (TxSize)rect_types[loop], 0, bd[x]); + av1_inv_txfm_highbd_rect_func_ptr_array_opt[loop](coeff, output_opt, stride, (TxType)txsize_32[j], (TxSize)rect_types[loop], 0, bd[x]); + EXPECT_EQ(eb_buf_compare_u16(output, output_opt, MAX_SB_SIZE * stride), 1); + uninit_output(output, output_opt); + uninit_data(coeff, coeff_opt, &stride); + } + break; + case 1://16x32 + for (int j = 0; j < 2; j++) { + init_data_with_max(&coeff, &coeff_opt, &stride); + ASSERT(eb_buf_compare_s32(coeff, coeff_opt, MAX_SB_SIZE * stride) == 1); + init_output(&output, &output_opt, stride); + av1_inv_txfm_highbd_rect_func_ptr_array_base[loop](coeff, output, stride, (TxType)txsize_32[j], (TxSize)rect_types[loop], 0, bd[x]); + av1_inv_txfm_highbd_rect_func_ptr_array_opt[loop](coeff, output_opt, stride, (TxType)txsize_32[j], (TxSize)rect_types[loop], 0, bd[x]); + EXPECT_EQ(eb_buf_compare_u16(output, output_opt, MAX_SB_SIZE * stride), 1); + uninit_output(output, output_opt); + uninit_data(coeff, coeff_opt, &stride); + } + break; + case 2://16x64 + for (int j = 0; j < 1; j++) { + init_data_with_max(&coeff, &coeff_opt, &stride); + ASSERT(eb_buf_compare_s32(coeff, coeff_opt, MAX_SB_SIZE * stride) == 1); + init_output(&output, &output_opt, stride); + av1_inv_txfm_highbd_rect_func_ptr_array_base[loop](coeff, output, stride, (TxType)txsize_64[j], (TxSize)rect_types[loop], 0, bd[x]); + av1_inv_txfm_highbd_rect_func_ptr_array_opt[loop](coeff, output_opt, stride, (TxType)txsize_64[j], (TxSize)rect_types[loop], 0, bd[x]); + EXPECT_EQ(eb_buf_compare_u16(output, output_opt, MAX_SB_SIZE * stride), 1); + uninit_output(output, output_opt); + uninit_data(coeff, coeff_opt, &stride); + } + break; + case 3://32x64 + for (int j = 0; j < 1; j++) { + init_data_with_max(&coeff, &coeff_opt, &stride); + ASSERT(eb_buf_compare_s32(coeff, coeff_opt, MAX_SB_SIZE * stride) == 1); + init_output(&output, &output_opt, stride); + av1_inv_txfm_highbd_rect_func_ptr_array_base[loop](coeff, output, stride, (TxType)txsize_64[j], (TxSize)rect_types[loop], 0, bd[x]); + av1_inv_txfm_highbd_rect_func_ptr_array_opt[loop](coeff, output_opt, stride, (TxType)txsize_64[j], (TxSize)rect_types[loop], 0, bd[x]); + EXPECT_EQ(eb_buf_compare_u16(output, output_opt, MAX_SB_SIZE * stride), 1); + uninit_output(output, output_opt); + uninit_data(coeff, coeff_opt, &stride); + } + break; + case 4://64x32 + for (int j = 0; j < 1; j++) { + init_data_with_max(&coeff, &coeff_opt, &stride); + ASSERT(eb_buf_compare_s32(coeff, coeff_opt, MAX_SB_SIZE * stride) == 1); + init_output(&output, &output_opt, stride); + av1_inv_txfm_highbd_rect_func_ptr_array_base[loop](coeff, output, stride, (TxType)txsize_64[j], (TxSize)rect_types[loop], 0, bd[x]); + av1_inv_txfm_highbd_rect_func_ptr_array_opt[loop](coeff, output_opt, stride, (TxType)txsize_64[j], (TxSize)rect_types[loop], 0, bd[x]); + EXPECT_EQ(eb_buf_compare_u16(output, output_opt, MAX_SB_SIZE * stride), 1); + uninit_output(output, output_opt); + uninit_data(coeff, coeff_opt, &stride); + } + break; + case 5://64x16 + for (int j = 0; j < 1; j++) { + init_data_with_max(&coeff, &coeff_opt, &stride); + ASSERT(eb_buf_compare_s32(coeff, coeff_opt, MAX_SB_SIZE * stride) == 1); + init_output(&output, &output_opt, stride); + av1_inv_txfm_highbd_rect_func_ptr_array_base[loop](coeff, output, stride, (TxType)txsize_64[j], (TxSize)rect_types[loop], 0, bd[x]); + av1_inv_txfm_highbd_rect_func_ptr_array_opt[loop](coeff, output_opt, stride, (TxType)txsize_64[j], (TxSize)rect_types[loop], 0, bd[x]); + EXPECT_EQ(eb_buf_compare_u16(output, output_opt, MAX_SB_SIZE * stride), 1); + uninit_output(output, output_opt); + uninit_data(coeff, coeff_opt, &stride); + } + break; + + default: + ASSERT(0); + } + } + } + } +}