/******************************************************************************
*
* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/
/**
*******************************************************************************
* @file
*  ihevc_trans_tables.c
*
* @brief
*  Contains tables used for forward and inverse  transform
*
* @author
*  100470
*
* @par List of Tables:
* g_ihevc_iquant_scales
* g_ihevc_iquant_intr_scales
* g_ihevc_quant_scales
* g_ai4_ihevc_trans_4_ttype1
* g_ai4_ihevc_trans_4_ttype0
* g_ai2_ihevc_trans_dst_4
* g_ai4_ihevc_trans_dst_intr_4
* g_ai2_ihevc_trans_4
* g_ai2_ihevc_trans_4_transpose
* g_ai4_ihevc_trans_4_intr
* g_ai2_ihevc_trans_4_intr
* g_ai2_ihevc_trans_8
* g_ai2_ihevc_trans_8_transpose
* g_ai4_ihevc_trans_8_intr
* g_ai2_ihevc_trans_8_intr
* g_ai4_ihevc_trans_intr_even_8
* g_ai4_ihevc_trans_intr_odd_8
* g_ai2_ihevc_trans_16
* g_ai2_ihevc_trans_16_transpose
* g_ai2_ihevc_trans_32_intr_8
* g_ai4_ihevc_trans_16_even
* g_ai4_ihevc_trans_16_odd
* g_ai2_ihevc_trans_32_transpose
* g_ai2_ihevc_trans_32
* g_ai2_ihevc_trans_32_intr_16
* g_ai2_ihevc_trans_16_intr_odd
* g_ai2_ihevc_trans_16_intr_even
* g_ai2_ihevc_trans_32_intr_even
* g_ai2_ihevc_trans_32_intr_odd
* g_ai2_ihevc_trans_16_even_packed
* g_ai2_ihevc_trans_32_intr_packed
* g_ai2_ihevc_trans_32_intr_odd_packed
* g_ai2_ihevc_trans_16_even
* g_ai2_ihevc_trans_16_odd
* g_ai2_ihevc_trans_intr_even_8
* g_ai2_ihevc_trans_intr_odd_8
* g_ai2_ihevc_trans_intr_4
* IHEVCE_CHROMA_SHUFFLEMASK_HBD
* g_ai4_ihevc_trans_8_intr_avx2
* g_ai2_ihevc_trans_8_intr_avx2
* g_ai2_ihevc_trans_32_intr_8_avx2
* g_ai2_ihevc_trans_32_intr_16_avx2
* g_ai2_ihevc_trans_16_intr_odd_avx2
* g_ai2_ihevc_trans_16_intr_even_avx2

*
* @remarks
*  None
*
*******************************************************************************
*/

#include "ihevc_typedefs.h"
#include "ihevc_macros.h"

#include "ihevc_platform_macros.h"
#include "ihevc_func_selector.h"
#include "ihevc_macros.h"
#include "ihevc_trans_tables.h"
#include "ihevc_defs.h"

const WORD32 g_ihevc_iquant_scales[6] =
{
    40, 45, 51, 57, 64, 72
};

/*Multiplied by 16 for flat scale coeff */
const WORD32 g_ihevc_iquant_scales_flat_scale[6] =
{
    640, 720, 816, 912, 1024, 1152
};

const WORD16 g_ihevc_iquant_intr_scales[6][8] =
{
    { 40, 40, 40, 40, 40, 40, 40, 40 },
    { 45, 45, 45, 45, 45, 45, 45, 45 },
    { 51, 51, 51, 51, 51, 51, 51, 51 },
    { 57, 57, 57, 57, 57, 57, 57, 57 },
    { 64, 64, 64, 64, 64, 64, 64, 64 },
    { 72, 72, 72, 72, 72, 72, 72, 72 }
};

const WORD32 g_ihevc_quant_scales[6] =
{
    26214, 23302, 20560, 18396, 16384, 14564
};

//DST coeffs
const WORD32 g_ai4_ihevc_trans_4_ttype1[3][4] =
{
    { 55, 55, 55, 55 },
    { 29, 29, 29, 29 },
    { 74, 74, 74, 74 }
};

//DCT coeffs
const WORD32 g_ai4_ihevc_trans_4_ttype0[3][4] =
{
    { 36, 36, 36, 36 },
    { 64, 64, 64, 64 },
    { 83, 83, 83, 83 }
};

const WORD16 g_ai2_ihevc_trans_dst_4[4][4] =
{
    { 29, 55, 74, 84 },
    { 74, 74, 0, -74 },
    { 84, -29, -74, 55 },
    { 55, -84, 74, -29 }
};

const WORD32 g_ai4_ihevc_trans_dst_intr_4[3][4] =
{ /* 4*32 = 128 bit */
    { 29, 29, 29, 29 },
    { 55, 55, 55, 55 },
    { 74, 74, 74, 74 }
};

const WORD16 g_ai2_ihevc_trans_4[4][4] =
{
    { 64,  64,  64,  64 },
    { 83,  36, -36, -83 },
    { 64, -64, -64,  64 },
    { 36, -83,  83, -36 }
};

const WORD16 g_ai2_ihevc_trans_4_transpose[4][4] =
{
    { 64,  83,  64,  36 },
    { 64,  36, -64, -83 },
    { 64, -36, -64,  83 },
    { 64, -83,  64, -36 }
};

const WORD32 g_ai4_ihevc_trans_4_intr[3][4] =
{ /* 4*32 = 128 bit */
    { 64, 64, 64, 64 },
    { 83, 83, 83, 83 },
    { 36, 36, 36, 36 }
};

const WORD16 g_ai2_ihevc_trans_4_intr[8] = { 64, 64, 83, 36, 64, -64, 36, -83 };


const WORD16 g_ai2_ihevc_trans_8[8][8] =
{
    { 64,  64,  64,  64,  64,  64,  64,  64 },
    { 89,  75,  50,  18, -18, -50, -75, -89 },
    { 83,  36, -36, -83, -83, -36,  36,  83 },
    { 75, -18, -89, -50,  50,  89,  18, -75 },
    { 64, -64, -64,  64,  64, -64, -64,  64 },
    { 50, -89,  18,  75, -75, -18,  89, -50 },
    { 36, -83,  83, -36, -36,  83, -83,  36 },
    { 18, -50,  75, -89,  89, -75,  50, -18 }
};

/* Used by itrans_recon_8x8 */
const WORD16 g_ai2_ihevc_trans_8_transpose[8][8] =
{
    { 64,  89,  83,  75,  64,  50,  36,  18 },
    { 64,  75,  36, -18, -64, -89, -83, -50 },
    { 64,  50, -36, -89, -64,  18,  83,  75 },
    { 64,  18, -83, -50,  64,  75, -36, -89 },
    { 64, -18, -83,  50,  64, -75, -36,  89 },
    { 64, -50, -36,  89, -64, -18,  83, -75 },
    { 64, -75,  36,  18, -64,  89, -83,  50 },
    { 64, -89,  83, -75,  64, -50,  36, -18 }
};

const WORD32 g_ai4_ihevc_trans_8_intr[7][4] =
{ /* 4*32 = 128 bit */
    { 64, 64, 64, 64 },
    { 83, 83, 83, 83 },
    { 36, 36, 36, 36 },
    { 75, 75, 75, 75 },
    { 18, 18, 18, 18 },
    { 89, 89, 89, 89 },
    { 50, 50, 50, 50 },
};


const WORD16 g_ai2_ihevc_trans_8_intr[8][8] =
{ /* 4*32 = 128 bit */
    { 64,  64,  64,  64,  64,  64,  64,  64 },
    { 89,  75,  18,  50,  89,  75,  18,  50 },
    { 83,  36,  83,  36,  83,  36,  83,  36 },
    { 75, -18, -50, -89,  75, -18, -50, -89 },
    { 64, -64,  64, -64,  64, -64,  64, -64 },
    { 50, -89,  75,  18,  50, -89,  75,  18 },
    { 36, -83,  36, -83,  36, -83,  36, -83 },
    { 18, -50, -89,  75,  18, -50, -89,  75 }
};


const WORD32 g_ai4_ihevc_trans_intr_even_8[3][4] =
{
    { 64, 64, 64, 64 },
    { 83, 83, 83, 83 },
    { 36, 36, 36, 36 },
};

const WORD32 g_ai4_ihevc_trans_intr_odd_8[4][4] =
{
    { 89, 89, 89, 89 },
    { 75, 75, 75, 75 },
    { 50, 50, 50, 50 },
    { 18, 18, 18, 18 }
};

const WORD16 g_ai2_ihevc_trans_16[16][16] =
{
    { 64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64 },
    { 90,  87,  80,  70,  57,  43,  25,   9,  -9, -25, -43, -57, -70, -80, -87, -90 },
    { 89,  75,  50,  18, -18, -50, -75, -89, -89, -75, -50, -18,  18,  50,  75,  89 },
    { 87,  57,   9, -43, -80, -90, -70, -25,  25,  70,  90,  80,  43,  -9, -57, -87 },
    { 83,  36, -36, -83, -83, -36,  36,  83,  83,  36, -36, -83, -83, -36,  36,  83 },
    { 80,   9, -70, -87, -25,  57,  90,  43, -43, -90, -57,  25,  87,  70,  -9, -80 },
    { 75, -18, -89, -50,  50,  89,  18, -75, -75,  18,  89,  50, -50, -89, -18,  75 },
    { 70, -43, -87,   9,  90,  25, -80, -57,  57,  80, -25, -90,  -9,  87,  43, -70 },
    { 64, -64, -64,  64,  64, -64, -64,  64,  64, -64, -64,  64,  64, -64, -64,  64 },
    { 57, -80, -25,  90,  -9, -87,  43,  70, -70, -43,  87,   9, -90,  25,  80, -57 },
    { 50, -89,  18,  75, -75, -18,  89, -50, -50,  89, -18, -75,  75,  18, -89,  50 },
    { 43, -90,  57,  25, -87,  70,   9, -80,  80,  -9, -70,  87, -25, -57,  90, -43 },
    { 36, -83,  83, -36, -36,  83, -83,  36,  36, -83,  83, -36, -36,  83, -83,  36 },
    { 25, -70,  90, -80,  43,   9, -57,  87, -87,  57,  -9, -43,  80, -90,  70, -25 },
    { 18, -50,  75, -89,  89, -75,  50, -18, -18,  50, -75,  89, -89,  75, -50,  18 },
    {  9, -25,  43, -57,  70, -80,  87, -90,  90, -87,  80, -70,  57, -43,  25,  -9 }
};

const WORD32 g_ai4_ihevc_trans_16[16][8] =
{
    { 64,  64,  64,  64,  64,  64,  64,  64 },
    { 90,  87,  80,  70,  57,  43,  25,   9 },
    { 89,  75,  50,  18, -18, -50, -75, -89 },
    { 87,  57,   9, -43, -80, -90, -70, -25 },
    { 83,  36, -36, -83, -83, -36,  36,  83 },
    { 80,   9, -70, -87, -25,  57,  90,  43 },
    { 75, -18, -89, -50,  50,  89,  18, -75 },
    { 70, -43, -87,   9,  90,  25, -80, -57 },
    { 64, -64, -64,  64,  64, -64, -64,  64 },
    { 57, -80, -25,  90,  -9, -87,  43,  70 },
    { 50, -89,  18,  75, -75, -18,  89, -50 },
    { 43, -90,  57,  25, -87,  70,   9, -80 },
    { 36, -83,  83, -36, -36,  83, -83,  36 },
    { 25, -70,  90, -80,  43,   9, -57,  87 },
    { 18, -50,  75, -89,  89, -75,  50, -18 },
    {  9, -25,  43, -57,  70, -80,  87, -90}};

const WORD16 g_ai2_ihevc_trans_16_transpose[1][16] =
{
    { 64, 90, 89, 87, 83, 80, 75, 70, 64, 57, 50, 43, 36, 25, 18, 9 }
};

const WORD32 g_ai2_ihevc_trans_32_intr_8[8][4] =
{ /* 4*32 = 128 bit */
    { 90, 90, 90, 90 },
    { 87, 87, 87, 87 },
    { 80, 80, 80, 80 },
    { 70, 70, 70, 70 },
    { 57, 57, 57, 57 },
    { 43, 43, 43, 43 },
    { 25, 25, 25, 25 },
    {  9,  9,  9,  9 }
};

const WORD32 g_ai4_ihevc_trans_16_even[7][4] =
{
    { 64, 64, 64, 64 },
    { 89, 89, 89, 89 },
    { 75, 75, 75, 75 },
    { 83, 83, 83, 83 },
    { 36, 36, 36, 36 },
    { 18, 18, 18, 18 },
    { 50, 50, 50, 50 },
};

const WORD32 g_ai4_ihevc_trans_16_odd[8][4] =
{
    { 90, 90, 90, 90 },
    { 87, 87, 87, 87 },
    { 80, 80, 80, 80 },
    { 70, 70, 70, 70 },
    { 57, 57, 57, 57 },
    { 43, 43, 43, 43 },
    { 25, 25, 25, 25 },
    { 9,  9,  9,  9  }
};

const WORD16 g_ai2_ihevc_trans_32_transpose[1][32] =
{
    { 64, 90, 90, 90, 89, 88, 87, 85, 83, 82, 80, 78, 75, 73, 70, 67, 64, 61, 57, 54, 50, 46, 43, 38, 36, 31, 25, 22, 18, 13, 9, 4 }
};
const WORD16 g_ai2_ihevc_trans_32[32][32] =
{
    { 64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64 },
    { 90,  90,  88,  85,  82,  78,  73,  67,  61,  54,  46,  38,  31,  22,  13,   4,  -4, -13, -22, -31, -38, -46, -54, -61, -67, -73, -78, -82, -85, -88, -90, -90 },
    { 90,  87,  80,  70,  57,  43,  25,   9,  -9, -25, -43, -57, -70, -80, -87, -90, -90, -87, -80, -70, -57, -43, -25,  -9,   9,  25,  43,  57,  70,  80,  87,  90 },
    { 90,  82,  67,  46,  22,  -4, -31, -54, -73, -85, -90, -88, -78, -61, -38, -13,  13,  38,  61,  78,  88,  90,  85,  73,  54,  31,   4, -22, -46, -67, -82, -90 },
    { 89,  75,  50,  18, -18, -50, -75, -89, -89, -75, -50, -18,  18,  50,  75,  89,  89,  75,  50,  18, -18, -50, -75, -89, -89, -75, -50, -18,  18,  50,  75,  89 },
    { 88,  67,  31, -13, -54, -82, -90, -78, -46,  -4,  38,  73,  90,  85,  61,  22, -22, -61, -85, -90, -73, -38,   4,  46,  78,  90,  82,  54,  13, -31, -67, -88 },
    { 87,  57,   9, -43, -80, -90, -70, -25,  25,  70,  90,  80,  43,  -9, -57, -87, -87, -57,  -9,  43,  80,  90,  70,  25, -25, -70, -90, -80, -43,   9,  57,  87 },
    { 85,  46, -13, -67, -90, -73, -22,  38,  82,  88,  54,  -4, -61, -90, -78, -31,  31,  78,  90,  61,   4, -54, -88, -82, -38,  22,  73,  90,  67,  13, -46, -85 },
    { 83,  36, -36, -83, -83, -36,  36,  83,  83,  36, -36, -83, -83, -36,  36,  83,  83,  36, -36, -83, -83, -36,  36,  83,  83,  36, -36, -83, -83, -36,  36,  83 },
    { 82,  22, -54, -90, -61,  13,  78,  85,  31, -46, -90, -67,   4,  73,  88,  38, -38, -88, -73,  -4,  67,  90,  46, -31, -85, -78, -13,  61,  90,  54, -22, -82 },
    { 80,   9, -70, -87, -25,  57,  90,  43, -43, -90, -57,  25,  87,  70,  -9, -80, -80,  -9,  70,  87,  25, -57, -90, -43,  43,  90,  57, -25, -87, -70,   9,  80 },
    { 78,  -4, -82, -73,  13,  85,  67, -22, -88, -61,  31,  90,  54, -38, -90, -46,  46,  90,  38, -54, -90, -31,  61,  88,  22, -67, -85, -13,  73,  82,   4, -78 },
    { 75, -18, -89, -50,  50,  89,  18, -75, -75,  18,  89,  50, -50, -89, -18,  75,  75, -18, -89, -50,  50,  89,  18, -75, -75,  18,  89,  50, -50, -89, -18,  75 },
    { 73, -31, -90, -22,  78,  67, -38, -90, -13,  82,  61, -46, -88,  -4,  85,  54, -54, -85,   4,  88,  46, -61, -82,  13,  90,  38, -67, -78,  22,  90,  31, -73 },
    { 70, -43, -87,   9,  90,  25, -80, -57,  57,  80, -25, -90,  -9,  87,  43, -70, -70,  43,  87,  -9, -90, -25,  80,  57, -57, -80,  25,  90,   9, -87, -43,  70 },
    { 67, -54, -78,  38,  85, -22, -90,   4,  90,  13, -88, -31,  82,  46, -73, -61,  61,  73, -46, -82,  31,  88, -13, -90,  -4,  90,  22, -85, -38,  78,  54, -67 },
    { 64, -64, -64,  64,  64, -64, -64,  64,  64, -64, -64,  64,  64, -64, -64,  64,  64, -64, -64,  64,  64, -64, -64,  64,  64, -64, -64,  64,  64, -64, -64,  64 },
    { 61, -73, -46,  82,  31, -88, -13,  90,  -4, -90,  22,  85, -38, -78,  54,  67, -67, -54,  78,  38, -85, -22,  90,   4, -90,  13,  88, -31, -82,  46,  73, -61 },
    { 57, -80, -25,  90,  -9, -87,  43,  70, -70, -43,  87,   9, -90,  25,  80, -57, -57,  80,  25, -90,   9,  87, -43, -70,  70,  43, -87,  -9,  90, -25, -80,  57 },
    { 54, -85,  -4,  88, -46, -61,  82,  13, -90,  38,  67, -78, -22,  90, -31, -73,  73,  31, -90,  22,  78, -67, -38,  90, -13, -82,  61,  46, -88,   4,  85, -54 },
    { 50, -89,  18,  75, -75, -18,  89, -50, -50,  89, -18, -75,  75,  18, -89,  50,  50, -89,  18,  75, -75, -18,  89, -50, -50,  89, -18, -75,  75,  18, -89,  50 },
    { 46, -90,  38,  54, -90,  31,  61, -88,  22,  67, -85,  13,  73, -82,   4,  78, -78,  -4,  82, -73, -13,  85, -67, -22,  88, -61, -31,  90, -54, -38,  90, -46 },
    { 43, -90,  57,  25, -87,  70,   9, -80,  80,  -9, -70,  87, -25, -57,  90, -43, -43,  90, -57, -25,  87, -70,  -9,  80, -80,   9,  70, -87,  25,  57, -90,  43 },
    { 38, -88,  73,  -4, -67,  90, -46, -31,  85, -78,  13,  61, -90,  54,  22, -82,  82, -22, -54,  90, -61, -13,  78, -85,  31,  46, -90,  67,   4, -73,  88, -38 },
    { 36, -83,  83, -36, -36,  83, -83,  36,  36, -83,  83, -36, -36,  83, -83,  36,  36, -83,  83, -36, -36,  83, -83,  36,  36, -83,  83, -36, -36,  83, -83,  36 },
    { 31, -78,  90, -61,   4,  54, -88,  82, -38, -22,  73, -90,  67, -13, -46,  85, -85,  46,  13, -67,  90, -73,  22,  38, -82,  88, -54,  -4,  61, -90,  78, -31 },
    { 25, -70,  90, -80,  43,   9, -57,  87, -87,  57,  -9, -43,  80, -90,  70, -25, -25,  70, -90,  80, -43,  -9,  57, -87,  87, -57,   9,  43, -80,  90, -70,  25 },
    { 22, -61,  85, -90,  73, -38,  -4,  46, -78,  90, -82,  54, -13, -31,  67, -88,  88, -67,  31,  13, -54,  82, -90,  78, -46,   4,  38, -73,  90, -85,  61, -22 },
    { 18, -50,  75, -89,  89, -75,  50, -18, -18,  50, -75,  89, -89,  75, -50,  18,  18, -50,  75, -89,  89, -75,  50, -18, -18,  50, -75,  89, -89,  75, -50,  18 },
    { 13, -38,  61, -78,  88, -90,  85, -73,  54, -31,   4,  22, -46,  67, -82,  90, -90,  82, -67,  46, -22,  -4,  31, -54,  73, -85,  90, -88,  78, -61,  38, -13 },
    {  9, -25,  43, -57,  70, -80,  87, -90,  90, -87,  80, -70,  57, -43,  25,  -9,  -9,  25, -43,  57, -70,  80, -87,  90, -90,  87, -80,  70, -57,  43, -25,   9 },
    {  4, -13,  22, -31,  38, -46,  54, -61,  67, -73,  78, -82,  85, -88,  90, -90,  90, -90,  88, -85,  82, -78,  73, -67,  61, -54,  46, -38,  31, -22,  13,  -4 }
};

const WORD32 g_ai4_ihevc_trans_32[32][16] =
{
    { 64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64},
    { 90,  90,  88,  85,  82,  78,  73,  67,  61,  54,  46,  38,  31,  22,  13,   4},
    { 90,  87,  80,  70,  57,  43,  25,   9,  -9, -25, -43, -57, -70, -80, -87, -90},
    { 90,  82,  67,  46,  22,  -4, -31, -54, -73, -85, -90, -88, -78, -61, -38, -13},
    { 89,  75,  50,  18, -18, -50, -75, -89, -89, -75, -50, -18,  18,  50,  75,  89},
    { 88,  67,  31, -13, -54, -82, -90, -78, -46,  -4,  38,  73,  90,  85,  61,  22},
    { 87,  57,   9, -43, -80, -90, -70, -25,  25,  70,  90,  80,  43,  -9, -57, -87},
    { 85,  46, -13, -67, -90, -73, -22,  38,  82,  88,  54,  -4, -61, -90, -78, -31},
    { 83,  36, -36, -83, -83, -36,  36,  83,  83,  36, -36, -83, -83, -36,  36,  83},
    { 82,  22, -54, -90, -61,  13,  78,  85,  31, -46, -90, -67,   4,  73,  88,  38},
    { 80,   9, -70, -87, -25,  57,  90,  43, -43, -90, -57,  25,  87,  70,  -9, -80},
    { 78,  -4, -82, -73,  13,  85,  67, -22, -88, -61,  31,  90,  54, -38, -90, -46},
    { 75, -18, -89, -50,  50,  89,  18, -75, -75,  18,  89,  50, -50, -89, -18,  75},
    { 73, -31, -90, -22,  78,  67, -38, -90, -13,  82,  61, -46, -88,  -4,  85,  54},
    { 70, -43, -87,   9,  90,  25, -80, -57,  57,  80, -25, -90,  -9,  87,  43, -70},
    { 67, -54, -78,  38,  85, -22, -90,   4,  90,  13, -88, -31,  82,  46, -73, -61},
    { 64, -64, -64,  64,  64, -64, -64,  64,  64, -64, -64,  64,  64, -64, -64,  64},
    { 61, -73, -46,  82,  31, -88, -13,  90,  -4, -90,  22,  85, -38, -78,  54,  67},
    { 57, -80, -25,  90,  -9, -87,  43,  70, -70, -43,  87,   9, -90,  25,  80, -57},
    { 54, -85,  -4,  88, -46, -61,  82,  13, -90,  38,  67, -78, -22,  90, -31, -73},
    { 50, -89,  18,  75, -75, -18,  89, -50, -50,  89, -18, -75,  75,  18, -89,  50},
    { 46, -90,  38,  54, -90,  31,  61, -88,  22,  67, -85,  13,  73, -82,   4,  78},
    { 43, -90,  57,  25, -87,  70,   9, -80,  80,  -9, -70,  87, -25, -57,  90, -43},
    { 38, -88,  73,  -4, -67,  90, -46, -31,  85, -78,  13,  61, -90,  54,  22, -82},
    { 36, -83,  83, -36, -36,  83, -83,  36,  36, -83,  83, -36, -36,  83, -83,  36},
    { 31, -78,  90, -61,   4,  54, -88,  82, -38, -22,  73, -90,  67, -13, -46,  85},
    { 25, -70,  90, -80,  43,   9, -57,  87, -87,  57,  -9, -43,  80, -90,  70, -25},
    { 22, -61,  85, -90,  73, -38,  -4,  46, -78,  90, -82,  54, -13, -31,  67, -88},
    { 18, -50,  75, -89,  89, -75,  50, -18, -18,  50, -75,  89, -89,  75, -50,  18},
    { 13, -38,  61, -78,  88, -90,  85, -73,  54, -31,   4,  22, -46,  67, -82,  90},
    {  9, -25,  43, -57,  70, -80,  87, -90,  90, -87,  80, -70,  57, -43,  25,  -9},
    {  4, -13,  22, -31,  38, -46,  54, -61,  67, -73,  78, -82,  85, -88,  90, -90}
};

const WORD32 g_ai2_ihevc_trans_32_intr_16[15][4] =
{ /* 4*32 = 128 bit */
    { 90, 90, 90, 90 },
    { 88, 88, 88, 88 },
    { 85, 85, 85, 85 },
    { 82, 82, 82, 82 },
    { 78, 78, 78, 78 },
    { 73, 73, 73, 73 },
    { 67, 67, 67, 67 },
    { 61, 61, 61, 61 },
    { 54, 54, 54, 54 },
    { 46, 46, 46, 46 },
    { 38, 38, 38, 38 },
    { 31, 31, 31, 31 },
    { 22, 22, 22, 22 },
    { 13, 13, 13, 13 },
    { 4,  4,  4,  4  }
};

const WORD16 g_ai2_ihevc_trans_16_intr_odd[32][8] =
{
    {  90,  87,  90,  87,  90,  87,  90,  87 },
    {  70,  80,  70,  80,  70,  80,  70,  80 },
    {  57,  43,  57,  43,  57,  43,  57,  43 },
    {   9,  25,   9,  25,   9,  25,   9,  25 },
    {  87,  57,  87,  57,  87,  57,  87,  57 },
    { -43,   9, -43,   9, -43,   9, -43,   9 },
    { -80, -90, -80, -90, -80, -90, -80, -90 },
    { -25, -70, -25, -70, -25, -70, -25, -70 },
    {  80,   9,  80,   9,  80,   9,  80,   9 },
    { -87, -70, -87, -70, -87, -70, -87, -70 },
    { -25,  57, -25,  57, -25,  57, -25,  57 },
    {  43,  90,  43,  90,  43,  90,  43,  90 },
    {  70, -43,  70, -43,  70, -43,  70, -43 },
    {   9, -87,   9, -87,   9, -87,   9, -87 },
    {  90,  25,  90,  25,  90,  25,  90,  25 },
    { -57, -80, -57, -80, -57, -80, -57, -80 },
    {  57, -80,  57, -80,  57, -80,  57, -80 },
    {  90, -25,  90, -25,  90, -25,  90, -25 },
    {  -9, -87,  -9, -87,  -9, -87,  -9, -87 },
    {  70,  43,  70,  43,  70,  43,  70,  43 },
    {  43, -90,  43, -90,  43, -90,  43, -90 },
    {  25,  57,  25,  57,  25,  57,  25,  57 },
    { -87,  70, -87,  70, -87,  70, -87,  70 },
    { -80,   9, -80,   9, -80,   9, -80,   9 },
    {  25, -70,  25, -70,  25, -70,  25, -70 },
    { -80,  90, -80,  90, -80,  90, -80,  90 },
    {  43,   9,  43,   9,  43,   9,  43,   9 },
    {  87, -57,  87, -57,  87, -57,  87, -57 },
    {   9, -25,   9, -25,   9, -25,   9, -25 },
    { -57,  43, -57,  43, -57,  43, -57,  43 },
    {  70, -80,  70, -80,  70, -80,  70, -80 },
    { -90,  87, -90,  87, -90,  87, -90,  87 }
};

const WORD16 g_ai2_ihevc_trans_16_intr_even[12][8] =
{
    {  64,  64,  64,  64,  64,  64,  64,  64 },
    {  89,  75,  89,  75,  89,  75,  89,  75 },
    {  18,  50,  18,  50,  18,  50,  18,  50 },
    {  83,  36,  83,  36,  83,  36,  83,  36 },
    {  75, -18,  75, -18,  75, -18,  75, -18 },
    { -50, -89, -50, -89, -50, -89, -50, -89 },
    {  64, -64,  64, -64,  64, -64,  64, -64 },
    {  50, -89,  50, -89,  50, -89,  50, -89 },
    {  75,  18,  75,  18,  75,  18,  75,  18 },
    {  36, -83,  36, -83,  36, -83,  36, -83 },
    {  18, -50,  18, -50,  18, -50,  18, -50 },
    { -89,  75, -89,  75, -89,  75, -89,  75 }
};


const WORD16 g_ai2_ihevc_trans_32_intr_even[22][8] =
{
    {  64,  64,  64,  64,  83,  36,  83,  36 },
    {  64, -64,  64, -64,  36, -83,  36, -83 },
    {  89,  18,  89,  18,  75,  50,  75,  50 },
    {  75, -50,  75, -50, -18, -89, -18, -89 },
    {  50,  75,  50,  75, -89,  18, -89,  18 },
    {  18, -89,  18, -89, -50,  75, -50,  75 },

    {  90,  70,  90,  70,  87,  80,  87,  80 },
    {   9,  57,   9,  57,  25,  43,  25,  43 },
    {  87, -43,  87, -43,  57,   9,  57,   9 },
    { -25, -80, -25, -80, -70, -90, -70, -90 },
    {  80, -87,  80, -87,   9, -70,   9, -70 },
    {  43, -25,  43, -25,  90,  57,  90,  57 },
    {  70,   9,  70,   9, -43, -87, -43, -87 },
    { -57,  90, -57,  90, -80,  25, -80,  25 },
    {  57,  90,  57,  90, -80, -25, -80, -25 },
    {  70,  -9,  70,  -9,  43, -87,  43, -87 },
    {  43,  25,  43,  25, -90,  57, -90,  57 },
    { -80, -87, -80, -87,   9,  70,   9,  70 },
    {  25, -80,  25, -80, -70,  90, -70,  90 },
    {  87,  43,  87,  43, -57,   9, -57,   9 },
    {   9, -57,   9, -57, -25,  43, -25,  43 },
    { -90,  70, -90,  70,  87, -80,  87, -80 }
};


const WORD16 g_ai2_ihevc_trans_32_intr_odd[32][16] =
{
    {  90,  85,  90,  85,  90,  88,  90,  88,  61,  82,  61,  82, -73, -46, -73, -46 },
    {  67,  82,  67,  82,  73,  78,  73,  78,  90,  31,  90,  31, -13, -88, -13, -88 },
    {  61,  38,  61,  38,  54,  46,  54,  46,  -4,  85,  -4,  85, -90,  22, -90,  22 },
    {   4,  31,   4,  31,  13,  22,  13,  22,  67, -38,  67, -38,  54, -78,  54, -78 },

    {  90,  46,  90,  46,  82,  67,  82,  67,  54,  88,  54,  88, -85,  -4, -85,  -4 },
    { -54,  22, -54,  22, -31,  -4, -31,  -4,  13, -46,  13, -46,  82, -61,  82, -61 },
    { -73, -88, -73, -88, -85, -90, -85, -90, -90, -78, -90, -78,  38,  67,  38,  67 },
    { -13, -78, -13, -78, -38, -61, -38, -61, -73, -22, -73, -22, -31,  90, -31,  90 },

    {  88, -13,  88, -13,  67,  31,  67,  31,  46,  54,  46,  54, -90,  38, -90,  38 },
    { -78, -54, -78, -54, -90, -82, -90, -82, -88, -90, -88, -90,  61,  31,  61,  31 },
    { -46,  73, -46,  73,  -4,  38,  -4,  38,  22,  13,  22,  13,  67, -85,  67, -85 },
    {  22,  90,  22,  90,  61,  85,  61,  85,  78,  73,  78,  73,   4, -82,   4, -82 },

    {  85, -67,  85, -67,  46, -13,  46, -13,  38,  -4,  38,  -4, -88,  73, -88,  73 },
    {  38, -90,  38, -90, -22, -73, -22, -73, -31, -67, -31, -67, -46,  90, -46,  90 },
    {  82,  -4,  82,  -4,  88,  54,  88,  54,  85,  61,  85,  61, -78,  13, -78,  13 },
    { -31, -61, -31, -61, -78, -90, -78, -90, -82, -90, -82, -90,  22,  54,  22,  54 },

    {  82, -90,  82, -90,  22, -54,  22, -54,  31, -61,  31, -61, -78,  90, -78,  90 },
    {  85, -61,  85, -61,  78,  13,  78,  13,  82,   4,  82,   4, -88,  54, -88,  54 },
    {  31, -67,  31, -67, -46, -90, -46, -90, -38, -90, -38, -90, -22,  73, -22,  73 },
    {  38,   4,  38,   4,  88,  73,  88,  73,  85,  67,  85,  67, -46, -13, -46, -13 },

    {  78, -73,  78, -73,  -4, -82,  -4, -82,  22, -90,  22, -90, -61,  85, -61,  85 },
    { -22,  13, -22,  13,  67,  85,  67,  85,  46,  73,  46,  73,  -4, -38,  -4, -38 },
    { -88,  90, -88,  90, -61,  31, -61,  31, -78,  54, -78,  54,  90, -82,  90, -82 },
    { -46,  54, -46,  54, -90, -38, -90, -38, -88, -13, -88, -13,  67, -31,  67, -31 },

    {  73, -22,  73, -22, -31, -90, -31, -90,  13, -78,  13, -78, -38,  61, -38,  61 },
    { -90,  78, -90,  78, -38,  67, -38,  67, -73,  88, -73,  88,  85, -90,  85, -90 },
    { -13, -46, -13, -46,  82,  61,  82,  61,  54,  22,  54,  22, -31,   4, -31,   4 },
    {  54, -88,  54, -88,  85,  -4,  85,  -4,  90, -46,  90, -46, -82,  67, -82,  67 },

    {  67,  38,  67,  38, -54, -78, -54, -78,   4, -31,   4, -31, -13,  22, -13,  22 },
    {   4,  85,   4,  85, -90, -22, -90, -22, -61,  38, -61,  38,  54, -46,  54, -46 },
    {  90, -31,  90, -31,  13, -88,  13, -88,  67, -82,  67, -82, -73,  78, -73,  78 },
    { -61,  82, -61,  82, -73,  46, -73,  46, -90,  85, -90,  85,  90, -88,  90, -88 }

};


/*Tables for itrans_recon functions*/
const WORD16 g_ai2_ihevc_trans_16_even_packed[12][8] =
{
    {  83,  36,  83,  36,  83,  36,  83,  36 },

    {  36, -83,  36, -83,  36, -83,  36, -83 },

    {  64,  64,  64,  64,  64,  64,  64,  64 },

    {  64, -64,  64, -64,  64, -64,  64, -64 },

    {  89,  75,  89,  75,  89,  75,  89,  75 },

    {  50,  18,  50,  18,  50,  18,  50,  18 },

    {  75, -18,  75, -18,  75, -18,  75, -18 },

    {  89,  50,  89,  50,  89,  50,  89,  50 },

    {  50, -89,  50, -89,  50, -89,  50, -89 },

    {  18,  75,  18,  75,  18,  75,  18,  75 },

    {  18, -50,  18, -50,  18, -50,  18, -50 },

    {  75, -89,  75, -89,  75, -89,  75, -89 },


};

const WORD16 g_ai2_ihevc_trans_32_intr_packed[32][8] =
{
    {  90,  87,  90,  87,  90,  87,  90,  87 },

    {  80,  70,  80,  70,  80,  70,  80,  70 },

    {  57,  43,  57,  43,  57,  43,  57,  43 },

    {  25,   9,  25,   9,  25,   9,  25,   9 },

    {  87,  57,  87,  57,  87,  57,  87,  57 },

    {   9, -43,   9, -43,   9, -43,   9, -43 },

    {  80,  90,  80,  90,  80,  90,  80,  90 },

    {  70,  25,  70,  25,  70,  25,  70,  25 },

    {  80,   9,  80,   9,  80,   9,  80,   9 },

    {  70,  87,  70,  87,  70,  87,  70,  87 },

    { -25,  57, -25,  57, -25,  57, -25,  57 },

    {  90,  43,  90,  43,  90,  43,  90,  43 },

    {  70, -43,  70, -43,  70, -43,  70, -43 },

    { -87,   9, -87,   9, -87,   9, -87,   9 },

    {  90,  25,  90,  25,  90,  25,  90,  25 },

    {  80,  57,  80,  57,  80,  57,  80,  57 },

    {  57, -80,  57, -80,  57, -80,  57, -80 },

    { -25,  90, -25,  90, -25,  90, -25,  90 },

    {   9,  87,   9,  87,   9,  87,   9,  87 },

    {  43,  70,  43,  70,  43,  70,  43,  70 },

    {  43, -90,  43, -90,  43, -90,  43, -90 },

    {  57,  25,  57,  25,  57,  25,  57,  25 },

    { -87,  70, -87,  70, -87,  70, -87,  70 },

    {   9, -80,   9, -80,   9, -80,   9, -80 },

    {  25, -70,  25, -70,  25, -70,  25, -70 },

    {  90, -80,  90, -80,  90, -80,  90, -80 },

    {  43,   9,  43,   9,  43,   9,  43,   9 },

    { -57,  87, -57,  87, -57,  87, -57,  87 },

    {   9, -25,   9, -25,   9, -25,   9, -25 },

    {  43, -57,  43, -57,  43, -57,  43, -57 },

    {  70, -80,  70, -80,  70, -80,  70, -80 },

    {  87, -90,  87, -90,  87, -90,  87, -90 },

};

const WORD16 g_ai2_ihevc_trans_32_intr_odd_packed[128][8] =
{
    /*o0*/
    {  90,  90,  90,  90,  90,  90,  90,  90 },
    {  88,  85,  88,  85,  88,  85,  88,  85 },
    {  82,  78,  82,  78,  82,  78,  82,  78 },
    {  73,  67,  73,  67,  73,  67,  73,  67 },
    {  61,  54,  61,  54,  61,  54,  61,  54 },
    {  46,  38,  46,  38,  46,  38,  46,  38 },
    {  31,  22,  31,  22,  31,  22,  31,  22 },
    {  13,   4,  13,   4,  13,   4,  13,   4 },

    /*o1*/

    {  90,  82,  90,  82,  90,  82,  90,  82 },
    {  67,  46,  67,  46,  67,  46,  67,  46 },
    { -22,   4, -22,   4, -22,   4, -22,   4 },
    {  31,  54,  31,  54,  31,  54,  31,  54 },
    {  73,  85,  73,  85,  73,  85,  73,  85 },
    {  90,  88,  90,  88,  90,  88,  90,  88 },
    {  78,  61,  78,  61,  78,  61,  78,  61 },
    {  38,  13,  38,  13,  38,  13,  38,  13 },

    /*o2*/
    {  88,  67,  88,  67,  88,  67,  88,  67 },
    { -31,  13, -31,  13, -31,  13, -31,  13 },
    {  54,  82,  54,  82,  54,  82,  54,  82 },
    {  90,  78,  90,  78,  90,  78,  90,  78 },
    {  46,   4,  46,   4,  46,   4,  46,   4 },
    {  38,  73,  38,  73,  38,  73,  38,  73 },
    {  90,  85,  90,  85,  90,  85,  90,  85 },
    {  61,  22,  61,  22,  61,  22,  61,  22 },

    /*o3*/
    {  85,  46,  85,  46,  85,  46,  85,  46 },
    {  13,  67,  13,  67,  13,  67,  13,  67 },
    {  90,  73,  90,  73,  90,  73,  90,  73 },
    {  22, -38,  22, -38,  22, -38,  22, -38 },
    {  82,  88,  82,  88,  82,  88,  82,  88 },
    { -54,   4, -54,   4, -54,   4, -54,   4 },
    {  61,  90,  61,  90,  61,  90,  61,  90 },
    {  78,  31,  78,  31,  78,  31,  78,  31 },

    /*o4*/
    { -82, -22, -82, -22, -82, -22, -82, -22 },
    {  54,  90,  54,  90,  54,  90,  54,  90 },
    {  61, -13,  61, -13,  61, -13,  61, -13 },
    { -78, -85, -78, -85, -78, -85, -78, -85 },
    { -31,  46, -31,  46, -31,  46, -31,  46 },
    {  90,  67,  90,  67,  90,  67,  90,  67 },
    {  -4, -73,  -4, -73,  -4, -73,  -4, -73 },
    { -88, -38, -88, -38, -88, -38, -88, -38 },

    /*o5*/
    { -78,   4, -78,   4, -78,   4, -78,   4 },
    {  82,  73,  82,  73,  82,  73,  82,  73 },
    { -13, -85, -13, -85, -13, -85, -13, -85 },
    { -67,  22, -67,  22, -67,  22, -67,  22 },
    {  88,  61,  88,  61,  88,  61,  88,  61 },
    { -31, -90, -31, -90, -31, -90, -31, -90 },
    { -54,  38, -54,  38, -54,  38, -54,  38 },
    {  90,  46,  90,  46,  90,  46,  90,  46 },

    /*o6*/
    { -73,  31, -73,  31, -73,  31, -73,  31 },
    {  90,  22,  90,  22,  90,  22,  90,  22 },
    { -78, -67, -78, -67, -78, -67, -78, -67 },
    {  38,  90,  38,  90,  38,  90,  38,  90 },
    {  13, -82,  13, -82,  13, -82,  13, -82 },
    { -61,  46, -61,  46, -61,  46, -61,  46 },
    {  88,   4,  88,   4,  88,   4,  88,   4 },
    { -85, -54, -85, -54, -85, -54, -85, -54 },

    /*o7*/
    { -67,  54, -67,  54, -67,  54, -67,  54 },
    {  78, -38,  78, -38,  78, -38,  78, -38 },
    { -85,  22, -85,  22, -85,  22, -85,  22 },
    {  90,  -4,  90,  -4,  90,  -4,  90,  -4 },
    { -90, -13, -90, -13, -90, -13, -90, -13 },
    {  88,  31,  88,  31,  88,  31,  88,  31 },
    { -82, -46, -82, -46, -82, -46, -82, -46 },
    {  73,  61,  73,  61,  73,  61,  73,  61 },

    /*o8*/
    { -61,  73, -61,  73, -61,  73, -61,  73 },
    {  46, -82,  46, -82,  46, -82,  46, -82 },
    { -31,  88, -31,  88, -31,  88, -31,  88 },
    {  13, -90,  13, -90,  13, -90,  13, -90 },
    {   4,  90,   4,  90,   4,  90,   4,  90 },
    { -22, -85, -22, -85, -22, -85, -22, -85 },
    {  38,  78,  38,  78,  38,  78,  38,  78 },
    { -54, -67, -54, -67, -54, -67, -54, -67 },

    /*o9*/
    { -54,  85, -54,  85, -54,  85, -54,  85 },
    {   4, -88,   4, -88,   4, -88,   4, -88 },
    {  46,  61,  46,  61,  46,  61,  46,  61 },
    { -82, -13, -82, -13, -82, -13, -82, -13 },
    {  90, -38,  90, -38,  90, -38,  90, -38 },
    { -67,  78, -67,  78, -67,  78, -67,  78 },
    {  22, -90,  22, -90,  22, -90,  22, -90 },
    {  31,  73,  31,  73,  31,  73,  31,  73 },

    /*o10*/
    { -46,  90, -46,  90, -46,  90, -46,  90 },
    { -38, -54, -38, -54, -38, -54, -38, -54 },
    {  90, -31,  90, -31,  90, -31,  90, -31 },
    { -61,  88, -61,  88, -61,  88, -61,  88 },
    { -22, -67, -22, -67, -22, -67, -22, -67 },
    {  85, -13,  85, -13,  85, -13,  85, -13 },
    { -73,  82, -73,  82, -73,  82, -73,  82 },
    {  -4, -78,  -4, -78,  -4, -78,  -4, -78 },

    /*o11*/
    { -38,  88, -38,  88, -38,  88, -38,  88 },
    { -73,   4, -73,   4, -73,   4, -73,   4 },
    {  67, -90,  67, -90,  67, -90,  67, -90 },
    {  46,  31,  46,  31,  46,  31,  46,  31 },
    { -85,  78, -85,  78, -85,  78, -85,  78 },
    { -13, -61, -13, -61, -13, -61, -13, -61 },
    {  90, -54,  90, -54,  90, -54,  90, -54 },
    { -22,  82, -22,  82, -22,  82, -22,  82 },


    /*012*/
    { -31,  78, -31,  78, -31,  78, -31,  78 },
    { -90,  61, -90,  61, -90,  61, -90,  61 },
    {  -4, -54,  -4, -54,  -4, -54,  -4, -54 },
    {  88, -82,  88, -82,  88, -82,  88, -82 },
    {  38,  22,  38,  22,  38,  22,  38,  22 },
    { -73,  90, -73,  90, -73,  90, -73,  90 },
    { -67,  13, -67,  13, -67,  13, -67,  13 },
    {  46, -85,  46, -85,  46, -85,  46, -85 },

    /*o13*/
    { -22,  61, -22,  61, -22,  61, -22,  61 },
    { -85,  90, -85,  90, -85,  90, -85,  90 },
    { -73,  38, -73,  38, -73,  38, -73,  38 },
    {   4, -46,   4, -46,   4, -46,   4, -46 },
    {  78, -90,  78, -90,  78, -90,  78, -90 },
    {  82, -54,  82, -54,  82, -54,  82, -54 },
    {  13,  31,  13,  31,  13,  31,  13,  31 },
    { -67,  88, -67,  88, -67,  88, -67,  88 },

    /*o14*/
    { -13,  38, -13,  38, -13,  38, -13,  38 },
    { -61,  78, -61,  78, -61,  78, -61,  78 },
    { -88,  90, -88,  90, -88,  90, -88,  90 },
    { -85,  73, -85,  73, -85,  73, -85,  73 },
    { -54,  31, -54,  31, -54,  31, -54,  31 },
    {  -4, -22,  -4, -22,  -4, -22,  -4, -22 },
    {  46, -67,  46, -67,  46, -67,  46, -67 },
    {  82, -90,  82, -90,  82, -90,  82, -90 },

    /*o15*/
    {  -4,  13,  -4,  13,  -4,  13,  -4,  13 },
    { -22,  31, -22,  31, -22,  31, -22,  31 },
    { -38,  46, -38,  46, -38,  46, -38,  46 },
    { -54,  61, -54,  61, -54,  61, -54,  61 },
    { -67,  73, -67,  73, -67,  73, -67,  73 },
    { -78,  82, -78,  82, -78,  82, -78,  82 },
    { -85,  88, -85,  88, -85,  88, -85,  88 },
    { -90,  90, -90,  90, -90,  90, -90,  90 },

};
const WORD16 g_ai2_ihevc_trans_16_even[12][8] =
{
    {  64,  64,  64,  64,  64,  64,  64,  64 },
    {  64, -64,  64, -64,  64, -64,  64, -64 },
    {  89,  75,  89,  75,  89,  75,  89,  75 },
    {  75, -18,  75, -18,  75, -18,  75, -18 },
    {  50,  18,  50,  18,  50,  18,  50,  18 },
    {  89,  50,  89,  50,  89,  50,  89,  50 },
    {  83,  36,  83,  36,  83,  36,  83,  36 },
    {  36, -83,  36, -83,  36, -83,  36, -83 },
    {  50, -89,  50, -89,  50, -89,  50, -89 },
    {  18, -50,  18, -50,  18, -50,  18, -50 },
    {  18,  75,  18,  75,  18,  75,  18,  75 },
    {  75, -89,  75, -89,  75, -89,  75, -89 },
};
const WORD16 g_ai2_ihevc_trans_16_odd[32][8] =
{
    {  90,  87,  90,  87,  90,  87,  90,  87 },
    {  80,  70,  80,  70,  80,  70,  80,  70 },
    {  57,  43,  57,  43,  57,  43,  57,  43 },
    {  25,   9,  25,   9,  25,   9,  25,   9 },
    {  87,  57,  87,  57,  87,  57,  87,  57 },
    {   9, -43,   9, -43,   9, -43,   9, -43 },
    {  80,  90,  80,  90,  80,  90,  80,  90 },
    {  70,  25,  70,  25,  70,  25,  70,  25 },
    {  80,   9,  80,   9,  80,   9,  80,   9 },
    {  70,  87,  70,  87,  70,  87,  70,  87 },
    {  25, -57,  25, -57,  25, -57,  25, -57 },
    {  90,  43,  90,  43,  90,  43,  90,  43 },
    {  70, -43,  70, -43,  70, -43,  70, -43 },
    {  87,  -9,  87,  -9,  87,  -9,  87,  -9 },
    {  90,  25,  90,  25,  90,  25,  90,  25 },
    {  80,  57,  80,  57,  80,  57,  80,  57 },
    {  57, -80,  57, -80,  57, -80,  57, -80 },
    {  25, -90,  25, -90,  25, -90,  25, -90 },
    {   9,  87,   9,  87,   9,  87,   9,  87 },
    {  43,  70,  43,  70,  43,  70,  43,  70 },
    {  43, -90,  43, -90,  43, -90,  43, -90 },
    {  57,  25,  57,  25,  57,  25,  57,  25 },
    {  87, -70,  87, -70,  87, -70,  87, -70 },
    {   9, -80,   9, -80,   9, -80,   9, -80 },
    {  25, -70,  25, -70,  25, -70,  25, -70 },
    {  90, -80,  90, -80,  90, -80,  90, -80 },
    {  43,   9,  43,   9,  43,   9,  43,   9 },
    {  57, -87,  57, -87,  57, -87,  57, -87 },
    {   9, -25,   9, -25,   9, -25,   9, -25 },
    {  43, -57,  43, -57,  43, -57,  43, -57 },
    {  70, -80,  70, -80,  70, -80,  70, -80 },
    {  87, -90,  87, -90,  87, -90,  87, -90 },
};
const WORD16 g_ai2_ihevc_trans_intr_even_8[4][8] =
{
    {  64,  64,  64,  64,  64,  64,  64,  64 },
    {  36, -83,  36, -83,  36, -83,  36, -83 },
    {  83,  36,  83,  36,  83,  36,  83,  36 },
    {  64, -64,  64, -64,  64, -64,  64, -64 }
};
const WORD16 g_ai2_ihevc_trans_intr_odd_8[8][8] =
{
    {  89,  75,  89,  75,  89,  75,  89,  75 },
    {  50,  18,  50,  18,  50,  18,  50,  18 },
    {  75, -18,  75, -18,  75, -18,  75, -18 },
    {  89,  50,  89,  50,  89,  50,  89,  50 },
    {  50, -89,  50, -89,  50, -89,  50, -89 },
    {  18,  75,  18,  75,  18,  75,  18,  75 },
    {  18, -50,  18, -50,  18, -50,  18, -50 },
    {  75, -89,  75, -89,  75, -89,  75, -89 },
};
const WORD16 g_ai2_ihevc_trans_intr_4[4][8] =
{
    {  83,  36,  83,  36,  83,  36,  83,  36 },
    {  36, -83,  36, -83,  36, -83,  36, -83 },
    {  64,  64,  64,  64,  64,  64,  64,  64 },
    {  64, -64,  64, -64,  64, -64,  64, -64 }
};

const UWORD8 IHEVCE_CHROMA_SHUFFLEMASK_HBD[8] = { 0x00, 0x01, 0x04, 0x05,
    0x08, 0x09, 0x0C, 0x0D };
#ifndef DISABLE_AVX2
const WORD32 g_ai4_ihevc_trans_8_intr_avx2[7][8] =
{ /* 4*32 = 128 bit */
    {  64,  64,  64,  64,  64,  64,  64,  64 },
    {  83,  83,  83,  83,  83,  83,  83,  83 },
    {  36,  36,  36,  36,  36,  36,  36,  36 },
    {  75,  75,  75,  75,  75,  75,  75,  75 },
    {  18,  18,  18,  18,  18,  18,  18,  18 },
    {  89,  89,  89,  89,  89,  89,  89,  89 },
    {  50,  50,  50,  50,  50,  50,  50,  50 },
};
const WORD16 g_ai2_ihevc_trans_8_intr_avx2[8][16] =
{ /* 4*32 = 128 bit */
    {  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64 },
    {  89,  75,  18,  50,  89,  75,  18,  50,  89,  75,  18,  50,  89,  75,  18,  50 },
    {  83,  36,  83,  36,  83,  36,  83,  36,  83,  36,  83,  36,  83,  36,  83,  36 },
    {  75, -18, -50, -89,  75, -18, -50, -89,  75, -18, -50, -89,  75, -18, -50, -89 },
    {  64, -64,  64, -64,  64, -64,  64, -64,  64, -64,  64, -64,  64, -64,  64, -64 },
    {  50, -89,  75,  18,  50, -89,  75,  18,  50, -89,  75,  18,  50, -89,  75,  18 },
    {  36, -83,  36, -83,  36, -83,  36, -83,  36, -83,  36, -83,  36, -83,  36, -83 },
    {  18, -50, -89,  75,  18, -50, -89,  75,  18, -50, -89,  75,  18, -50, -89,  75 }
};

const WORD32 g_ai2_ihevc_trans_32_intr_8_avx2[8][8] =
{ /* 4*32 = 128 bit */
    { 90, 90, 90, 90, 90, 90, 90, 90 },
    { 87, 87, 87, 87, 87, 87, 87, 87 },
    { 80, 80, 80, 80, 80, 80, 80, 80 },
    { 70, 70, 70, 70, 70, 70, 70, 70 },
    { 57, 57, 57, 57, 57, 57, 57, 57 },
    { 43, 43, 43, 43, 43, 43, 43, 43 },
    { 25, 25, 25, 25, 25, 25, 25, 25 },
    {  9,  9,  9,  9,  9,  9,  9,  9 }
};
const WORD32 g_ai2_ihevc_trans_32_intr_16_avx2[15][8] =
{ /* 4*32 = 128 bit */
    { 90, 90, 90, 90, 90, 90, 90, 90, },
    { 88, 88, 88, 88, 88, 88, 88, 88, },
    { 85, 85, 85, 85, 85, 85, 85, 85, },
    { 82, 82, 82, 82, 82, 82, 82, 82, },
    { 78, 78, 78, 78, 78, 78, 78, 78, },
    { 73, 73, 73, 73, 73, 73, 73, 73, },
    { 67, 67, 67, 67, 67, 67, 67, 67, },
    { 61, 61, 61, 61, 61, 61, 61, 61, },
    { 54, 54, 54, 54, 54, 54, 54, 54, },
    { 46, 46, 46, 46, 46, 46, 46, 46, },
    { 38, 38, 38, 38, 38, 38, 38, 38, },
    { 31, 31, 31, 31, 31, 31, 31, 31, },
    { 22, 22, 22, 22, 22, 22, 22, 22, },
    { 13, 13, 13, 13, 13, 13, 13, 13, },
    { 4,  4,  4,  4,  4,  4,  4,  4,  }
};
const WORD16 g_ai2_ihevc_trans_16_intr_odd_avx2[32][16] =
{
    {  90,  87,  90,  87,  90,  87,  90,  87,  90,  87,  90,  87,  90,  87,  90,  87 },
    {  70,  80,  70,  80,  70,  80,  70,  80,  70,  80,  70,  80,  70,  80,  70,  80 },
    {  57,  43,  57,  43,  57,  43,  57,  43,  57,  43,  57,  43,  57,  43,  57,  43 },
    {   9,  25,   9,  25,   9,  25,   9,  25,   9,  25,   9,  25,   9,  25,   9,  25 },
    {  87,  57,  87,  57,  87,  57,  87,  57,  87,  57,  87,  57,  87,  57,  87,  57 },
    { -43,   9, -43,   9, -43,   9, -43,   9, -43,   9, -43,   9, -43,   9, -43,   9 },
    { -80, -90, -80, -90, -80, -90, -80, -90, -80, -90, -80, -90, -80, -90, -80, -90 },
    { -25, -70, -25, -70, -25, -70, -25, -70, -25, -70, -25, -70, -25, -70, -25, -70 },
    {  80,   9,  80,   9,  80,   9,  80,   9,  80,   9,  80,   9,  80,   9,  80,   9 },
    { -87, -70, -87, -70, -87, -70, -87, -70, -87, -70, -87, -70, -87, -70, -87, -70 },
    { -25,  57, -25,  57, -25,  57, -25,  57, -25,  57, -25,  57, -25,  57, -25,  57 },
    {  43,  90,  43,  90,  43,  90,  43,  90,  43,  90,  43,  90,  43,  90,  43,  90 },
    {  70, -43,  70, -43,  70, -43,  70, -43,  70, -43,  70, -43,  70, -43,  70, -43 },
    {   9, -87,   9, -87,   9, -87,   9, -87,   9, -87,   9, -87,   9, -87,   9, -87 },
    {  90,  25,  90,  25,  90,  25,  90,  25,  90,  25,  90,  25,  90,  25,  90,  25 },
    { -57, -80, -57, -80, -57, -80, -57, -80, -57, -80, -57, -80, -57, -80, -57, -80 },
    {  57, -80,  57, -80,  57, -80,  57, -80,  57, -80,  57, -80,  57, -80,  57, -80 },
    {  90, -25,  90, -25,  90, -25,  90, -25,  90, -25,  90, -25,  90, -25,  90, -25 },
    {  -9, -87,  -9, -87,  -9, -87,  -9, -87,  -9, -87,  -9, -87,  -9, -87,  -9, -87 },
    {  70,  43,  70,  43,  70,  43,  70,  43,  70,  43,  70,  43,  70,  43,  70,  43 },
    {  43, -90,  43, -90,  43, -90,  43, -90,  43, -90,  43, -90,  43, -90,  43, -90 },
    {  25,  57,  25,  57,  25,  57,  25,  57,  25,  57,  25,  57,  25,  57,  25,  57 },
    { -87,  70, -87,  70, -87,  70, -87,  70, -87,  70, -87,  70, -87,  70, -87,  70 },
    { -80,   9, -80,   9, -80,   9, -80,   9, -80,   9, -80,   9, -80,   9, -80,   9 },
    {  25, -70,  25, -70,  25, -70,  25, -70,  25, -70,  25, -70,  25, -70,  25, -70 },
    { -80,  90, -80,  90, -80,  90, -80,  90, -80,  90, -80,  90, -80,  90, -80,  90 },
    {  43,   9,  43,   9,  43,   9,  43,   9,  43,   9,  43,   9,  43,   9,  43,   9 },
    {  87, -57,  87, -57,  87, -57,  87, -57,  87, -57,  87, -57,  87, -57,  87, -57 },
    {   9, -25,   9, -25,   9, -25,   9, -25,   9, -25,   9, -25,   9, -25,   9, -25 },
    { -57,  43, -57,  43, -57,  43, -57,  43, -57,  43, -57,  43, -57,  43, -57,  43 },
    {  70, -80,  70, -80,  70, -80,  70, -80,  70, -80,  70, -80,  70, -80,  70, -80 },
    { -90,  87, -90,  87, -90,  87, -90,  87, -90,  87, -90,  87, -90,  87, -90,  87 }
};

const WORD16 g_ai2_ihevc_trans_16_intr_even_avx2[12][16] =
{
    {  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64,  64 },
    {  89,  75,  89,  75,  89,  75,  89,  75,  89,  75,  89,  75,  89,  75,  89,  75 },
    {  18,  50,  18,  50,  18,  50,  18,  50,  18,  50,  18,  50,  18,  50,  18,  50 },
    {  83,  36,  83,  36,  83,  36,  83,  36,  83,  36,  83,  36,  83,  36,  83,  36 },
    {  75, -18,  75, -18,  75, -18,  75, -18,  75, -18,  75, -18,  75, -18,  75, -18 },
    { -50, -89, -50, -89, -50, -89, -50, -89, -50, -89, -50, -89, -50, -89, -50, -89 },
    {  64, -64,  64, -64,  64, -64,  64, -64,  64, -64,  64, -64,  64, -64,  64, -64 },
    {  50, -89,  50, -89,  50, -89,  50, -89,  50, -89,  50, -89,  50, -89,  50, -89 },
    {  75,  18,  75,  18,  75,  18,  75,  18,  75,  18,  75,  18,  75,  18,  75,  18 },
    {  36, -83,  36, -83,  36, -83,  36, -83,  36, -83,  36, -83,  36, -83,  36, -83 },
    {  18, -50,  18, -50,  18, -50,  18, -50,  18, -50,  18, -50,  18, -50,  18, -50 },
    { -89,  75, -89,  75, -89,  75, -89,  75, -89,  75, -89,  75, -89,  75, -89,  75 }
};


#endif