armVCM4P10_CAVLCTables.c revision 78e52bfac041d71ce53b5b13c2abf78af742b09d
1/* 2 * Copyright (C) 2007-2008 ARM Limited 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17/* ---------------------------------------------------------------- 18 * 19 * 20 * File Name: armVCM4P10_CAVLCTables.c 21 * OpenMAX DL: v1.0.2 22 * Revision: 12290 23 * Date: Wednesday, April 9, 2008 24 * 25 * 26 * 27 * 28 * Optimized CAVLC tables for H.264 29 * 30 */ 31 32#include "omxtypes.h" 33#include "armOMX.h" 34 35#include "armVCM4P10_CAVLCTables.h" 36 37/* 4x4 DeZigZag table */ 38 39const OMX_U8 armVCM4P10_ZigZag_4x4[16] = 40{ 41 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15 42}; 43 44/* 2x2 DeZigZag table */ 45 46const OMX_U8 armVCM4P10_ZigZag_2x2[4] = 47{ 48 0, 1, 2, 3 49}; 50 51 52/* 53 * Suffix To Level table 54 * We increment the suffix length if 55 * ((LevelCode>>1)+1)>(3<<(SuffixLength-1)) && SuffixLength<6 56 * (LevelCode>>1)>=(3<<(SuffixLength-1)) && SuffixLength<6 57 * LevelCode >= 3<<SuffixLength && SuffixLength<6 58 * (LevelCode+2) >= (3<<SuffixLength)+2 && SuffixLength<6 59 */ 60const OMX_S8 armVCM4P10_SuffixToLevel[7] = 61{ 62 (3<<1)+2, /* SuffixLength=1 */ 63 (3<<1)+2, /* SuffixLength=1 */ 64 (3<<2)+2, /* SuffixLength=2 */ 65 (3<<3)+2, /* SuffixLength=3 */ 66 (3<<4)+2, /* SuffixLength=4 */ 67 (3<<5)+2, /* SuffixLength=5 */ 68 -1 /* SuffixLength=6 - never increment */ 69}; 70 71static const OMX_U16 armVCM4P10_CAVLCCoeffTokenTables_0[132] = { 72 0x0020, 0x0100, 0x2015, 0x2015, 0x400b, 0x400b, 0x400b, 0x400b, 73 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 74 0x0028, 0x00f0, 0x00f8, 0x0027, 0x0030, 0x00d8, 0x00e0, 0x00e8, 75 0x0038, 0x00a0, 0x00c8, 0x00d0, 0x0040, 0x0068, 0x0090, 0x0098, 76 0x0048, 0x0050, 0x0058, 0x0060, 0x27ff, 0x27ff, 0x206b, 0x206b, 77 0x0081, 0x0085, 0x0083, 0x0079, 0x0087, 0x007d, 0x007b, 0x0071, 78 0x007f, 0x0075, 0x0073, 0x0069, 0x0070, 0x0078, 0x0080, 0x0088, 79 0x2077, 0x2077, 0x206d, 0x206d, 0x2063, 0x2063, 0x2061, 0x2061, 80 0x206f, 0x206f, 0x2065, 0x2065, 0x205b, 0x205b, 0x2059, 0x2059, 81 0x0067, 0x005d, 0x0053, 0x0051, 0x005f, 0x0055, 0x004b, 0x0049, 82 0x00a8, 0x00b0, 0x00b8, 0x00c0, 0x2041, 0x2041, 0x204d, 0x204d, 83 0x2043, 0x2043, 0x2039, 0x2039, 0x2057, 0x2057, 0x2045, 0x2045, 84 0x203b, 0x203b, 0x2031, 0x2031, 0x204f, 0x204f, 0x203d, 0x203d, 85 0x2033, 0x2033, 0x2029, 0x2029, 0x0047, 0x0035, 0x002b, 0x0021, 86 0x203f, 0x203f, 0x202d, 0x202d, 0x2023, 0x2023, 0x2019, 0x2019, 87 0x0037, 0x0025, 0x001b, 0x0011, 0x202f, 0x202f, 0x201d, 0x201d, 88 0x0013, 0x0009, 0x201f, 0x201f 89}; 90 91static const OMX_U16 armVCM4P10_CAVLCCoeffTokenTables_1[128] = { 92 0x0020, 0x00e8, 0x00f0, 0x00f8, 0x0027, 0x001f, 0x2015, 0x2015, 93 0x400b, 0x400b, 0x400b, 0x400b, 0x4001, 0x4001, 0x4001, 0x4001, 94 0x0028, 0x00d0, 0x00d8, 0x00e0, 0x0030, 0x0098, 0x00c0, 0x00c8, 95 0x0038, 0x0060, 0x0088, 0x0090, 0x0040, 0x0048, 0x0050, 0x0058, 96 0x27ff, 0x27ff, 0x207f, 0x207f, 0x0087, 0x0085, 0x0083, 0x0081, 97 0x007b, 0x0079, 0x007d, 0x0073, 0x2075, 0x2075, 0x2071, 0x2071, 98 0x0068, 0x0070, 0x0078, 0x0080, 0x2077, 0x2077, 0x206d, 0x206d, 99 0x206b, 0x206b, 0x2069, 0x2069, 0x206f, 0x206f, 0x2065, 0x2065, 100 0x2063, 0x2063, 0x2061, 0x2061, 0x0059, 0x005d, 0x005b, 0x0051, 101 0x0067, 0x0055, 0x0053, 0x0049, 0x00a0, 0x00a8, 0x00b0, 0x00b8, 102 0x205f, 0x205f, 0x204d, 0x204d, 0x204b, 0x204b, 0x2041, 0x2041, 103 0x2057, 0x2057, 0x2045, 0x2045, 0x2043, 0x2043, 0x2039, 0x2039, 104 0x204f, 0x204f, 0x203d, 0x203d, 0x203b, 0x203b, 0x2031, 0x2031, 105 0x0029, 0x0035, 0x0033, 0x0021, 0x2047, 0x2047, 0x202d, 0x202d, 106 0x202b, 0x202b, 0x2019, 0x2019, 0x003f, 0x0025, 0x0023, 0x0011, 107 0x0037, 0x001d, 0x001b, 0x0009, 0x202f, 0x202f, 0x2013, 0x2013 108}; 109 110static const OMX_U16 armVCM4P10_CAVLCCoeffTokenTables_2[112] = { 111 0x0020, 0x0088, 0x00b0, 0x00b8, 0x00c0, 0x00c8, 0x00d0, 0x00d8, 112 0x003f, 0x0037, 0x002f, 0x0027, 0x001f, 0x0015, 0x000b, 0x0001, 113 0x0028, 0x0050, 0x0078, 0x0080, 0x0030, 0x0038, 0x0040, 0x0048, 114 0x07ff, 0x0081, 0x0087, 0x0085, 0x0083, 0x0079, 0x007f, 0x007d, 115 0x007b, 0x0071, 0x0077, 0x0075, 0x0073, 0x0069, 0x206b, 0x206b, 116 0x0058, 0x0060, 0x0068, 0x0070, 0x2061, 0x2061, 0x206d, 0x206d, 117 0x2063, 0x2063, 0x2059, 0x2059, 0x206f, 0x206f, 0x2065, 0x2065, 118 0x205b, 0x205b, 0x2051, 0x2051, 0x0067, 0x005d, 0x0053, 0x0049, 119 0x005f, 0x0055, 0x004b, 0x0041, 0x0090, 0x0098, 0x00a0, 0x00a8, 120 0x2039, 0x2039, 0x2031, 0x2031, 0x204d, 0x204d, 0x2029, 0x2029, 121 0x2057, 0x2057, 0x2045, 0x2045, 0x2043, 0x2043, 0x2021, 0x2021, 122 0x0019, 0x003d, 0x003b, 0x0011, 0x004f, 0x0035, 0x0033, 0x0009, 123 0x202b, 0x202b, 0x202d, 0x202d, 0x2023, 0x2023, 0x2025, 0x2025, 124 0x201b, 0x201b, 0x2047, 0x2047, 0x201d, 0x201d, 0x2013, 0x2013 125}; 126 127static const OMX_U16 armVCM4P10_CAVLCCoeffTokenTables_3[80] = { 128 0x0020, 0x0028, 0x0030, 0x0038, 0x0040, 0x0048, 0x0050, 0x0058, 129 0x0060, 0x0068, 0x0070, 0x0078, 0x0080, 0x0088, 0x0090, 0x0098, 130 0x0009, 0x000b, 0x07ff, 0x0001, 0x0011, 0x0013, 0x0015, 0x07ff, 131 0x0019, 0x001b, 0x001d, 0x001f, 0x0021, 0x0023, 0x0025, 0x0027, 132 0x0029, 0x002b, 0x002d, 0x002f, 0x0031, 0x0033, 0x0035, 0x0037, 133 0x0039, 0x003b, 0x003d, 0x003f, 0x0041, 0x0043, 0x0045, 0x0047, 134 0x0049, 0x004b, 0x004d, 0x004f, 0x0051, 0x0053, 0x0055, 0x0057, 135 0x0059, 0x005b, 0x005d, 0x005f, 0x0061, 0x0063, 0x0065, 0x0067, 136 0x0069, 0x006b, 0x006d, 0x006f, 0x0071, 0x0073, 0x0075, 0x0077, 137 0x0079, 0x007b, 0x007d, 0x007f, 0x0081, 0x0083, 0x0085, 0x0087 138}; 139 140static const OMX_U16 armVCM4P10_CAVLCCoeffTokenTables_4[32] = { 141 0x0020, 0x0038, 0x2015, 0x2015, 0x4001, 0x4001, 0x4001, 0x4001, 142 0x600b, 0x600b, 0x600b, 0x600b, 0x600b, 0x600b, 0x600b, 0x600b, 143 0x0028, 0x0030, 0x0021, 0x0019, 0x2027, 0x2027, 0x0025, 0x0023, 144 0x201d, 0x201d, 0x201b, 0x201b, 0x0011, 0x001f, 0x0013, 0x0009 145}; 146 147const OMX_U16 * armVCM4P10_CAVLCCoeffTokenTables[18] = { 148 armVCM4P10_CAVLCCoeffTokenTables_0, /* nC=0 */ 149 armVCM4P10_CAVLCCoeffTokenTables_0, /* nC=1 */ 150 armVCM4P10_CAVLCCoeffTokenTables_1, /* nC=2 */ 151 armVCM4P10_CAVLCCoeffTokenTables_1, /* nC=3 */ 152 armVCM4P10_CAVLCCoeffTokenTables_2, /* nC=4 */ 153 armVCM4P10_CAVLCCoeffTokenTables_2, /* nC=5 */ 154 armVCM4P10_CAVLCCoeffTokenTables_2, /* nC=6 */ 155 armVCM4P10_CAVLCCoeffTokenTables_2, /* nC=7 */ 156 armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=8 */ 157 armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=9 */ 158 armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=10 */ 159 armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=11 */ 160 armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=12 */ 161 armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=13 */ 162 armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=14 */ 163 armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=15 */ 164 armVCM4P10_CAVLCCoeffTokenTables_3, /* nC=16 */ 165 armVCM4P10_CAVLCCoeffTokenTables_4 /* nC=-1 */ 166}; 167 168static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_0[40] = { 169 0x0020, 0x0048, 0x0009, 0x0007, 0x2005, 0x2005, 0x2003, 0x2003, 170 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 171 0x0028, 0x0040, 0x0011, 0x000f, 0x0030, 0x0038, 0x0019, 0x0017, 172 0x27ff, 0x27ff, 0x201f, 0x201f, 0x201d, 0x201d, 0x201b, 0x201b, 173 0x2015, 0x2015, 0x2013, 0x2013, 0x200d, 0x200d, 0x200b, 0x200b 174}; 175 176static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_1[24] = { 177 0x0020, 0x0028, 0x0011, 0x000f, 0x000d, 0x000b, 0x2009, 0x2009, 178 0x2007, 0x2007, 0x2005, 0x2005, 0x2003, 0x2003, 0x2001, 0x2001, 179 0x001d, 0x001b, 0x0019, 0x0017, 0x2015, 0x2015, 0x2013, 0x2013 180}; 181 182static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_2[24] = { 183 0x0020, 0x0028, 0x0011, 0x000b, 0x0009, 0x0001, 0x200f, 0x200f, 184 0x200d, 0x200d, 0x2007, 0x2007, 0x2005, 0x2005, 0x2003, 0x2003, 185 0x001b, 0x0017, 0x2019, 0x2019, 0x2015, 0x2015, 0x2013, 0x2013 186}; 187 188static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_3[24] = { 189 0x0020, 0x0028, 0x0013, 0x000f, 0x0007, 0x0005, 0x2011, 0x2011, 190 0x200d, 0x200d, 0x200b, 0x200b, 0x2009, 0x2009, 0x2003, 0x2003, 191 0x2019, 0x2019, 0x2017, 0x2017, 0x2015, 0x2015, 0x2001, 0x2001 192}; 193 194static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_4[20] = { 195 0x0020, 0x0015, 0x0011, 0x0005, 0x0003, 0x0001, 0x200f, 0x200f, 196 0x200d, 0x200d, 0x200b, 0x200b, 0x2009, 0x2009, 0x2007, 0x2007, 197 0x2017, 0x2017, 0x2013, 0x2013 198}; 199 200static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_5[20] = { 201 0x0020, 0x0011, 0x2013, 0x2013, 0x200f, 0x200f, 0x200d, 0x200d, 202 0x200b, 0x200b, 0x2009, 0x2009, 0x2007, 0x2007, 0x2005, 0x2005, 203 0x0015, 0x0001, 0x2003, 0x2003 204}; 205 206static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_6[20] = { 207 0x0020, 0x000f, 0x2011, 0x2011, 0x200d, 0x200d, 0x2009, 0x2009, 208 0x2007, 0x2007, 0x2005, 0x2005, 0x400b, 0x400b, 0x400b, 0x400b, 209 0x0013, 0x0001, 0x2003, 0x2003 210}; 211 212static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_7[20] = { 213 0x0020, 0x0003, 0x200f, 0x200f, 0x200d, 0x200d, 0x2007, 0x2007, 214 0x400b, 0x400b, 0x400b, 0x400b, 0x4009, 0x4009, 0x4009, 0x4009, 215 0x0011, 0x0001, 0x2005, 0x2005 216}; 217 218static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_8[20] = { 219 0x0020, 0x0005, 0x200b, 0x200b, 0x400d, 0x400d, 0x400d, 0x400d, 220 0x4009, 0x4009, 0x4009, 0x4009, 0x4007, 0x4007, 0x4007, 0x4007, 221 0x0003, 0x0001, 0x200f, 0x200f 222}; 223 224static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_9[20] = { 225 0x0020, 0x000d, 0x2005, 0x2005, 0x400b, 0x400b, 0x400b, 0x400b, 226 0x4009, 0x4009, 0x4009, 0x4009, 0x4007, 0x4007, 0x4007, 0x4007, 227 0x2003, 0x2003, 0x2001, 0x2001 228}; 229 230static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_10[16] = { 231 0x0001, 0x0003, 0x2005, 0x2005, 0x2007, 0x2007, 0x200b, 0x200b, 232 0x6009, 0x6009, 0x6009, 0x6009, 0x6009, 0x6009, 0x6009, 0x6009 233}; 234 235static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_11[16] = { 236 0x0001, 0x0003, 0x2009, 0x2009, 0x4005, 0x4005, 0x4005, 0x4005, 237 0x6007, 0x6007, 0x6007, 0x6007, 0x6007, 0x6007, 0x6007, 0x6007 238}; 239 240static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_12[16] = { 241 0x2001, 0x2001, 0x2003, 0x2003, 0x4007, 0x4007, 0x4007, 0x4007, 242 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005 243}; 244 245static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_13[16] = { 246 0x4001, 0x4001, 0x4001, 0x4001, 0x4003, 0x4003, 0x4003, 0x4003, 247 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005, 0x6005 248}; 249 250static const OMX_U16 armVCM4P10_CAVLCTotalZeroTables_14[16] = { 251 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 252 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003 253}; 254 255const OMX_U16 * armVCM4P10_CAVLCTotalZeroTables[15] = { 256 armVCM4P10_CAVLCTotalZeroTables_0, 257 armVCM4P10_CAVLCTotalZeroTables_1, 258 armVCM4P10_CAVLCTotalZeroTables_2, 259 armVCM4P10_CAVLCTotalZeroTables_3, 260 armVCM4P10_CAVLCTotalZeroTables_4, 261 armVCM4P10_CAVLCTotalZeroTables_5, 262 armVCM4P10_CAVLCTotalZeroTables_6, 263 armVCM4P10_CAVLCTotalZeroTables_7, 264 armVCM4P10_CAVLCTotalZeroTables_8, 265 armVCM4P10_CAVLCTotalZeroTables_9, 266 armVCM4P10_CAVLCTotalZeroTables_10, 267 armVCM4P10_CAVLCTotalZeroTables_11, 268 armVCM4P10_CAVLCTotalZeroTables_12, 269 armVCM4P10_CAVLCTotalZeroTables_13, 270 armVCM4P10_CAVLCTotalZeroTables_14 271}; 272 273static const OMX_U16 armVCM4P10_CAVLCTotalZeros2x2Tables_0[16] = { 274 0x2007, 0x2007, 0x2005, 0x2005, 0x4003, 0x4003, 0x4003, 0x4003, 275 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001 276}; 277 278static const OMX_U16 armVCM4P10_CAVLCTotalZeros2x2Tables_1[16] = { 279 0x4005, 0x4005, 0x4005, 0x4005, 0x4003, 0x4003, 0x4003, 0x4003, 280 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001 281}; 282 283static const OMX_U16 armVCM4P10_CAVLCTotalZeros2x2Tables_2[16] = { 284 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 0x6003, 285 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001, 0x6001 286}; 287 288const OMX_U16 * armVCM4P10_CAVLCTotalZeros2x2Tables[3] = { 289 armVCM4P10_CAVLCTotalZeros2x2Tables_0, 290 armVCM4P10_CAVLCTotalZeros2x2Tables_1, 291 armVCM4P10_CAVLCTotalZeros2x2Tables_2 292}; 293 294static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_0[8] = { 295 0x4003, 0x4003, 0x4003, 0x4003, 0x4001, 0x4001, 0x4001, 0x4001 296}; 297 298static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_1[8] = { 299 0x2005, 0x2005, 0x2003, 0x2003, 0x4001, 0x4001, 0x4001, 0x4001 300}; 301 302static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_2[8] = { 303 0x2007, 0x2007, 0x2005, 0x2005, 0x2003, 0x2003, 0x2001, 0x2001 304}; 305 306static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_3[8] = { 307 0x0009, 0x0007, 0x2005, 0x2005, 0x2003, 0x2003, 0x2001, 0x2001 308}; 309 310static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_4[8] = { 311 0x000b, 0x0009, 0x0007, 0x0005, 0x2003, 0x2003, 0x2001, 0x2001 312}; 313 314static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_5[8] = { 315 0x0003, 0x0005, 0x0009, 0x0007, 0x000d, 0x000b, 0x2001, 0x2001 316}; 317 318static const OMX_U16 armVCM4P10_CAVLCRunBeforeTables_6[24] = { 319 0x0010, 0x000d, 0x000b, 0x0009, 0x0007, 0x0005, 0x0003, 0x0001, 320 0x0018, 0x0011, 0x200f, 0x200f, 0x0020, 0x0015, 0x2013, 0x2013, 321 0x0028, 0x0019, 0x2017, 0x2017, 0x07ff, 0x001d, 0x201b, 0x201b 322}; 323 324/* Tables 7 to 14 are duplicates of table 6 */ 325 326const OMX_U16 * armVCM4P10_CAVLCRunBeforeTables[15] = { 327 armVCM4P10_CAVLCRunBeforeTables_0, /* ZerosLeft=1 */ 328 armVCM4P10_CAVLCRunBeforeTables_1, 329 armVCM4P10_CAVLCRunBeforeTables_2, 330 armVCM4P10_CAVLCRunBeforeTables_3, 331 armVCM4P10_CAVLCRunBeforeTables_4, 332 armVCM4P10_CAVLCRunBeforeTables_5, /* ZerosLeft=6 */ 333 armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=7 */ 334 armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=8 */ 335 armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=9 */ 336 armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=10 */ 337 armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=11 */ 338 armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=12 */ 339 armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=13 */ 340 armVCM4P10_CAVLCRunBeforeTables_6, /* ZerosLeft=14 */ 341 armVCM4P10_CAVLCRunBeforeTables_6 /* ZerosLeft=15 */ 342}; 343