1/******************************************************************************
2*
3* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore
4*
5* Licensed under the Apache License, Version 2.0 (the "License");
6* you may not use this file except in compliance with the License.
7* You may obtain a copy of the License at:
8*
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Unless required by applicable law or agreed to in writing, software
12* distributed under the License is distributed on an "AS IS" BASIS,
13* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14* See the License for the specific language governing permissions and
15* limitations under the License.
16*
17******************************************************************************/
18/**
19*******************************************************************************
20* @file
21*  ihevc_tables_x86_intr.c
22*
23* @brief
24*  Contains function Definition for intra prediction  interpolation filters
25*
26*
27* @author
28*  Rishab
29*
30* @par List of Functions:
31
32* @remarks
33*  None
34*
35*******************************************************************************
36*/
37
38
39/*****************************************************************************/
40/* File Includes                                                             */
41/*****************************************************************************/
42
43#include "ihevc_typedefs.h"
44#include "ihevc_platform_macros.h"
45#include "ihevc_macros.h"
46#include "ihevc_func_selector.h"
47#include "ihevc_defs.h"
48#include "ihevc_mem_fns.h"
49#include "ihevc_tables_x86_intr.h"
50
51// LUMA INTRA PRED
52const UWORD8 IHEVCE_SHUFFLEMASKY1[16] = { 0x03, 0x02, 0x01, 0x00,
53    0x02, 0x03, 0x03, 0x04,
54    0x08, 0x08, 0x08, 0x08,
55    0x08, 0x08, 0x08, 0x08 };
56
57const UWORD8 IHEVCE_SHUFFLEMASKY2[16] = { 0x07, 0x06, 0x05, 0x04,
58    0x03, 0x02, 0x01, 0x00,
59    0x08, 0x08, 0x08, 0x08,
60    0x08, 0x08, 0x08, 0x08 };
61
62const UWORD8 IHEVCE_SHUFFLEMASKY3[16] = { 0x0f, 0x0e, 0x0d, 0x0c,
63    0x0b, 0x0a, 0x09, 0x08,
64    0x07, 0x06, 0x05, 0x04,
65    0x03, 0x02, 0x01, 0x00 };
66
67const UWORD8 IHEVCE_SHUFFLEMASK4[16] = { 0x00, 0x00, 0x00, 0x00,
68    0x00, 0x00, 0x00, 0x00,
69    0x00, 0x00, 0x00, 0x00,
70    0x00, 0x00, 0x00, 0x00 };
71
72const UWORD8 IHEVCE_SHUFFLEMASK5[16] = { 0x00, 0x01, 0x08, 0x09,
73    0x0f, 0x0f, 0x0f, 0x0f,
74    0x0f, 0x0f, 0x0f, 0x0f,
75    0x0f, 0x0f, 0x0f, 0x0f };
76/// CHROMA INTRA PRED
77const UWORD8 IHEVCE_SHUFFLEMASKY7[16] = { 0x06, 0x07, 0x04, 0x05,
78    0x02, 0x03, 0x00, 0x01,
79    0x08, 0x08, 0x08, 0x08,
80    0x08, 0x08, 0x08, 0x08 };
81
82const UWORD8 IHEVCE_SHUFFLEMASKY8[16] = { 0x0e, 0x0f, 0x0c, 0x0d,
83    0x0a, 0x0b, 0x08, 0x09,
84    0x06, 0x07, 0x04, 0x05,
85    0x02, 0x03, 0x00, 0x01 };
86
87const UWORD8 IHEVCE_SHUFFLEMASKY9[16] = { 0x00, 0x01, 0x04, 0x05,
88    0x08, 0x09, 0x0c, 0x0d,
89    0x02, 0x03, 0x06, 0x07,
90    0x0a, 0x0b, 0x0e, 0x0f };
91
92const UWORD8 IHEVCE_SHUFFLEMASKY11[16] = { 0x01, 0x00, 0x02, 0x01,
93    0x03, 0x02, 0x04, 0x03,
94    0x05, 0x04, 0x06, 0x05,
95    0x07, 0x06, 0x08, 0x07 };
96//INTRAPRED
97const UWORD8 inv_angle_shuffle[7][32] =
98{
99    { 3, 0x80, 0x80, 0x80, 1, 2, 4, 5, 6, 7, 9, 10, 11, 12, 14, 15, 0x80, 0x80, 0x80, 0, 1, 2, 4, 5, 6, 7, 9, 10, 11, 12, 14, 15 },
100    { 6, 0x80, 0x80, 0x80, 0x80, 0x80, 2, 3, 5, 6, 8, 9, 11, 12, 14, 15, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 1, 2, 4, 5, 7, 8, 10, 11, 13, 14 },
101    { 8, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 2, 4, 6, 8, 9, 11, 13, 15, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 1, 3, 5, 7, 8, 10, 12, 14 },
102    { 10, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 2, 5, 7, 10, 12, 15, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 1, 4, 6, 9, 11, 14 },
103    { 12, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 4, 7, 11, 14, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 2, 5, 9, 12 },
104    { 14, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 6, 13, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 3, 10 },
105    { 15, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0 }
106};
107
108/// DEBLOCK TABLES
109const WORD8 coef_d[16] = { 0, 1, -2, 1, 1, -2, 1, 0, 0, 1, -2, 1, 1, -2, 1, 0 };
110const WORD8 coef_de1[16] = { 3, -9, 9, -3, 3, -9, 9, -3, 3, -9, 9, -3, 3, -9, 9, -3 };
111const WORD8 coef_dep1[16] = { -2, 1, 1, -2, -2, 1, 1, -2, -2, 1, 1, -2, -2, 1, 1, -2 };
112const WORD32 shuffle_d[4] = { 0x80800403, 0x80800c0b, 0x03000704, 0x0b080f0c };
113const WORD32 shuffle0[2] = { 0x80098001, 0x800e8006 };
114const WORD32 shuffle1[4] = { 0x05040100, 0x0d0c0908, 0x07060302, 0x0f0e0b0a };
115const WORD32 shuffle2[4] = { 0x80808080, 0x03020100, 0x07060504, 0x80808080 };
116const WORD32 shuffle3[4] = { 0x80808080, 0x0b0a0908, 0x0f0e0d0c, 0x80808080 };
117
118const WORD8 delta0[16] =  { 1, -4, 1, -4, 1, -4, 1, -4, 1, -4, 1, -4, 1, -4, 1, -4 };
119const WORD8 delta1[16] =  { 4, -1, 4, -1, 4, -1, 4, -1, 4, -1, 4, -1, 4, -1, 4, -1 };
120const WORD32 shuffle_uv[4] = { 0x03010200, 0x0b090a08, 0x07050604, 0x0f0d0e0c };
121