xref: /aosp_15_r20/external/libavc/decoder/ih264d_tables.h (revision 495ae853bb871d1e5a258cb02c2cc13cde8ddb9a)
1*495ae853SAndroid Build Coastguard Worker /******************************************************************************
2*495ae853SAndroid Build Coastguard Worker  *
3*495ae853SAndroid Build Coastguard Worker  * Copyright (C) 2015 The Android Open Source Project
4*495ae853SAndroid Build Coastguard Worker  *
5*495ae853SAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
6*495ae853SAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
7*495ae853SAndroid Build Coastguard Worker  * You may obtain a copy of the License at:
8*495ae853SAndroid Build Coastguard Worker  *
9*495ae853SAndroid Build Coastguard Worker  * http://www.apache.org/licenses/LICENSE-2.0
10*495ae853SAndroid Build Coastguard Worker  *
11*495ae853SAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
12*495ae853SAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
13*495ae853SAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*495ae853SAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
15*495ae853SAndroid Build Coastguard Worker  * limitations under the License.
16*495ae853SAndroid Build Coastguard Worker  *
17*495ae853SAndroid Build Coastguard Worker  *****************************************************************************
18*495ae853SAndroid Build Coastguard Worker  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19*495ae853SAndroid Build Coastguard Worker */
20*495ae853SAndroid Build Coastguard Worker 
21*495ae853SAndroid Build Coastguard Worker #ifndef  _IH264D_TABLES_H_
22*495ae853SAndroid Build Coastguard Worker #define  _IH264D_TABLES_H_
23*495ae853SAndroid Build Coastguard Worker 
24*495ae853SAndroid Build Coastguard Worker /**
25*495ae853SAndroid Build Coastguard Worker  **************************************************************************
26*495ae853SAndroid Build Coastguard Worker  * \file ih264d_tables.h
27*495ae853SAndroid Build Coastguard Worker  *
28*495ae853SAndroid Build Coastguard Worker  * \brief
29*495ae853SAndroid Build Coastguard Worker  *    Declaration of all tables used by h264 decoder
30*495ae853SAndroid Build Coastguard Worker  *
31*495ae853SAndroid Build Coastguard Worker  * \date
32*495ae853SAndroid Build Coastguard Worker  *    17/09/2004
33*495ae853SAndroid Build Coastguard Worker  *
34*495ae853SAndroid Build Coastguard Worker  * \author  MA
35*495ae853SAndroid Build Coastguard Worker  **************************************************************************
36*495ae853SAndroid Build Coastguard Worker  */
37*495ae853SAndroid Build Coastguard Worker #include "ih264_typedefs.h"
38*495ae853SAndroid Build Coastguard Worker #include "ih264_macros.h"
39*495ae853SAndroid Build Coastguard Worker #include "ih264_platform_macros.h"
40*495ae853SAndroid Build Coastguard Worker #include "ih264d_cabac.h"
41*495ae853SAndroid Build Coastguard Worker 
42*495ae853SAndroid Build Coastguard Worker /*Deblocking Table declaration*/
43*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_qp_scale_cr[];
44*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_alpha_table[];
45*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_clip_table_deblock[];
46*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_beta_table[];
47*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_clip_table[][4];
48*495ae853SAndroid Build Coastguard Worker 
49*495ae853SAndroid Build Coastguard Worker /*Parsing Table declaration*/
50*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_cbp_tab[6];
51*495ae853SAndroid Build Coastguard Worker extern const UWORD32 gau4_ih264d_packed_bs2[32];
52*495ae853SAndroid Build Coastguard Worker extern const UWORD16 gau2_ih264d_4x4_v2h_reorder[16];
53*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_subblk_offset[16];
54*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_cbp_table[48][2];
55*495ae853SAndroid Build Coastguard Worker 
56*495ae853SAndroid Build Coastguard Worker /*Decode Slice Table declaration*/
57*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_inv_scan[16];
58*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_inv_scan_fld[16];
59*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_dequant_matrix[6][16];
60*495ae853SAndroid Build Coastguard Worker extern const UWORD16 gau2_ih264_iquant_scale_4x4[6][16];
61*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_dequant8x8_zigzag_cavlc[4][6][16];
62*495ae853SAndroid Build Coastguard Worker extern const UWORD16 gau1_ih264d_dequant8x8_cavlc[6][64];
63*495ae853SAndroid Build Coastguard Worker 
64*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_inv_scan_prog8x8_cavlc[4][16];
65*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_inv_scan_int8x8_cavlc[4][16];
66*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_inv_scan_prog8x8_cabac[64];
67*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_inv_scan_int8x8_cabac[64];
68*495ae853SAndroid Build Coastguard Worker 
69*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_lastcoeff_context_inc[64];
70*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_sigcoeff_context_inc_frame[64];
71*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_sigcoeff_context_inc_field[64];
72*495ae853SAndroid Build Coastguard Worker 
73*495ae853SAndroid Build Coastguard Worker /* scaling related table declaration */
74*495ae853SAndroid Build Coastguard Worker extern const WORD16 gai2_ih264d_default_intra4x4[16];
75*495ae853SAndroid Build Coastguard Worker extern const WORD16 gai2_ih264d_default_inter4x4[16];
76*495ae853SAndroid Build Coastguard Worker extern const WORD16 gai2_ih264d_default_intra8x8[64];
77*495ae853SAndroid Build Coastguard Worker extern const WORD16 gai2_ih264d_default_inter8x8[64];
78*495ae853SAndroid Build Coastguard Worker extern const WORD16 gai2_ih264d_flat_4x4[16];
79*495ae853SAndroid Build Coastguard Worker extern const WORD16 gai2_ih264d_flat_8x8[64];
80*495ae853SAndroid Build Coastguard Worker 
81*495ae853SAndroid Build Coastguard Worker /*Decode MV Table declaration*/
82*495ae853SAndroid Build Coastguard Worker extern const WORD8 gau1_ih264d_mv_pred_condition[];
83*495ae853SAndroid Build Coastguard Worker 
84*495ae853SAndroid Build Coastguard Worker /** Number of subMbs for the 8x8 prediction mode */
85*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_num_submb_part[];
86*495ae853SAndroid Build Coastguard Worker 
87*495ae853SAndroid Build Coastguard Worker /** Width of the 8x8 prediction mode in terms of subMbs */
88*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_submb_partw[];
89*495ae853SAndroid Build Coastguard Worker 
90*495ae853SAndroid Build Coastguard Worker /** Height of the 8x8 prediction mode in terms of subMbs */
91*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_submb_parth[];
92*495ae853SAndroid Build Coastguard Worker 
93*495ae853SAndroid Build Coastguard Worker /** Number of MB partitions for the MB prediction mode */
94*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_num_mb_part[];
95*495ae853SAndroid Build Coastguard Worker 
96*495ae853SAndroid Build Coastguard Worker /** Width of the MB partition in terms of subMbs */
97*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_mb_partw[];
98*495ae853SAndroid Build Coastguard Worker 
99*495ae853SAndroid Build Coastguard Worker /** Height of the MB partition in terms of subMbs */
100*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_mb_parth[];
101*495ae853SAndroid Build Coastguard Worker 
102*495ae853SAndroid Build Coastguard Worker /** MB partition information is packed into a UWORD32 {0,number,width,height} */
103*495ae853SAndroid Build Coastguard Worker extern const UWORD32 gau4_ih264d_submb_part[];
104*495ae853SAndroid Build Coastguard Worker 
105*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_submb_indx_mod[];
106*495ae853SAndroid Build Coastguard Worker 
107*495ae853SAndroid Build Coastguard Worker /** This table is used to assign CBPs to Inter MBs. */
108*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_cbp_inter[];
109*495ae853SAndroid Build Coastguard Worker 
110*495ae853SAndroid Build Coastguard Worker /** Motion comp modes for P followed by B,
111*495ae853SAndroid Build Coastguard Worker  0 to 4   : P Mbs
112*495ae853SAndroid Build Coastguard Worker  5 to 27  : B Mbs
113*495ae853SAndroid Build Coastguard Worker  28 to 30 : DIRECT */
114*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_mb_mc_mode[];
115*495ae853SAndroid Build Coastguard Worker 
116*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_submb_mc_mode[];
117*495ae853SAndroid Build Coastguard Worker 
118*495ae853SAndroid Build Coastguard Worker /** Sub MB pred modes for B slice */
119*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_submb_pred_modes[];
120*495ae853SAndroid Build Coastguard Worker 
121*495ae853SAndroid Build Coastguard Worker /** MB pred modes for P and B slice */
122*495ae853SAndroid Build Coastguard Worker extern const WORD8 gau1_ih264d_mb_pred_modes[2][32];
123*495ae853SAndroid Build Coastguard Worker 
124*495ae853SAndroid Build Coastguard Worker /*Decode CAVLC Table declaration*/
125*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_table_total_zero_2to10[9][64];
126*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_table_total_zero_11to15[5][16];
127*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_table_run_before[64];
128*495ae853SAndroid Build Coastguard Worker extern const UWORD16 gau2_ih264d_code_gx[304];
129*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_cav_chromdc_vld[256];
130*495ae853SAndroid Build Coastguard Worker extern const UWORD16 gau2_ih264d_offset_num_vlc_tab[9];
131*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_total_coeff_fn_ptr_offset[16];
132*495ae853SAndroid Build Coastguard Worker extern const WORD16 gai2_ih264d_trailing_one_level[14][3];
133*495ae853SAndroid Build Coastguard Worker 
134*495ae853SAndroid Build Coastguard Worker /*Decode CABAC Table declaration*/
135*495ae853SAndroid Build Coastguard Worker extern const UWORD32 gau4_ih264d_cabac_table[128][4];
136*495ae853SAndroid Build Coastguard Worker 
137*495ae853SAndroid Build Coastguard Worker /****************************************************************************/
138*495ae853SAndroid Build Coastguard Worker /*             For error detection in intra pred4x4 modes                   */
139*495ae853SAndroid Build Coastguard Worker /****************************************************************************/
140*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_intra_pred_err_code[9];
141*495ae853SAndroid Build Coastguard Worker 
142*495ae853SAndroid Build Coastguard Worker /*****************************************************************************/
143*495ae853SAndroid Build Coastguard Worker /* Cabac tables for context initialization depending upon type of Slice,     */
144*495ae853SAndroid Build Coastguard Worker /* cabac init Idc value and Qp.                                              */
145*495ae853SAndroid Build Coastguard Worker /*****************************************************************************/
146*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_cabac_ctxt_init_table[NUM_CAB_INIT_IDC_PLUS_ONE][QP_RANGE][NUM_CABAC_CTXTS];
147*495ae853SAndroid Build Coastguard Worker 
148*495ae853SAndroid Build Coastguard Worker /*****************************************************************************/
149*495ae853SAndroid Build Coastguard Worker /* SEI tables for field usge and which field first                           */
150*495ae853SAndroid Build Coastguard Worker /*****************************************************************************/
151*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_sei_fld_usage[9][3];
152*495ae853SAndroid Build Coastguard Worker 
153*495ae853SAndroid Build Coastguard Worker 
154*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_top_left_mb_part_indx_mod[];
155*495ae853SAndroid Build Coastguard Worker extern const UWORD8 gau1_ih264d_submb_indx_mod_sp_drct[];
156*495ae853SAndroid Build Coastguard Worker 
157*495ae853SAndroid Build Coastguard Worker #endif /*TABLES_H*/
158