Skip to content
Permalink
Browse files

Fix Coding Guideline violations in AVX512 forward and inverse transfo…

…rm code and unit test
  • Loading branch information...
kirithika7 committed May 24, 2019
1 parent 8f62de1 commit 657c9099d7c57318a6419a8636026ddcd76edb50
@@ -788,8 +788,7 @@ static void fdct16x16_avx512(const __m512i *in, __m512i *out, int8_t bit, const
}
}

void av1_fwd_txfm2d_16x16_avx512(int16_t *input, int32_t *coeff, uint32_t stride, TxType tx_type, uint8_t bd)
{
void av1_fwd_txfm2d_16x16_avx512(int16_t *input, int32_t *coeff, uint32_t stride, TxType tx_type, uint8_t bd) {
__m512i in[16], out[16];
const int8_t *shift = fwd_txfm_shift_ls[TX_16X16];
const int32_t txw_idx = get_txw_idx(TX_16X16);
@@ -1424,8 +1423,7 @@ static INLINE void fwd_txfm2d_32x32_avx512(const int16_t *input, int32_t *output
}

void av1_fwd_txfm2d_32x32_avx512(int16_t *input, int32_t *output,
uint32_t stride, TxType tx_type, uint8_t bd)
{
uint32_t stride, TxType tx_type, uint8_t bd) {
DECLARE_ALIGNED(64, int32_t, txfm_buf[1024]);
Txfm2DFlipCfg cfg;
Av1TransformConfig(tx_type, TX_32X32, &cfg);
@@ -2524,8 +2522,7 @@ static INLINE void av1_round_shift_rect_array_32_avx512(__m512i *input,
}
}

void av1_fwd_txfm2d_32x64_avx512(int16_t *input, int32_t *output, uint32_t stride, TxType tx_type, uint8_t bd)
{
void av1_fwd_txfm2d_32x64_avx512(int16_t *input, int32_t *output, uint32_t stride, TxType tx_type, uint8_t bd) {
(void)tx_type;
__m512i in[128];
__m512i *outcoef512 = (__m512i *)output;
@@ -2556,8 +2553,7 @@ void av1_fwd_txfm2d_32x64_avx512(int16_t *input, int32_t *output, uint32_t strid
(void)bd;
}

void av1_fwd_txfm2d_64x32_avx512(int16_t *input, int32_t *output, uint32_t stride, TxType tx_type, uint8_t bd)
{
void av1_fwd_txfm2d_64x32_avx512(int16_t *input, int32_t *output, uint32_t stride, TxType tx_type, uint8_t bd) {
(void)tx_type;
__m512i in[128];
__m512i *outcoef512 = (__m512i *)output;
@@ -2593,8 +2589,7 @@ void av1_fwd_txfm2d_64x32_avx512(int16_t *input, int32_t *output, uint32_t strid
(void)bd;
}

void av1_fwd_txfm2d_16x64_avx512(int16_t *input, int32_t *output, uint32_t stride, TxType tx_type, uint8_t bd)
{
void av1_fwd_txfm2d_16x64_avx512(int16_t *input, int32_t *output, uint32_t stride, TxType tx_type, uint8_t bd) {
__m512i in[64];
__m512i *outcoeff512 = (__m512i *)output;
const int8_t *shift = fwd_txfm_shift_ls[TX_16X64];
@@ -2626,8 +2621,7 @@ void av1_fwd_txfm2d_16x64_avx512(int16_t *input, int32_t *output, uint32_t strid
(void)bd;
}

void av1_fwd_txfm2d_64x16_avx512(int16_t *input, int32_t *output, uint32_t stride, TxType tx_type, uint8_t bd)
{
void av1_fwd_txfm2d_64x16_avx512(int16_t *input, int32_t *output, uint32_t stride, TxType tx_type, uint8_t bd) {
__m512i in[64];
__m512i *outcoeff512 = (__m512i *)output;
const int8_t *shift = fwd_txfm_shift_ls[TX_64X16];
@@ -2707,8 +2701,7 @@ static const fwd_transform_1d_avx512 row_fwdtxfm_16x32_arr[TX_TYPES] = {
};

/* call this function only for DCT_DCT, IDTX */
void av1_fwd_txfm2d_16x32_avx512(int16_t *input, int32_t *output, uint32_t stride, TxType tx_type, uint8_t bd)
{
void av1_fwd_txfm2d_16x32_avx512(int16_t *input, int32_t *output, uint32_t stride, TxType tx_type, uint8_t bd) {
__m512i in[32];
__m512i *outcoef512 = (__m512i *)output;
const int8_t *shift = fwd_txfm_shift_ls[TX_16X32];
@@ -2741,8 +2734,7 @@ void av1_fwd_txfm2d_16x32_avx512(int16_t *input, int32_t *output, uint32_t strid
}

/* call this function only for DCT_DCT, IDTX */
void av1_fwd_txfm2d_32x16_avx512(int16_t *input, int32_t *output, uint32_t stride, TxType tx_type, uint8_t bd)
{
void av1_fwd_txfm2d_32x16_avx512(int16_t *input, int32_t *output, uint32_t stride, TxType tx_type, uint8_t bd) {
__m512i in[32];
__m512i *outcoef512 = (__m512i *)output;
const int8_t *shift = fwd_txfm_shift_ls[TX_32X16];
@@ -748,8 +748,7 @@ static INLINE void round_shift_16x16_avx512(__m512i *in, int32_t shift) {
}
}

static INLINE void iidentity16_and_round_shift_avx512(__m512i *input, int32_t shift)
{
static INLINE void iidentity16_and_round_shift_avx512(__m512i *input, int32_t shift) {
const __m512i scalar = _mm512_set1_epi32(NewSqrt2);
const __m512i rnding = _mm512_set1_epi32((1 << (NewSqrt2Bits - 2)) +
(!!(shift) << (shift + NewSqrt2Bits - 2)));
@@ -761,8 +760,7 @@ static INLINE void iidentity16_and_round_shift_avx512(__m512i *input, int32_t sh
}
}

static INLINE void idct16_col_avx512(__m512i *in, __m512i *out, int32_t bit)
{
static INLINE void idct16_col_avx512(__m512i *in, __m512i *out, int32_t bit) {

const int32_t *cospi = cospi_arr(bit);
const __m512i cospi60 = _mm512_set1_epi32(cospi[60]);
@@ -14,8 +14,7 @@ int tx_32[] = { 0 , 9 };
int tx_64[] = { 0 };
int bitDepth[] = { 8, 10, 12 };

static void init_data(int16_t **input, int16_t **input_opt, uint32_t input_stride)
{
static void init_data(int16_t **input, int16_t **input_opt, uint32_t input_stride) {
*input = (int16_t*)malloc(sizeof(**input) * MAX_SB_SIZE * input_stride);
*input_opt = (int16_t*)malloc(sizeof(**input_opt) * MAX_SB_SIZE * input_stride);
memset(*input, 0, MAX_SB_SIZE * input_stride);
@@ -24,20 +23,17 @@ static void init_data(int16_t **input, int16_t **input_opt, uint32_t input_strid
memcpy(*input_opt, *input, sizeof(**input) * MAX_SB_SIZE * input_stride);
}

static void uninit_data(int16_t *input, int16_t *input_opt)
{
static void uninit_data(int16_t *input, int16_t *input_opt) {
free(input);
free(input_opt);
}

static void uninit_coeff(int32_t *coeff, int32_t *coeff_opt)
{
static void uninit_coeff(int32_t *coeff, int32_t *coeff_opt) {
free(coeff);
free(coeff_opt);
}

static void init_coeff(int32_t **coeff, int32_t **coeff_opt, uint32_t *stride)
{
static void init_coeff(int32_t **coeff, int32_t **coeff_opt, uint32_t *stride) {
*stride = eb_create_random_aligned_stride(MAX_SB_SIZE, 64);
*coeff = (int32_t*)malloc(sizeof(**coeff) * MAX_SB_SIZE * *stride);
*coeff_opt = (int32_t*)malloc(sizeof(**coeff_opt) * MAX_SB_SIZE * *stride);
@@ -50,14 +46,11 @@ TEST(ForwardTransformTest, av1_frwd_txfm_square_kernels)
uint32_t stride;
init_coeff(&coeff, &coeff_opt, &stride);
ASSERT(eb_buf_compare_s32(coeff, coeff_opt, MAX_SB_SIZE * stride) == 1);
for (int loop = 0; loop < 3; loop++)//Function Pairs
{
for (int i = 0; i < 10; i++) {//Number of Test Runs
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 < AOM_BITS_12; x++) {//Bit Depth
switch (loop)
{
switch (loop) {
case 0://16x16
{
for (int j = 0; j < 16; j++) {
init_data(&input, &input_opt, stride);
ASSERT(eb_buf_compare_s16(input, input_opt, MAX_SB_SIZE * stride) == 1);
@@ -68,26 +61,21 @@ TEST(ForwardTransformTest, av1_frwd_txfm_square_kernels)
}
uninit_data(input, input_opt);
}
}
break;
case 1://32x32
{
for (int j = 0; j < 2; j++){
init_data(&input, &input_opt, stride);
ASSERT(eb_buf_compare_s16(input, input_opt, MAX_SB_SIZE * stride) == 1);
av1_frwd_txfm_func_ptr_array_base[loop](input, coeff, stride, (TxType)tx_32[j], bitDepth[x]);
av1_frwd_txfm_func_ptr_array_opt[loop](input_opt, coeff_opt, stride, (TxType)tx_32[j], bitDepth[x]);
for (int idx = 0; idx < 16; idx++) {
EXPECT_EQ(coeff[idx], coeff_opt[idx]);
}
uninit_data(input, input_opt);
for (int j = 0; j < 2; j++) {
init_data(&input, &input_opt, stride);
ASSERT(eb_buf_compare_s16(input, input_opt, MAX_SB_SIZE * stride) == 1);
av1_frwd_txfm_func_ptr_array_base[loop](input, coeff, stride, (TxType)tx_32[j], bitDepth[x]);
av1_frwd_txfm_func_ptr_array_opt[loop](input_opt, coeff_opt, stride, (TxType)tx_32[j], bitDepth[x]);
for (int idx = 0; idx < 16; idx++) {
EXPECT_EQ(coeff[idx], coeff_opt[idx]);
}
uninit_data(input, input_opt);
}
}
break;
case 2://64x64
{
for (int j = 0; j < 1; j++)
{
for (int j = 0; j < 1; j++) {
init_data(&input, &input_opt, stride);
ASSERT(eb_buf_compare_s16(input, input_opt, MAX_SB_SIZE * stride) == 1);
av1_frwd_txfm_func_ptr_array_base[loop](input, coeff, stride, (TxType)tx_64[j], bitDepth[x]);
@@ -97,8 +85,9 @@ TEST(ForwardTransformTest, av1_frwd_txfm_square_kernels)
}
uninit_data(input, input_opt);
}
}
break;
default:
ASSERT(0);
}
}
}

0 comments on commit 657c909

Please sign in to comment.
You can’t perform that action at this time.