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