Hamsalekha S | 8d3d303 | 2015-03-13 21:24:58 +0530 | [diff] [blame] | 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 | /** |
| 22 | ************************************************************************** |
| 23 | * \file ih264d_tables.c |
| 24 | * |
| 25 | * \brief |
| 26 | * Defination of all tables used by h264 decoder |
| 27 | * |
| 28 | * \date |
| 29 | * 17/09/2004 |
| 30 | * |
| 31 | * \author MA |
| 32 | ************************************************************************** |
| 33 | */ |
| 34 | #include "ih264_typedefs.h" |
| 35 | #include "ih264_macros.h" |
| 36 | #include "ih264_platform_macros.h" |
| 37 | #include "ih264d_defs.h" |
Hamsalekha S | caab4fe | 2015-05-07 16:38:07 +0530 | [diff] [blame] | 38 | #include "ih264d_tables.h" |
Hamsalekha S | 8d3d303 | 2015-03-13 21:24:58 +0530 | [diff] [blame] | 39 | |
| 40 | const UWORD8 gau1_ih264d_qp_scale_cr[] = |
| 41 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, |
| 42 | 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, |
| 43 | 29, 30, 31, 32, 32, 33, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 38, |
| 44 | 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39 }; |
| 45 | const UWORD8 gau1_ih264d_alpha_table[] = |
| 46 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 47 | 0, 0, 0, 4, 4, 5, 6, 7, 8, 9, 10, 12, 13, 15, 17, 20, 22, 25, 28, 32, 36, |
| 48 | 40, 45, 50, 56, 63, 71, 80, 90, 101, 113, 127, 144, 162, 182, 203, 226, |
| 49 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }; |
| 50 | const UWORD8 gau1_ih264d_beta_table[] = |
| 51 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 52 | 0, 0, 0, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, |
| 53 | 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18, |
| 54 | 18, 18, 18, 18, 18, 18, 18, 18, 18 }; |
| 55 | |
| 56 | const UWORD8 gau1_ih264d_clip_table[][4] = |
| 57 | { |
| 58 | { 0, 0, 0, 0 }, |
| 59 | { 0, 0, 0, 0 }, |
| 60 | { 0, 0, 0, 0 }, |
| 61 | { 0, 0, 0, 0 }, |
| 62 | { 0, 0, 0, 0 }, |
| 63 | { 0, 0, 0, 0 }, |
| 64 | { 0, 0, 0, 0 }, |
| 65 | { 0, 0, 0, 0 }, |
| 66 | { 0, 0, 0, 0 }, |
| 67 | { 0, 0, 0, 0 }, |
| 68 | { 0, 0, 0, 0 }, |
| 69 | { 0, 0, 0, 0 }, |
| 70 | |
| 71 | { 0, 0, 0, 0 }, |
| 72 | { 0, 0, 0, 0 }, |
| 73 | { 0, 0, 0, 0 }, |
| 74 | { 0, 0, 0, 0 }, |
| 75 | { 0, 0, 0, 0 }, |
| 76 | { 0, 0, 0, 0 }, |
| 77 | { 0, 0, 0, 0 }, |
| 78 | { 0, 0, 0, 0 }, |
| 79 | { 0, 0, 0, 0 }, |
| 80 | { 0, 0, 0, 0 }, |
| 81 | { 0, 0, 0, 0 }, |
| 82 | { 0, 0, 0, 0 }, |
| 83 | { 0, 0, 0, 0 }, |
| 84 | { 0, 0, 0, 0 }, |
| 85 | { 0, 0, 0, 0 }, |
| 86 | { 0, 0, 0, 0 }, |
| 87 | { 0, 0, 0, 0 }, |
| 88 | { 0, 0, 0, 1 }, |
| 89 | { 0, 0, 0, 1 }, |
| 90 | { 0, 0, 0, 1 }, |
| 91 | { 0, 0, 0, 1 }, |
| 92 | { 0, 0, 1, 1 }, |
| 93 | { 0, 0, 1, 1 }, |
| 94 | { 0, 1, 1, 1 }, |
| 95 | { 0, 1, 1, 1 }, |
| 96 | { 0, 1, 1, 1 }, |
| 97 | { 0, 1, 1, 1 }, |
| 98 | { 0, 1, 1, 2 }, |
| 99 | { 0, 1, 1, 2 }, |
| 100 | { 0, 1, 1, 2 }, |
| 101 | { 0, 1, 1, 2 }, |
| 102 | { 0, 1, 2, 3 }, |
| 103 | { 0, 1, 2, 3 }, |
| 104 | { 0, 2, 2, 3 }, |
| 105 | { 0, 2, 2, 4 }, |
| 106 | { 0, 2, 3, 4 }, |
| 107 | { 0, 2, 3, 4 }, |
| 108 | { 0, 3, 3, 5 }, |
| 109 | { 0, 3, 4, 6 }, |
| 110 | { 0, 3, 4, 6 }, |
| 111 | { 0, 4, 5, 7 }, |
| 112 | { 0, 4, 5, 8 }, |
| 113 | { 0, 4, 6, 9 }, |
| 114 | { 0, 5, 7, 10 }, |
| 115 | { 0, 6, 8, 11 }, |
| 116 | { 0, 6, 8, 13 }, |
| 117 | { 0, 7, 10, 14 }, |
| 118 | { 0, 8, 11, 16 }, |
| 119 | { 0, 9, 12, 18 }, |
| 120 | { 0, 10, 13, 20 }, |
| 121 | { 0, 11, 15, 23 }, |
| 122 | { 0, 13, 17, 25 }, |
| 123 | |
| 124 | { 0, 13, 17, 25 }, |
| 125 | { 0, 13, 17, 25 }, |
| 126 | { 0, 13, 17, 25 }, |
| 127 | { 0, 13, 17, 25 }, |
| 128 | { 0, 13, 17, 25 }, |
| 129 | { 0, 13, 17, 25 }, |
| 130 | { 0, 13, 17, 25 }, |
| 131 | { 0, 13, 17, 25 }, |
| 132 | { 0, 13, 17, 25 }, |
| 133 | { 0, 13, 17, 25 }, |
| 134 | { 0, 13, 17, 25 }, |
| 135 | { 0, 13, 17, 25 }, |
| 136 | { 0, 13, 17, 25 }, |
| 137 | { 0, 13, 17, 25 }, |
| 138 | { 0, 13, 17, 25 }, |
| 139 | { 0, 13, 17, 25 }, |
| 140 | { 0, 13, 17, 25 }, |
| 141 | { 0, 13, 17, 25 }, |
| 142 | { 0, 13, 17, 25 }, |
| 143 | { 0, 13, 17, 25 }, |
| 144 | { 0, 13, 17, 25 }, |
| 145 | { 0, 13, 17, 25 }, |
| 146 | { 0, 13, 17, 25 }, |
| 147 | { 0, 13, 17, 25 } |
| 148 | |
| 149 | }; |
| 150 | const UWORD8 gau1_ih264d_clip_table_deblock[] = |
| 151 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, |
| 152 | 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, |
| 153 | 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, |
| 154 | 48, 49, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51 }; |
| 155 | |
| 156 | /****************DEBLOCKING TABLES ENDS*******************/ |
| 157 | |
| 158 | /*************************************************************/ |
| 159 | /* BS CALCULATION TABLES */ |
| 160 | /*************************************************************/ |
| 161 | UWORD32 const gau4_ih264d_packed_bs2[32] = |
| 162 | { |
| 163 | /*************************************************************/ |
| 164 | /* BS TABLES FOR NORMAL EDGES */ |
| 165 | /*************************************************************/ |
| 166 | 0x00000000, |
| 167 | 0x02000000, 0x00020000, 0x02020000, 0x00000200, 0x02000200, 0x00020200, |
| 168 | 0x02020200, 0x00000002, 0x02000002, 0x00020002, 0x02020002, 0x00000202, |
| 169 | 0x02000202, 0x00020202, 0x02020202, |
| 170 | |
| 171 | /*************************************************************/ |
| 172 | /* BS TABLES FOR XTRA LEFT MB EDGES IN MBAFF CASE */ |
| 173 | /*************************************************************/ |
| 174 | 0x01010101, |
| 175 | 0x02010101, 0x01020101, 0x02020101, 0x01010201, 0x02010201, 0x01020201, |
| 176 | 0x02020201, 0x01010102, 0x02010102, 0x01020102, 0x02020102, 0x01010202, |
| 177 | 0x02010202, 0x01020202, 0x02020202, }; |
| 178 | |
| 179 | UWORD16 const gau2_ih264d_4x4_v2h_reorder[16] = |
| 180 | { 0x0000, 0x0001, 0x0010, 0x0011, 0x0100, 0x0101, 0x0110, 0x0111, 0x1000, |
| 181 | 0x1001, 0x1010, 0x1011, 0x1100, 0x1101, 0x1110, 0x1111 }; |
| 182 | |
| 183 | /****************SCALING TABLES STARTS *****************/ |
| 184 | const WORD16 gai2_ih264d_default_intra4x4[16] = |
| 185 | { 6, 13, 13, 20, 20, 20, 28, 28, 28, 28, 32, 32, 32, 37, 37, 42 }; |
| 186 | |
| 187 | const WORD16 gai2_ih264d_default_inter4x4[16] = |
| 188 | { 10, 14, 14, 20, 20, 20, 24, 24, 24, 24, 27, 27, 27, 30, 30, 34 }; |
| 189 | |
| 190 | const WORD16 gai2_ih264d_default_intra8x8[64] = |
| 191 | { 6, 10, 10, 13, 11, 13, 16, 16, 16, 16, 18, 18, 18, 18, 18, 23, 23, 23, 23, |
| 192 | 23, 23, 25, 25, 25, 25, 25, 25, 25, 27, 27, 27, 27, 27, 27, 27, 27, 29, |
| 193 | 29, 29, 29, 29, 29, 29, 31, 31, 31, 31, 31, 31, 33, 33, 33, 33, 33, 36, |
| 194 | 36, 36, 36, 38, 38, 38, 40, 40, 42 }; |
| 195 | |
| 196 | const WORD16 gai2_ih264d_default_inter8x8[64] = |
| 197 | { 9, 13, 13, 15, 13, 15, 17, 17, 17, 17, 19, 19, 19, 19, 19, 21, 21, 21, 21, |
| 198 | 21, 21, 22, 22, 22, 22, 22, 22, 22, 24, 24, 24, 24, 24, 24, 24, 24, 25, |
| 199 | 25, 25, 25, 25, 25, 25, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 30, |
| 200 | 30, 30, 30, 32, 32, 32, 33, 33, 35 }; |
| 201 | |
| 202 | const WORD16 gai2_ih264d_flat_4x4[16] = |
| 203 | { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 }; |
| 204 | |
| 205 | const WORD16 gai2_ih264d_flat_8x8[64] = |
| 206 | { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, |
| 207 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, |
| 208 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, |
| 209 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 }; |
| 210 | |
| 211 | /****************SCALING TABLES ENDS *****************/ |
| 212 | |
| 213 | /*Inverse scan tables for individual 4x4 blocks of 8x8 transform coeffs of CAVLC */ |
| 214 | |
| 215 | /* progressive */ |
| 216 | |
| 217 | const UWORD8 gau1_ih264d_inv_scan_prog8x8_cavlc[4][16] = |
| 218 | { |
| 219 | { 0, 9, 17, 18, 12, 40, 27, 7, 35, 57, 29, 30, 58, 38, 53, 47 }, /* for First subblock */ |
| 220 | { 1, 2, 24, 11, 19, 48, 20, 14, 42, 50, 22, 37, 59, 31, 60, 55 }, /* for second subblock */ |
| 221 | { 8, 3, 32, 4, 26, 41, 13, 21, 49, 43, 15, 44, 52, 39, 61, 62 }, /* for third subblock */ |
| 222 | { 16, 10, 25, 5, 33, 34, 6, 28, 56, 36, 23, 51, 45, 46, 54, 63 } /* for fourth subblock */ |
| 223 | }; |
| 224 | |
| 225 | const UWORD8 gau1_ih264d_inv_scan_int8x8_cavlc[4][16] = |
| 226 | { |
| 227 | { 0, 9, 2, 56, 18, 26, 34, 27, 35, 28, 36, 29, 45, 7, 54, 39 }, /* for First subblock */ |
| 228 | { 8, 24, 25, 33, 41, 11, 42, 12, 43, 13, 44, 14, 53, 15, 62, 47 }, /* for second subblock */ |
| 229 | { 16, 32, 40, 10, 49, 4, 50, 5, 51, 6, 52, 22, 61, 38, 23, 55 }, /* for third subblock */ |
| 230 | { 1, 17, 48, 3, 57, 19, 58, 20, 59, 21, 60, 37, 30, 46, 31, 63 } /* for fourth subblock */ |
| 231 | }; |
| 232 | |
| 233 | /*Inverse scan tables for individual 8x8 blocks of 8x8 transform coeffs of CABAC */ |
| 234 | /* progressive */ |
| 235 | |
| 236 | const UWORD8 gau1_ih264d_inv_scan_prog8x8_cabac[64] = |
| 237 | { 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, |
| 238 | 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, |
| 239 | 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, |
| 240 | 60, 61, 54, 47, 55, 62, 63 }; |
| 241 | |
| 242 | /* interlace */ |
| 243 | |
| 244 | const UWORD8 gau1_ih264d_inv_scan_int8x8_cabac[64] = |
| 245 | { 0, 8, 16, 1, 9, 24, 32, 17, 2, 25, 40, 48, 56, 33, 10, 3, 18, 41, 49, 57, |
| 246 | 26, 11, 4, 19, 34, 42, 50, 58, 27, 12, 5, 20, 35, 43, 51, 59, 28, 13, 6, |
| 247 | 21, 36, 44, 52, 60, 29, 14, 22, 37, 45, 53, 61, 30, 7, 15, 38, 46, 54, 62, |
| 248 | 23, 31, 39, 47, 55, 63 }; |
| 249 | |
| 250 | /****************PARSING TABLES *******************/ |
| 251 | UWORD8 const gau1_ih264d_subblk_offset[16] = |
| 252 | { 8, 9, 12, 13, 10, 11, 14, 15, 16, 17, 20, 21, 18, 19, 22, 23 }; |
| 253 | |
| 254 | const UWORD8 gau1_ih264d_cbp_tab[6] = |
| 255 | { 0, 16, 32, 15, 31, 47 }; |
| 256 | |
| 257 | /** gives CBP value from codeword number, both for intra and inter */ |
| 258 | |
| 259 | const UWORD8 gau1_ih264d_cbp_table[48][2] = |
| 260 | { |
| 261 | { 47, 0 }, |
| 262 | { 31, 16 }, |
| 263 | { 15, 1 }, |
| 264 | { 0, 2 }, |
| 265 | { 23, 4 }, |
| 266 | { 27, 8 }, |
| 267 | { 29, 32 }, |
| 268 | { 30, 3 }, |
| 269 | { 7, 5 }, |
| 270 | { 11, 10 }, |
| 271 | { 13, 12 }, |
| 272 | { 14, 15 }, |
| 273 | { 39, 47 }, |
| 274 | { 43, 7 }, |
| 275 | { 45, 11 }, |
| 276 | { 46, 13 }, |
| 277 | { 16, 14 }, |
| 278 | { 3, 6 }, |
| 279 | { 5, 9 }, |
| 280 | { 10, 31 }, |
| 281 | { 12, 35 }, |
| 282 | { 19, 37 }, |
| 283 | { 21, 42 }, |
| 284 | { 26, 44 }, |
| 285 | { 28, 33 }, |
| 286 | { 35, 34 }, |
| 287 | { 37, 36 }, |
| 288 | { 42, 40 }, |
| 289 | { 44, 39 }, |
| 290 | { 1, 43 }, |
| 291 | { 2, 45 }, |
| 292 | { 4, 46 }, |
| 293 | { 8, 17 }, |
| 294 | { 17, 18 }, |
| 295 | { 18, 20 }, |
| 296 | { 20, 24 }, |
| 297 | { 24, 19 }, |
| 298 | { 6, 21 }, |
| 299 | { 9, 26 }, |
| 300 | { 22, 28 }, |
| 301 | { 25, 23 }, |
| 302 | { 32, 27 }, |
| 303 | { 33, 29 }, |
| 304 | { 34, 30 }, |
| 305 | { 36, 22 }, |
| 306 | { 40, 25 }, |
| 307 | { 38, 38 }, |
| 308 | { 41, 41 }, }; |
| 309 | /****************PARSING TABLES ENDS *******************/ |
| 310 | |
| 311 | /****************DECODE SLICE TABLES STARTS *******************/ |
| 312 | /*Definition of Tables needed by functions of this file */ |
| 313 | const UWORD8 gau1_ih264d_inv_scan[16] = |
| 314 | { 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15 }; |
| 315 | |
| 316 | const UWORD8 gau1_ih264d_inv_scan_fld[16] = |
| 317 | { 0, 4, 1, 8, 12, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15 }; |
| 318 | |
| 319 | const UWORD8 gau1_ih264d_dequant_matrix[6][16] = |
| 320 | { |
| 321 | { 10, 13, 10, 13, 13, 16, 13, 16, 10, 13, 10 ,13, 13, 16, 13, 16}, |
| 322 | { 11, 14, 11, 14, 14, 18, 14, 18, 11, 14, 11 ,14, 14, 18, 14, 18}, |
| 323 | { 13, 16, 13, 16, 16, 20, 16, 20, 13, 16, 13 ,16, 16, 20, 16, 20}, |
| 324 | { 14, 18, 14, 18, 18, 23, 18, 23, 14, 18, 14, 18, 18, 23, 18, 23}, |
| 325 | { 16, 20, 16, 20, 20, 25, 20, 25, 16, 20, 16, 20, 20, 25, 20, 25}, |
| 326 | { 18, 23, 18, 23, 23, 29, 23, 29, 18, 23, 18, 23, 23, 29, 23, 29} |
| 327 | }; |
| 328 | |
| 329 | const UWORD16 gau2_ih264_iquant_scale_4x4[6][16] = |
| 330 | { |
| 331 | { 10, 13, 10, 13, 13, 16, 13, 16, 10, 13, 10, 13, 13, 16, 13, 16 }, |
| 332 | { 11, 14, 11, 14, 14, 18, 14, 18, 11, 14, 11, 14, 14, 18, 14, 18 }, |
| 333 | { 13, 16, 13, 16, 16, 20, 16, 20, 13, 16, 13, 16, 16, 20, 16, 20 }, |
| 334 | { 14, 18, 14, 18, 18, 23, 18, 23, 14, 18, 14, 18, 18, 23, 18, 23 }, |
| 335 | { 16, 20, 16, 20, 20, 25, 20, 25, 16, 20, 16, 20, 20, 25, 20, 25 }, |
| 336 | { 18, 23, 18, 23, 23, 29, 23, 29, 18, 23, 18, 23, 23, 29, 23, 29 } }; |
| 337 | |
| 338 | const UWORD8 gau1_ih264d_dequant8x8_zigzag_cavlc[4][6][16] = |
| 339 | { |
| 340 | { |
| 341 | { 20, 18, 24, 32, 19, 19, 18, 19, 19, 18, 18, 24, |
| 342 | 24, 25, 24, 18 }, /* for First subblock */ |
| 343 | { 22, 19, 26, 35, 21, 21, 19, 21, 21, 19, 19, 26, |
| 344 | 26, 28, 26, 19 }, |
| 345 | { 26, 23, 31, 42, 24, 24, 23, 24, 24, 23, 23, 31, |
| 346 | 31, 33, 31, 23 }, |
| 347 | { 28, 25, 33, 45, 26, 26, 25, 26, 26, 25, 25, 33, |
| 348 | 33, 35, 33, 25 }, |
| 349 | { 32, 28, 38, 51, 30, 30, 28, 30, 30, 28, 28, 38, |
| 350 | 38, 40, 38, 28 }, |
| 351 | { 36, 32, 43, 58, 34, 34, 32, 34, 34, 32, 32, 43, |
| 352 | 43, 46, 43, 32 } }, |
| 353 | { |
| 354 | { 19, 25, 19, 18, 24, 25, 25, 24, 24, 32, 32, 19, |
| 355 | 18, 18, 19, 24 }, /* for second subblock */ |
| 356 | { 21, 28, 21, 19, 26, 28, 28, 26, 26, 35, 35, |
| 357 | 21, 19, 19, 21, 26 }, |
| 358 | { 24, 33, 24, 23, 31, 33, 33, 31, 31, 42, 42, |
| 359 | 24, 23, 23, 24, 31 }, |
| 360 | { 26, 35, 26, 25, 33, 35, 35, 33, 33, 45, 45, |
| 361 | 26, 25, 25, 26, 33 }, |
| 362 | { 30, 40, 30, 28, 38, 40, 40, 38, 38, 51, 51, |
| 363 | 30, 28, 28, 30, 38 }, |
| 364 | { 34, 46, 34, 32, 43, 46, 46, 43, 43, 58, 58, |
| 365 | 34, 32, 32, 34, 43 } }, |
| 366 | { |
| 367 | { 19, 19, 20, 20, 24, 18, 18, 24, 24, 18, 18, 19, |
| 368 | 25, 19, 18, 24 }, /* for third subblock */ |
| 369 | { 21, 21, 22, 22, 26, 19, 19, 26, 26, 19, 19, |
| 370 | 21, 28, 21, 19, 26 }, |
| 371 | { 24, 24, 26, 26, 31, 23, 23, 31, 31, 23, 23, |
| 372 | 24, 33, 24, 23, 31 }, |
| 373 | { 26, 26, 28, 28, 33, 25, 25, 33, 33, 25, 25, |
| 374 | 26, 35, 26, 25, 33 }, |
| 375 | { 30, 30, 32, 32, 38, 28, 28, 38, 38, 28, 28, |
| 376 | 30, 40, 30, 28, 38 }, |
| 377 | { 34, 34, 36, 36, 43, 32, 32, 43, 43, 32, 32, |
| 378 | 34, 46, 34, 32, 43 } }, |
| 379 | { |
| 380 | { 25, 24, 18, 19, 19, 25, 25, 19, 19, 20, 24, 24, |
| 381 | 18, 24, 32, 18 }, /* for fourth subblock */ |
| 382 | { 28, 26, 19, 21, 21, 28, 28, 21, 21, 22, 26, |
| 383 | 26, 19, 26, 35, 19 }, |
| 384 | { 33, 31, 23, 24, 24, 33, 33, 24, 24, 26, 31, |
| 385 | 31, 23, 31, 42, 23 }, |
| 386 | { 35, 33, 25, 26, 26, 35, 35, 26, 26, 28, 33, |
| 387 | 33, 25, 33, 45, 25 }, |
| 388 | { 40, 38, 28, 30, 30, 40, 40, 30, 30, 32, 38, |
| 389 | 38, 28, 38, 51, 28 }, |
| 390 | { 46, 43, 32, 34, 34, 46, 46, 34, 34, 36, 43, |
| 391 | 43, 32, 43, 58, 32 } } |
| 392 | |
| 393 | }; |
| 394 | |
| 395 | const UWORD16 gau1_ih264d_dequant8x8_cavlc[6][64] = |
| 396 | { |
| 397 | { 20, 19, 25, 19, 20, 19, 25, 19, 19, 18, 24, 18, 19, |
| 398 | 18, 24, 18, 25, 24, 32, 24, 25, 24, 32, 24, 19, 18, |
| 399 | 24, 18, 19, 18, 24, 18, 20, 19, 25, 19, 20, 19, 25, |
| 400 | 19, 19, 18, 24, 18, 19, 18, 24, 18, 25, 24, 32, 24, |
| 401 | 25, 24, 32, 24, 19, 18, 24, 18, 19, 18, 24, 18 }, |
| 402 | { 22, 21, 28, 21, 22, 21, 28, 21, 21, 19, 26, 19, 21, |
| 403 | 19, 26, 19, 28, 26, 35, 26, 28, 26, 35, 26, 21, 19, |
| 404 | 26, 19, 21, 19, 26, 19, 22, 21, 28, 21, 22, 21, 28, |
| 405 | 21, 21, 19, 26, 19, 21, 19, 26, 19, 28, 26, 35, 26, |
| 406 | 28, 26, 35, 26, 21, 19, 26, 19, 21, 19, 26, 19 }, |
| 407 | { 26, 24, 33, 24, 26, 24, 33, 24, 24, 23, 31, 23, 24, |
| 408 | 23, 31, 23, 33, 31, 42, 31, 33, 31, 42, 31, 24, 23, |
| 409 | 31, 23, 24, 23, 31, 23, 26, 24, 33, 24, 26, 24, 33, |
| 410 | 24, 24, 23, 31, 23, 24, 23, 31, 23, 33, 31, 42, 31, |
| 411 | 33, 31, 42, 31, 24, 23, 31, 23, 24, 23, 31, 23 }, |
| 412 | { 28, 26, 35, 26, 28, 26, 35, 26, 26, 25, 33, 25, 26, |
| 413 | 25, 33, 25, 35, 33, 45, 33, 35, 33, 45, 33, 26, 25, |
| 414 | 33, 25, 26, 25, 33, 25, 28, 26, 35, 26, 28, 26, 35, |
| 415 | 26, 26, 25, 33, 25, 26, 25, 33, 25, 35, 33, 45, 33, |
| 416 | 35, 33, 45, 33, 26, 25, 33, 25, 26, 25, 33, 25 }, |
| 417 | { 32, 30, 40, 30, 32, 30, 40, 30, 30, 28, 38, 28, 30, |
| 418 | 28, 38, 28, 40, 38, 51, 38, 40, 38, 51, 38, 30, 28, |
| 419 | 38, 28, 30, 28, 38, 28, 32, 30, 40, 30, 32, 30, 40, |
| 420 | 30, 30, 28, 38, 28, 30, 28, 38, 28, 40, 38, 51, 38, |
| 421 | 40, 38, 51, 38, 30, 28, 38, 28, 30, 28, 38, 28 }, |
| 422 | { 36, 34, 46, 34, 36, 34, 46, 34, 34, 32, 43, 32, 34, |
| 423 | 32, 43, 32, 46, 43, 58, 43, 46, 43, 58, 43, 34, 32, |
| 424 | 43, 32, 34, 32, 43, 32, 36, 34, 46, 34, 36, 34, 46, |
| 425 | 34, 34, 32, 43, 32, 34, 32, 43, 32, 46, 43, 58, 43, |
| 426 | 46, 43, 58, 43, 34, 32, 43, 32, 34, 32, 43, 32 }, }; |
| 427 | |
| 428 | /****************DECODE SLICE TABLES ENDS *******************/ |
| 429 | |
| 430 | /****************MOTION VECTOR DECODING TABLES STARTS *******************/ |
| 431 | |
| 432 | /** |
| 433 | ************************************************************************** |
| 434 | * \brief This array is used to evaluate the condition when only one of |
| 435 | * predictor subMbs has a reference frame equal to that of E subMb. |
| 436 | ************************************************************************** |
| 437 | */ |
| 438 | |
| 439 | const WORD8 gau1_ih264d_mv_pred_condition[] = |
| 440 | { -1, 0, 1, -1, 2, -1, -1, -1 }; |
| 441 | |
| 442 | /** Number of subMbs for the 8x8 prediction mode */ |
| 443 | const UWORD8 gau1_ih264d_num_submb_part[] = |
| 444 | { 1, 2, 2, 4 }; |
| 445 | |
| 446 | /** Width of the 8x8 prediction mode in terms of subMbs */ |
| 447 | const UWORD8 gau1_ih264d_submb_partw[] = |
| 448 | { 2, 2, 1, 1 }; |
| 449 | |
| 450 | /** Height of the 8x8 prediction mode in terms of subMbs */ |
| 451 | const UWORD8 gau1_ih264d_submb_parth[] = |
| 452 | { 2, 1, 2, 1 }; |
| 453 | |
| 454 | /** Number of MB partitions for the MB prediction mode */ |
| 455 | const UWORD8 gau1_ih264d_num_mb_part[] = |
| 456 | { 1, 2, 2, 4 }; |
| 457 | |
| 458 | /** Width of the MB partition in terms of subMbs */ |
| 459 | const UWORD8 gau1_ih264d_mb_partw[] = |
| 460 | { 4, 4, 2, 2, 2 }; |
| 461 | |
| 462 | /** Height of the MB partition in terms of subMbs */ |
| 463 | const UWORD8 gau1_ih264d_mb_parth[] = |
| 464 | { 4, 2, 4, 2, 2 }; |
| 465 | |
| 466 | /** MB partition information is packed into a UWORD32 {0,number,width,height} */ |
| 467 | const UWORD32 gau4_ih264d_submb_part[] = |
| 468 | { 0x00010202, 0x00020201, 0x00020102, 0x00040101 }; |
| 469 | |
| 470 | const UWORD8 gau1_ih264d_submb_indx_mod[] = |
| 471 | { 0, 0, /* 16x16 */ |
| 472 | 0, 8, /* 16x8 */ |
| 473 | 0, 2, /* 8x16 */ |
| 474 | 0, 0, /* 8x8 */ |
| 475 | 0, 4, /* 8x4 */ |
| 476 | 0, 1, /* 4x8 */ |
| 477 | 0, 1, 3, 1 /* 4x4 */ |
| 478 | }; |
| 479 | |
| 480 | /** This table is used to assign CBPs to Inter MBs. */ |
| 481 | const UWORD8 gau1_ih264d_cbp_inter[] = |
| 482 | { 0, 16, 1, 2, 4, 8, 32, 3, 5, 10, 12, 15, 47, 7, 11, 13, 14, 6, 9, 31, 35, |
| 483 | 37, 42, 44, 33, 34, 36, 40, 39, 43, 45, 46, 17, 18, 20, 24, 19, 21, 26, |
| 484 | 28, 23, 27, 29, 30, 22, 25, 38, 41 }; |
| 485 | |
| 486 | /** Motion comp modes for P followed by B, |
| 487 | 0 to 4 : P Mbs |
| 488 | 5 to 27 : B Mbs |
| 489 | 28 to 30 : DIRECT */ |
| 490 | const UWORD8 gau1_ih264d_mb_mc_mode[] = |
| 491 | { |
| 492 | PRED_16x16, |
| 493 | PRED_16x8, PRED_8x16, PRED_8x8, PRED_8x8R0, |
| 494 | PRED_16x16, |
| 495 | PRED_16x16, PRED_16x16, PRED_16x16, PRED_16x8, PRED_8x16, |
| 496 | PRED_16x8, |
| 497 | PRED_8x16, PRED_16x8, PRED_8x16, PRED_16x8, PRED_8x16, |
| 498 | PRED_16x8, |
| 499 | PRED_8x16, PRED_16x8, PRED_8x16, PRED_16x8, PRED_8x16, |
| 500 | PRED_16x8, |
| 501 | PRED_8x16, PRED_16x8, PRED_8x16, PRED_8x8, |
| 502 | /* Self defined modes for B_SKIP and DIRECT16x16 */ |
| 503 | PRED_8x8, |
| 504 | PRED_8x8, PRED_8x8 }; |
| 505 | |
| 506 | const UWORD8 gau1_ih264d_submb_mc_mode[] = |
| 507 | { SUBMB_8x8, SUBMB_8x4, SUBMB_4x8, SUBMB_4x4, |
| 508 | SUBMB_8x8, |
| 509 | SUBMB_8x8, SUBMB_8x8, SUBMB_8x8, SUBMB_8x4, SUBMB_4x8, |
| 510 | SUBMB_8x4, |
| 511 | SUBMB_4x8, SUBMB_8x4, SUBMB_4x8, SUBMB_4x4, SUBMB_4x4, SUBMB_4x4, |
| 512 | /* Self defined modes B DIRECT8x8 */ |
| 513 | SUBMB_4x4, |
| 514 | SUBMB_4x4, SUBMB_4x4 }; |
| 515 | |
| 516 | /** Sub MB pred modes for B slice */ |
| 517 | const UWORD8 gau1_ih264d_submb_pred_modes[] = |
| 518 | { |
| 519 | PRED_L0, |
| 520 | PRED_L0, PRED_L0, PRED_L0, |
| 521 | B_DIRECT, |
| 522 | PRED_L0, PRED_L1, BI_PRED, PRED_L0, PRED_L0, PRED_L1, |
| 523 | PRED_L1, |
| 524 | BI_PRED, BI_PRED, PRED_L0, PRED_L1, BI_PRED, |
| 525 | /* Self defined modes for B DIRECT8x8 */ |
| 526 | BI_PRED, |
| 527 | PRED_L0, PRED_L1, }; |
| 528 | |
| 529 | /** MB pred modes for P and B slice */ |
| 530 | const WORD8 gau1_ih264d_mb_pred_modes[2][32] = |
| 531 | { |
| 532 | { PRED_L0, PRED_L0, PRED_L0, PRED_INVALID, PRED_INVALID, |
| 533 | B_DIRECT, |
| 534 | PRED_L0, PRED_L1, BI_PRED, PRED_L0, PRED_L0, PRED_L1, PRED_L1, |
| 535 | PRED_L0, |
| 536 | PRED_L0, PRED_L1, PRED_L1, PRED_L0, PRED_L0, PRED_L1, PRED_L1, |
| 537 | BI_PRED, |
| 538 | BI_PRED, BI_PRED, BI_PRED, BI_PRED, BI_PRED, PRED_INVALID, |
| 539 | /* Self defined modes for B_SKIP and DIRECT16x16 */ |
| 540 | BI_PRED, |
| 541 | PRED_L0, PRED_L1, }, |
| 542 | { PRED_INVALID, PRED_L0, PRED_L0, PRED_INVALID, PRED_INVALID, |
| 543 | PRED_INVALID, |
| 544 | PRED_INVALID, PRED_INVALID, PRED_INVALID, PRED_L0, PRED_L0, |
| 545 | PRED_L1, |
| 546 | PRED_L1, PRED_L1, PRED_L1, PRED_L0, PRED_L0, BI_PRED, BI_PRED, |
| 547 | BI_PRED, |
| 548 | BI_PRED, PRED_L0, PRED_L0, PRED_L1, PRED_L1, BI_PRED, BI_PRED, |
| 549 | PRED_INVALID, |
| 550 | /* Self defined modes for B_SKIP and DIRECT16x16 */ |
| 551 | PRED_INVALID, |
| 552 | PRED_INVALID, PRED_INVALID } }; |
| 553 | |
| 554 | /****************MOTION VECTOR DECODING TABLES ENDS *******************/ |
| 555 | |
| 556 | /****************CAVLC DECODING TABLES STARTS *******************/ |
| 557 | |
| 558 | /*****************************************************************************/ |
| 559 | /* 6 Bit table look for total zeros (totalcoeff = 2to10) as in Table 9.7 */ |
| 560 | /* of H264 standard. In each table entry, lower 4 bits represent total zeros */ |
| 561 | /* decoded while upper 4 bit represent the bits to be flushed from ps_bitstrm */ |
| 562 | /*****************************************************************************/ |
| 563 | const UWORD8 gau1_ih264d_table_total_zero_2to10[9][64] = |
| 564 | { |
| 565 | /* For total coeff = 2 */ |
| 566 | { 0x6E, 0x6D, 0x6C, 0x6B, 0x5A, 0x5A, 0x59, 0x59, 0x48, 0x48, 0x48, |
| 567 | 0x48, 0x47, 0x47, 0x47, 0x47, 0x46, 0x46, 0x46, 0x46, 0x45, 0x45, |
| 568 | 0x45, 0x45, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x33, |
| 569 | 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x32, 0x32, 0x32, 0x32, |
| 570 | 0x32, 0x32, 0x32, 0x32, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, |
| 571 | 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, }, |
| 572 | |
| 573 | /* For total coeff = 3 */ |
| 574 | { 0x6D, 0x6B, 0x5C, 0x5C, 0x5A, 0x5A, 0x59, 0x59, 0x48, 0x48, 0x48, |
| 575 | 0x48, 0x45, 0x45, 0x45, 0x45, 0x44, 0x44, 0x44, 0x44, 0x40, 0x40, |
| 576 | 0x40, 0x40, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x36, |
| 577 | 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x33, 0x33, 0x33, 0x33, |
| 578 | 0x33, 0x33, 0x33, 0x33, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, |
| 579 | 0x32, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, }, |
| 580 | |
| 581 | /* For total coeff = 4 */ |
| 582 | { 0x5C, 0x5C, 0x5B, 0x5B, 0x5A, 0x5A, 0x50, 0x50, 0x49, 0x49, 0x49, |
| 583 | 0x49, 0x47, 0x47, 0x47, 0x47, 0x43, 0x43, 0x43, 0x43, 0x42, 0x42, |
| 584 | 0x42, 0x42, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x36, |
| 585 | 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x35, 0x35, 0x35, 0x35, |
| 586 | 0x35, 0x35, 0x35, 0x35, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, |
| 587 | 0x34, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, }, |
| 588 | |
| 589 | /* For total coeff = 5 */ |
| 590 | { 0x5B, 0x5B, 0x59, 0x59, 0x4A, 0x4A, 0x4A, 0x4A, 0x48, 0x48, 0x48, |
| 591 | 0x48, 0x42, 0x42, 0x42, 0x42, 0x41, 0x41, 0x41, 0x41, 0x40, 0x40, |
| 592 | 0x40, 0x40, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x36, |
| 593 | 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x35, 0x35, 0x35, 0x35, |
| 594 | 0x35, 0x35, 0x35, 0x35, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, |
| 595 | 0x34, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, }, |
| 596 | |
| 597 | /* For total coeff = 6 */ |
| 598 | { 0x6A, 0x60, 0x51, 0x51, 0x48, 0x48, 0x48, 0x48, 0x39, 0x39, 0x39, |
| 599 | 0x39, 0x39, 0x39, 0x39, 0x39, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, |
| 600 | 0x37, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x35, |
| 601 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x34, 0x34, 0x34, 0x34, |
| 602 | 0x34, 0x34, 0x34, 0x34, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, |
| 603 | 0x33, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, }, |
| 604 | |
| 605 | /* For total coeff = 7 */ |
| 606 | { 0x69, 0x60, 0x51, 0x51, 0x47, 0x47, 0x47, 0x47, 0x38, 0x38, 0x38, |
| 607 | 0x38, 0x38, 0x38, 0x38, 0x38, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, |
| 608 | 0x36, 0x36, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x33, |
| 609 | 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x32, 0x32, 0x32, 0x32, |
| 610 | 0x32, 0x32, 0x32, 0x32, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, |
| 611 | 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, }, |
| 612 | |
| 613 | /* For total coeff = 8 */ |
| 614 | { 0x68, 0x60, 0x52, 0x52, 0x41, 0x41, 0x41, 0x41, 0x37, 0x37, 0x37, |
| 615 | 0x37, 0x37, 0x37, 0x37, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, |
| 616 | 0x36, 0x36, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x25, |
| 617 | 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, |
| 618 | 0x25, 0x25, 0x25, 0x25, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, |
| 619 | 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, }, |
| 620 | |
| 621 | /* For total coeff = 9 */ |
| 622 | { 0x61, 0x60, 0x57, 0x57, 0x42, 0x42, 0x42, 0x42, 0x35, 0x35, 0x35, |
| 623 | 0x35, 0x35, 0x35, 0x35, 0x35, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, |
| 624 | 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x24, |
| 625 | 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, |
| 626 | 0x24, 0x24, 0x24, 0x24, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, |
| 627 | 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, }, |
| 628 | |
| 629 | /* For total coeff = 10 */ |
| 630 | { 0x51, 0x51, 0x50, 0x50, 0x46, 0x46, 0x46, 0x46, 0x32, 0x32, 0x32, |
| 631 | 0x32, 0x32, 0x32, 0x32, 0x32, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, |
| 632 | 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x24, |
| 633 | 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, |
| 634 | 0x24, 0x24, 0x24, 0x24, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, |
| 635 | 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, } |
| 636 | |
| 637 | }; |
| 638 | |
| 639 | /*****************************************************************************/ |
| 640 | /* 4 Bit table look for total zeros (totalcoeff = 11to15) as in Table 9.7 */ |
| 641 | /* of H264 standard. In each table entry, lower 4 bits represent total zeros */ |
| 642 | /* decoded while upper 4 bit represent the bits to be flushed from ps_bitstrm */ |
| 643 | /*****************************************************************************/ |
| 644 | const UWORD8 gau1_ih264d_table_total_zero_11to15[5][16] = |
| 645 | { |
| 646 | /* For total coeff = 11 */ |
| 647 | { 0x40, 0x41, 0x32, 0x32, 0x33, 0x33, 0x35, 0x35, 0x14, 0x14, 0x14, |
| 648 | 0x14, 0x14, 0x14, 0x14, 0x14, }, |
| 649 | |
| 650 | /* For total coeff = 12 */ |
| 651 | { 0x40, 0x41, 0x34, 0x34, 0x22, 0x22, 0x22, 0x22, 0x13, 0x13, 0x13, |
| 652 | 0x13, 0x13, 0x13, 0x13, 0x13, }, |
| 653 | |
| 654 | /* For total coeff = 13 */ |
| 655 | { 0x30, 0x30, 0x31, 0x31, 0x23, 0x23, 0x23, 0x23, 0x12, 0x12, 0x12, |
| 656 | 0x12, 0x12, 0x12, 0x12, 0x12, }, |
| 657 | |
| 658 | /* For total coeff = 14 */ |
| 659 | { 0x20, 0x20, 0x20, 0x20, 0x21, 0x21, 0x21, 0x21, 0x12, 0x12, 0x12, |
| 660 | 0x12, 0x12, 0x12, 0x12, 0x12, }, |
| 661 | |
| 662 | /* For total coeff = 15 */ |
| 663 | { 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, |
| 664 | 0x11, 0x11, 0x11, 0x11, 0x11, }, }; |
| 665 | |
| 666 | /** Tables used to read "Run Before", Below tables are packed to reduce lookups */ |
| 667 | /** (Base addess of Gx << 2) + (Max code length for that Gx) */ |
| 668 | const UWORD8 gau1_ih264d_table_run_before[64] = |
| 669 | { 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 1, 1, 1, 1, 10, 10, 6, 6, 1, 1, 1, 1, |
| 670 | 14, 14, 10, 10, 6, 6, 2, 2, 19, 15, 10, 10, 6, 6, 2, 2, 23, 19, 15, 11, 6, |
| 671 | 6, 2, 2, 7, 11, 19, 15, 27, 23, 2, 2, 27, 27, 23, 19, 15, 11, 7, 3 }; |
| 672 | |
| 673 | /*****************************************************************************/ |
| 674 | /* Lookup table for CAVLC 4x4 total_coeff,trailing_ones as pers Table 9-5 */ |
| 675 | /* in the standard. Starting form lsb first 2 bits=flushbits, next 2bits= */ |
| 676 | /* trailing ones, next 5 bits=total_coeff. Total bits used = 9 out of 16 */ |
| 677 | /*****************************************************************************/ |
| 678 | const UWORD16 gau2_ih264d_code_gx[304] = |
| 679 | { |
| 680 | /* Lookup for 0 <= nC < 2 */ |
| 681 | 0x0000, |
| 682 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0014, 0x0014, |
| 683 | 0x0014, 0x0014, 0x0014, 0x0014, 0x0014, 0x0014, 0x0028, 0x0028, 0x0028, |
| 684 | 0x0028, 0x0028, 0x0028, 0x0028, 0x0028, 0x0026, 0x0026, 0x0012, 0x0012, |
| 685 | 0x003D, 0x003D, 0x003D, 0x003D, 0x005E, 0x005E, 0x003A, 0x003A, 0x004D, |
| 686 | 0x004D, 0x004D, 0x004D, 0x006E, 0x006E, 0x004A, 0x004A, 0x0036, 0x0036, |
| 687 | 0x0022, 0x0022, 0x007E, 0x007E, 0x005A, 0x005A, 0x0046, 0x0046, 0x0032, |
| 688 | 0x0032, 0x008E, 0x008E, 0x006A, 0x006A, 0x0056, 0x0056, 0x0042, 0x0042, |
| 689 | 0x009E, 0x009E, 0x007A, 0x007A, 0x0066, 0x0066, 0x0052, 0x0052, 0x0083, |
| 690 | 0x009B, 0x0087, 0x0073, 0x00AF, 0x008B, 0x0077, 0x0063, 0x00CF, 0x00BB, |
| 691 | 0x00A7, 0x00A3, 0x00BF, 0x00AB, 0x0097, 0x0093, 0x00EF, 0x00DB, 0x00C7, |
| 692 | 0x00C3, 0x00DF, 0x00CB, 0x00B7, 0x00B3, 0x010F, 0x00FB, 0x00F7, 0x00E3, |
| 693 | 0x00FF, 0x00EB, 0x00E7, 0x00D3, 0x0102, 0x0102, 0x010A, 0x010A, 0x0106, |
| 694 | 0x0106, 0x00F2, 0x00F2, 0x00D4, 0x00D4, 0x00D4, 0x00D4, 0x00D4, 0x00D4, |
| 695 | 0x00D4, 0x00D4, |
| 696 | |
| 697 | /* Lookup for 2 <= nC < 4 */ |
| 698 | 0x0015, |
| 699 | 0x0015, 0x0015, 0x0015, 0x0001, 0x0001, 0x0001, 0x0001, 0x004E, 0x004E, |
| 700 | 0x003E, 0x003E, 0x0029, 0x0029, 0x0029, 0x0029, 0x006F, 0x003B, 0x0037, |
| 701 | 0x0013, 0x005E, 0x005E, 0x0026, 0x0026, 0x007E, 0x007E, 0x004A, 0x004A, |
| 702 | 0x0046, 0x0046, 0x0022, 0x0022, 0x008E, 0x008E, 0x005A, 0x005A, 0x0056, |
| 703 | 0x0056, 0x0032, 0x0032, 0x0052, 0x0052, 0x006A, 0x006A, 0x0066, 0x0066, |
| 704 | 0x0042, 0x0042, 0x009E, 0x009E, 0x007A, 0x007A, 0x0076, 0x0076, 0x0062, |
| 705 | 0x0062, 0x00BF, 0x009B, 0x0097, 0x0083, 0x00AF, 0x008B, 0x0087, 0x0073, |
| 706 | 0x00B3, 0x00BB, 0x00B7, 0x00A3, 0x00CF, 0x00AB, 0x00A7, 0x0093, 0x00EF, |
| 707 | 0x00DB, 0x00D7, 0x00D3, 0x00DF, 0x00CB, 0x00C7, 0x00C3, 0x00F7, 0x00F3, |
| 708 | 0x00FB, 0x00E7, 0x00EA, 0x00EA, 0x00E2, 0x00E2, 0x010E, 0x010E, 0x010A, |
| 709 | 0x010A, 0x0106, 0x0106, 0x0102, 0x0102, 0x00FC, 0x00FC, 0x00FC, 0x00FC, |
| 710 | 0x00FC, 0x00FC, 0x00FC, 0x00FC, |
| 711 | |
| 712 | /* Lookup for 4 <= nC < 8 */ |
| 713 | 0x007F, |
| 714 | 0x006F, 0x005F, 0x004F, 0x003F, 0x002B, 0x0017, 0x0003, 0x0057, 0x005B, |
| 715 | 0x0047, 0x004B, 0x0037, 0x008F, 0x003B, 0x0027, 0x0033, 0x007B, 0x0077, |
| 716 | 0x0023, 0x009F, 0x006B, 0x0067, 0x0013, 0x0073, 0x0063, 0x009B, 0x0053, |
| 717 | 0x00AF, 0x008B, 0x0087, 0x0043, 0x00CF, 0x00BB, 0x00A7, 0x0093, 0x00BF, |
| 718 | 0x00AB, 0x0097, 0x0083, 0x00C3, 0x00DB, 0x00C7, 0x00B3, 0x00DF, 0x00CB, |
| 719 | 0x00B7, 0x00A3, 0x00F7, 0x00E3, 0x00EF, 0x00EB, 0x00E7, 0x00D3, 0x00D6, |
| 720 | 0x00D6, 0x0106, 0x0106, 0x00F2, 0x00F2, 0x00FE, 0x00FE, 0x00FA, 0x00FA, |
| 721 | 0x010D, 0x010D, 0x010D, 0x010D, 0x0109, 0x0109, 0x0109, 0x0109, 0x0100, |
| 722 | 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100 }; |
| 723 | |
| 724 | /*****************************************************************************/ |
| 725 | /* Lookup table for CAVLC ChromaDC total_coeff,trailing_ones parsing as per */ |
| 726 | /* Table 9-5 in the standard. Starting from msb, First 4bits=total_coeff, */ |
| 727 | /* next 2bits=trailing_ones and last 2bits=flushbits-1 */ |
| 728 | /*****************************************************************************/ |
| 729 | const UWORD8 gau1_ih264d_cav_chromdc_vld[256] = |
| 730 | { 0x9E, 0x9E, 0x97, 0x8F, 0x76, 0x76, 0x6E, 0x6E, 0x85, 0x85, 0x85, 0x85, |
| 731 | 0x65, 0x65, 0x65, 0x65, 0x45, 0x45, 0x45, 0x45, 0x7D, 0x7D, 0x7D, 0x7D, |
| 732 | 0x4D, 0x4D, 0x4D, 0x4D, 0x25, 0x25, 0x25, 0x25, |
| 733 | |
| 734 | 0x52, |
| 735 | 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, |
| 736 | 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, |
| 737 | 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, |
| 738 | |
| 739 | 0x01, |
| 740 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
| 741 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
| 742 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
| 743 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
| 744 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
| 745 | 0x01, 0x01, 0x01, |
| 746 | |
| 747 | 0x28, |
| 748 | 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, |
| 749 | 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, |
| 750 | 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, |
| 751 | 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, |
| 752 | 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, |
| 753 | 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, |
| 754 | 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, |
| 755 | 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, |
| 756 | 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, |
| 757 | 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, |
| 758 | 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, }; |
| 759 | |
| 760 | const UWORD16 gau2_ih264d_offset_num_vlc_tab[9] = |
| 761 | { 0, 0, 120, 120, 224, 224, 224, 224, 224 }; |
| 762 | |
| 763 | /*****************************************************************************/ |
| 764 | /* Function pointer u4_ofst table lookup for parsing 4x4 residual blocks in */ |
| 765 | /* CAVLC. The u4_ofst is dependent on total coeffs coded */ |
| 766 | /*****************************************************************************/ |
| 767 | const UWORD8 gau1_ih264d_total_coeff_fn_ptr_offset[16] = |
| 768 | { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2 }; |
| 769 | |
| 770 | /****************************************************************************/ |
| 771 | /* gai2_ih264d_trailing_one_level lookup tables based on trailing one bits */ |
| 772 | /* All zeroes are u2_dummy in the table are u2_dummy to keep 3 uniform elements */ |
| 773 | /****************************************************************************/ |
| 774 | const WORD16 gai2_ih264d_trailing_one_level[14][3] = |
| 775 | { |
| 776 | /* All zeroes are u2_dummy */ |
| 777 | /**********************************************************************/ |
| 778 | /* Levels for trailing ones = 1, bits read can be 0 or 1 */ |
| 779 | /**********************************************************************/ |
| 780 | { 1, 0, 0 }, /* 0 */ |
| 781 | { -1, 0, 0 }, /* 1 */ |
| 782 | |
| 783 | /**********************************************************************/ |
| 784 | /* Levels for trailing ones = 2, bits read can be 00, 01, 10 ,11 */ |
| 785 | /**********************************************************************/ |
| 786 | { 1, 1, 0 }, /* 00 */ |
| 787 | { 1, -1, 0 }, /* 01 */ |
| 788 | { -1, 1, 0 }, /* 10 */ |
| 789 | { -1, -1, 0 }, /* 11 */ |
| 790 | |
| 791 | /**********************************************************************/ |
| 792 | /* Levels for trailing ones = 3, bits read can be 000 - 111 */ |
| 793 | /**********************************************************************/ |
| 794 | { 1, 1, 1 }, /* 000 */ |
| 795 | { 1, 1, -1 }, /* 001 */ |
| 796 | { 1, -1, 1 }, /* 010 */ |
| 797 | { 1, -1, -1 }, /* 011 */ |
| 798 | { -1, 1, 1 }, /* 100 */ |
| 799 | { -1, 1, -1 }, /* 101 */ |
| 800 | { -1, -1, 1 }, /* 110 */ |
| 801 | { -1, -1, -1 }, /* 111 */ |
| 802 | }; |
| 803 | /****************CAVLC DECODING TABLES ENDS *******************/ |
| 804 | |
| 805 | /****************************************************************************/ |
| 806 | /* These are the codes used for error detection in intra pred4x4 modes */ |
| 807 | /****************************************************************************/ |
| 808 | const UWORD8 gau1_ih264d_intra_pred_err_code[9] = |
| 809 | { 2, 1, 0, 2, 3, 3, 3, 2, 1 }; |
| 810 | |
| 811 | /* Number of users for top field , bottom field, which field needs to be */ |
| 812 | /* displayed first */ |
| 813 | const UWORD8 gau1_ih264d_sei_fld_usage[9][3] = |
| 814 | { |
| 815 | { 1, 1, DISP_FLD_FIRST_UNDEF }, |
| 816 | { 1, 0, DISP_TOP_FLD_FIRST }, |
| 817 | { 0, 1, DISP_BOT_FLD_FIRST }, |
| 818 | { 1, 1, DISP_TOP_FLD_FIRST }, |
| 819 | { 1, 1, DISP_BOT_FLD_FIRST }, |
| 820 | { 2, 1, DISP_TOP_FLD_FIRST }, |
| 821 | { 1, 2, DISP_BOT_FLD_FIRST }, |
| 822 | { 2, 2, DISP_FLD_FIRST_UNDEF }, |
| 823 | { 3, 3, DISP_FLD_FIRST_UNDEF } }; |
| 824 | |
| 825 | /*****************************************************************/ |
| 826 | /* Context increment for significant coefficient(CABAC) */ |
| 827 | /* Requires only 63 elements. But the last element with value -1 */ |
| 828 | /* is kept to make it 64 */ |
| 829 | /*****************************************************************/ |
| 830 | const UWORD8 gau1_ih264d_sigcoeff_context_inc_frame[64] = |
| 831 | { 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5, 4, 4, 4, 4, 3, 3, 6, 7, 7, |
| 832 | 7, 8, 9, 10, 9, 8, 7, 7, 6, 11, 12, 13, 11, 6, 7, 8, 9, 14, 10, 9, 8, 6, |
| 833 | 11, 12, 13, 11, 6, 9, 14, 10, 9, 11, 12, 13, 11, 14, 10, 12, -1 }; |
| 834 | |
| 835 | const UWORD8 gau1_ih264d_sigcoeff_context_inc_field[64] = |
| 836 | { 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5, 6, 9, 10, 10, 8, 11, 12, |
| 837 | 11, 9, 9, 10, 10, 8, 11, 12, 11, 9, 9, 10, 10, 8, 11, 12, 11, 9, 9, 10, |
| 838 | 10, 8, 13, 13, 9, 9, 10, 10, 8, 13, 13, 9, 9, 10, 10, 14, 14, 14, 14, 14, |
| 839 | -1 }; |
| 840 | |
| 841 | const UWORD8 gau1_ih264d_lastcoeff_context_inc[64] = |
| 842 | { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 843 | 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, |
| 844 | 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, -1 }; |
| 845 | |
| 846 | /*! |
| 847 | ************************************************************************** |
| 848 | * \brief gau1_ih264d_top_left_mb_part_indx_mod |
| 849 | * |
| 850 | * SubBlk number of the top left subBlk in each of the MB partition |
| 851 | * (16x16, 16x8, 8x16, 8x8) |
| 852 | ************************************************************************** |
| 853 | */ |
| 854 | const UWORD8 gau1_ih264d_top_left_mb_part_indx_mod[] = |
| 855 | { 0, 0 /* Junk */, /* 16x16 */ |
| 856 | 0, 8, /* 16x8 */ |
| 857 | 0, 2, /* 8x16 */ |
Harish Mahendrakar | 81a8c5d | 2015-12-18 09:58:28 +0530 | [diff] [blame^] | 858 | 0, 2, 8, 10 /* 8x8 */, |
| 859 | 0 /* One extra entry is read at the end of loop, but not used */ |
Hamsalekha S | 8d3d303 | 2015-03-13 21:24:58 +0530 | [diff] [blame] | 860 | }; |
| 861 | |
| 862 | /*! |
| 863 | ************************************************************************** |
| 864 | * \brief gau1_ih264d_submb_indx_mod_sp_drct |
| 865 | * |
| 866 | * Contains increments to the subBlk num in a given subMb partition. |
| 867 | ************************************************************************** |
| 868 | */ |
| 869 | const UWORD8 gau1_ih264d_submb_indx_mod_sp_drct[] = |
| 870 | { 0, 0 /* Junk */, /* 8x8 */ |
| 871 | 0, 4, /* 8x4 */ |
| 872 | 0, 1, /* 4x8 */ |
| 873 | 0, 1, 3, 1 /* 4x4 */ |
| 874 | }; |