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