C++程序  |  466行  |  26.57 KB

/******************************************************************************
 *
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *****************************************************************************
 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include "iv_datatypedef.h"
#include "impeg2d_vld_tables.h"

/* Table to be used for decoding the MB increment value */
const WORD16 gai2_impeg2d_mb_addr_incr[][2] =
{
  {1,-33},{3,2},{-31,-32},{5,4},{-29,-30},{7,6},{-27,-28},{13,8},{10,9},
  {-25,-26},{12,11},{-23,-24},{-21,-22},{25,14},{16,15},{-19,-20},{20,17},
  {19,18},{-17,-18},{-15,-16},{22,21},{-13,-14},{24,23},{-11,-12},{-9,-10},
  {34,26},{0,27},{31,28},{30,29},{-7,-8},{-5,-6},{33,32},{-3,-4},{-1,-2},
  {0,35},{36,0},{37,0},{-34,0}
};

/* Table to be used for decoding the MB type in case of P Pictures */
const UWORD16 gau2_impeg2d_p_mb_type[] =
{
    0x0100, 0x0611, 0x0512, 0x0512, 0x051a, 0x051a, 0x0501, 0x0501, 0x0308, 0x0308,
    0x0308, 0x0308, 0x0308, 0x0308, 0x0308, 0x0308, 0x0202, 0x0202, 0x0202, 0x0202,
    0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202,
    0x0202, 0x0202, 0x010a, 0x010a, 0x010a, 0x010a, 0x010a, 0x010a, 0x010a, 0x010a,
    0x010a, 0x010a, 0x010a, 0x010a, 0x010a, 0x010a, 0x010a, 0x010a, 0x010a, 0x010a,
    0x010a, 0x010a, 0x010a, 0x010a, 0x010a, 0x010a, 0x010a, 0x010a, 0x010a, 0x010a,
    0x010a, 0x010a, 0x010a, 0x010a
};
/* Table to be used for decoding the MB type in case of B Pictures */
const UWORD16 gau2_impeg2d_b_mb_type[] =
{
    0x0100, 0x0611, 0x0616, 0x061a, 0x053e, 0x053e, 0x0501, 0x0501, 0x0408, 0x0408,
    0x0408, 0x0408, 0x040a, 0x040a, 0x040a, 0x040a, 0x0304, 0x0304, 0x0304, 0x0304,
    0x0304, 0x0304, 0x0304, 0x0304, 0x0306, 0x0306, 0x0306, 0x0306, 0x0306, 0x0306,
    0x0306, 0x0306, 0x022c, 0x022c, 0x022c, 0x022c, 0x022c, 0x022c, 0x022c, 0x022c,
    0x022c, 0x022c, 0x022c, 0x022c, 0x022c, 0x022c, 0x022c, 0x022c, 0x022e, 0x022e,
    0x022e, 0x022e, 0x022e, 0x022e, 0x022e, 0x022e, 0x022e, 0x022e, 0x022e, 0x022e,
    0x022e, 0x022e, 0x022e, 0x022e
};
/* Table to be used for decoding dmvector[t] */
const WORD16 gai2_impeg2d_dec_mv[] =
{
    1,-1
};

/* Tables used for motion code decode */
const UWORD16 gau2_impeg2d_mv_code[] =
{
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0f0a, 0x0e0a, 0x0d0a, 0x0c0a, 0x0b0a, 0x0a0a, 0x0909, 0x0909,
    0x0809, 0x0809, 0x0709, 0x0709, 0x0607, 0x0607, 0x0607, 0x0607, 0x0607, 0x0607,
    0x0607, 0x0607, 0x0507, 0x0507, 0x0507, 0x0507, 0x0507, 0x0507, 0x0507, 0x0507,
    0x0407, 0x0407, 0x0407, 0x0407, 0x0407, 0x0407, 0x0407, 0x0407, 0x0306, 0x0306,
    0x0306, 0x0306, 0x0306, 0x0306, 0x0306, 0x0306, 0x0306, 0x0306, 0x0306, 0x0306,
    0x0306, 0x0306, 0x0306, 0x0306, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204,
    0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204,
    0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204,
    0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204,
    0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204,
    0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204,
    0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0204, 0x0103, 0x0103,
    0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103,
    0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103,
    0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103,
    0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103,
    0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103,
    0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103,
    0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103,
    0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103,
    0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103,
    0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103,
    0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103,
    0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103,
    0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0103, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
    0x0002, 0x0002
};
/* Tables used for cbp decode */
const UWORD16 gau2_impeg2d_cbp_code[] =
{
    0x0100, 0x0100, 0x0927, 0x091b, 0x093b, 0x0937, 0x092f, 0x091f, 0x083a, 0x083a,
    0x0836, 0x0836, 0x082e, 0x082e, 0x081e, 0x081e, 0x0839, 0x0839, 0x0835, 0x0835,
    0x082d, 0x082d, 0x081d, 0x081d, 0x0826, 0x0826, 0x081a, 0x081a, 0x0825, 0x0825,
    0x0819, 0x0819, 0x082b, 0x082b, 0x0817, 0x0817, 0x0833, 0x0833, 0x080f, 0x080f,
    0x082a, 0x082a, 0x0816, 0x0816, 0x0832, 0x0832, 0x080e, 0x080e, 0x0829, 0x0829,
    0x0815, 0x0815, 0x0831, 0x0831, 0x080d, 0x080d, 0x0823, 0x0823, 0x0813, 0x0813,
    0x080b, 0x080b, 0x0807, 0x0807, 0x0722, 0x0722, 0x0722, 0x0722, 0x0712, 0x0712,
    0x0712, 0x0712, 0x070a, 0x070a, 0x070a, 0x070a, 0x0706, 0x0706, 0x0706, 0x0706,
    0x0721, 0x0721, 0x0721, 0x0721, 0x0711, 0x0711, 0x0711, 0x0711, 0x0709, 0x0709,
    0x0709, 0x0709, 0x0705, 0x0705, 0x0705, 0x0705, 0x063f, 0x063f, 0x063f, 0x063f,
    0x063f, 0x063f, 0x063f, 0x063f, 0x0603, 0x0603, 0x0603, 0x0603, 0x0603, 0x0603,
    0x0603, 0x0603, 0x0624, 0x0624, 0x0624, 0x0624, 0x0624, 0x0624, 0x0624, 0x0624,
    0x0618, 0x0618, 0x0618, 0x0618, 0x0618, 0x0618, 0x0618, 0x0618, 0x053e, 0x053e,
    0x053e, 0x053e, 0x053e, 0x053e, 0x053e, 0x053e, 0x053e, 0x053e, 0x053e, 0x053e,
    0x053e, 0x053e, 0x053e, 0x053e, 0x0502, 0x0502, 0x0502, 0x0502, 0x0502, 0x0502,
    0x0502, 0x0502, 0x0502, 0x0502, 0x0502, 0x0502, 0x0502, 0x0502, 0x0502, 0x0502,
    0x053d, 0x053d, 0x053d, 0x053d, 0x053d, 0x053d, 0x053d, 0x053d, 0x053d, 0x053d,
    0x053d, 0x053d, 0x053d, 0x053d, 0x053d, 0x053d, 0x0501, 0x0501, 0x0501, 0x0501,
    0x0501, 0x0501, 0x0501, 0x0501, 0x0501, 0x0501, 0x0501, 0x0501, 0x0501, 0x0501,
    0x0501, 0x0501, 0x0538, 0x0538, 0x0538, 0x0538, 0x0538, 0x0538, 0x0538, 0x0538,
    0x0538, 0x0538, 0x0538, 0x0538, 0x0538, 0x0538, 0x0538, 0x0538, 0x0534, 0x0534,
    0x0534, 0x0534, 0x0534, 0x0534, 0x0534, 0x0534, 0x0534, 0x0534, 0x0534, 0x0534,
    0x0534, 0x0534, 0x0534, 0x0534, 0x052c, 0x052c, 0x052c, 0x052c, 0x052c, 0x052c,
    0x052c, 0x052c, 0x052c, 0x052c, 0x052c, 0x052c, 0x052c, 0x052c, 0x052c, 0x052c,
    0x051c, 0x051c, 0x051c, 0x051c, 0x051c, 0x051c, 0x051c, 0x051c, 0x051c, 0x051c,
    0x051c, 0x051c, 0x051c, 0x051c, 0x051c, 0x051c, 0x0528, 0x0528, 0x0528, 0x0528,
    0x0528, 0x0528, 0x0528, 0x0528, 0x0528, 0x0528, 0x0528, 0x0528, 0x0528, 0x0528,
    0x0528, 0x0528, 0x0514, 0x0514, 0x0514, 0x0514, 0x0514, 0x0514, 0x0514, 0x0514,
    0x0514, 0x0514, 0x0514, 0x0514, 0x0514, 0x0514, 0x0514, 0x0514, 0x0530, 0x0530,
    0x0530, 0x0530, 0x0530, 0x0530, 0x0530, 0x0530, 0x0530, 0x0530, 0x0530, 0x0530,
    0x0530, 0x0530, 0x0530, 0x0530, 0x050c, 0x050c, 0x050c, 0x050c, 0x050c, 0x050c,
    0x050c, 0x050c, 0x050c, 0x050c, 0x050c, 0x050c, 0x050c, 0x050c, 0x050c, 0x050c,
    0x0420, 0x0420, 0x0420, 0x0420, 0x0420, 0x0420, 0x0420, 0x0420, 0x0420, 0x0420,
    0x0420, 0x0420, 0x0420, 0x0420, 0x0420, 0x0420, 0x0420, 0x0420, 0x0420, 0x0420,
    0x0420, 0x0420, 0x0420, 0x0420, 0x0420, 0x0420, 0x0420, 0x0420, 0x0420, 0x0420,
    0x0420, 0x0420, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410,
    0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410,
    0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410,
    0x0410, 0x0410, 0x0410, 0x0410, 0x0408, 0x0408, 0x0408, 0x0408, 0x0408, 0x0408,
    0x0408, 0x0408, 0x0408, 0x0408, 0x0408, 0x0408, 0x0408, 0x0408, 0x0408, 0x0408,
    0x0408, 0x0408, 0x0408, 0x0408, 0x0408, 0x0408, 0x0408, 0x0408, 0x0408, 0x0408,
    0x0408, 0x0408, 0x0408, 0x0408, 0x0408, 0x0408, 0x0404, 0x0404, 0x0404, 0x0404,
    0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404,
    0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404,
    0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x033c, 0x033c,
    0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c,
    0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c,
    0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c,
    0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c,
    0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c,
    0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c, 0x033c,
    0x033c, 0x033c
};


/* Table B.14 DCT Coefficients Table zero */
const UWORD16 gau2_impeg2d_dct_coeff_zero[] =
{
  2640,2608,2576,2544,12400,32848,30800,28752,26704,24656,22608,63536,61488,
    59440,57392,55344,1295,1263,1231,1199,1167,1135,1103,1071,1039,2511,2479,
    2447,2415,2383,2351,2319,1006,974,942,910,878,846,814,782,750,718,686,654,
    622,590,558,526,20557,18509,10349,6285,4269,2285,2253,493,461,429,397,
    53293,51245,49197,47149,45101,364,16460,8300,332,4236,14412,43052,41004,
    300,38956,36908,2220,6252,268,12364,34860,32810,10314,234,4202,2186,30762,
    28714,8266,ESCAPE_CODE,4167,18471,135,16423,14374,12326,2118,10278,26664,
    200,24616,22568,6216,2152,168,20520,101,101,101,101,101,101,101,101,8229,
    8229,8229,8229,8229,8229,8229,8229,6181,6181,6181,6181,6181,6181,6181,6181,
    68,4132,2083,2083,END_OF_BLOCK,34
};

/* tab Zero b.14 for 1-9 bits*/
const UWORD16 gau2_impeg2d_tab_zero_1_9[] =
{
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x01f6, 0x01f6, 0x01f6, 0x01f6, 0x01f6, 0x01f6, 0x01f6, 0x01f6,
    0x0428, 0x0428, 0xfc28, 0xfc28, 0x0298, 0x0298, 0xfe98, 0xfe98,
    0x0808, 0x0808, 0xf808, 0xf808, 0x0288, 0x0288, 0xfe88, 0xfe88,
    0x0277, 0x0277, 0x0277, 0x0277, 0xfe77, 0xfe77, 0xfe77, 0xfe77,
    0x0267, 0x0267, 0x0267, 0x0267, 0xfe67, 0xfe67, 0xfe67, 0xfe67,
    0x0417, 0x0417, 0x0417, 0x0417, 0xfc17, 0xfc17, 0xfc17, 0xfc17,
    0x0257, 0x0257, 0x0257, 0x0257, 0xfe57, 0xfe57, 0xfe57, 0xfe57,
    0x02d9, 0xfed9, 0x0c09, 0xf409, 0x02c9, 0xfec9, 0x02b9, 0xfeb9,
    0x0439, 0xfc39, 0x0619, 0xfa19, 0x0a09, 0xf609, 0x02a9, 0xfea9,
    0x0606, 0x0606, 0x0606, 0x0606, 0x0606, 0x0606, 0x0606, 0x0606,
    0xfa06, 0xfa06, 0xfa06, 0xfa06, 0xfa06, 0xfa06, 0xfa06, 0xfa06,
    0x0246, 0x0246, 0x0246, 0x0246, 0x0246, 0x0246, 0x0246, 0x0246,
    0xfe46, 0xfe46, 0xfe46, 0xfe46, 0xfe46, 0xfe46, 0xfe46, 0xfe46,
    0x0236, 0x0236, 0x0236, 0x0236, 0x0236, 0x0236, 0x0236, 0x0236,
    0xfe36, 0xfe36, 0xfe36, 0xfe36, 0xfe36, 0xfe36, 0xfe36, 0xfe36,
    0x0405, 0x0405, 0x0405, 0x0405, 0x0405, 0x0405, 0x0405, 0x0405,
    0x0405, 0x0405, 0x0405, 0x0405, 0x0405, 0x0405, 0x0405, 0x0405,
    0xfc05, 0xfc05, 0xfc05, 0xfc05, 0xfc05, 0xfc05, 0xfc05, 0xfc05,
    0xfc05, 0xfc05, 0xfc05, 0xfc05, 0xfc05, 0xfc05, 0xfc05, 0xfc05,
    0x0225, 0x0225, 0x0225, 0x0225, 0x0225, 0x0225, 0x0225, 0x0225,
    0x0225, 0x0225, 0x0225, 0x0225, 0x0225, 0x0225, 0x0225, 0x0225,
    0xfe25, 0xfe25, 0xfe25, 0xfe25, 0xfe25, 0xfe25, 0xfe25, 0xfe25,
    0xfe25, 0xfe25, 0xfe25, 0xfe25, 0xfe25, 0xfe25, 0xfe25, 0xfe25,
    0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214,
    0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214,
    0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214,
    0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214,
    0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14,
    0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14,
    0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14,
    0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03
};

const UWORD16 gau2_impeg2d_tab_zero_10_16[] =
{
    /*Six leading zeros*/
    0x0300, 0x0300, 0xff00, 0xff00, 0x0450, 0x0450, 0xfc50, 0xfc50,
    0x0e00, 0x0e00, 0xf200, 0xf200, 0x0620, 0x0620, 0xfa20, 0xfa20,
    0x0810, 0x0810, 0xf810, 0xf810, 0x02f0, 0x02f0, 0xfef0, 0xfef0,
    0x02e0, 0x02e0, 0xfee0, 0xfee0, 0x0440, 0x0440, 0xfc40, 0xfc40,
    /*Seven leading zeros*/
    0x1602, 0xea02, 0x0482, 0xfc82, 0x0642, 0xfa42, 0x1402, 0xec02,
    0x0822, 0xf822, 0x0472, 0xfc72, 0x0352, 0xff52, 0x0342, 0xff42,
    0x1202, 0xee02, 0x0332, 0xff32, 0x0322, 0xff22, 0x0a12, 0xf612,
    0x0632, 0xfa32, 0x1002, 0xf002, 0x0462, 0xfc62, 0x0312, 0xff12,
    /*Eight leading zeros*/
    0x04a3, 0xfca3, 0x0493, 0xfc93, 0x0653, 0xfa53, 0x0833, 0xf833,
    0x0a23, 0xf623, 0x0e13, 0xf213, 0x0c13, 0xf413, 0x1e03, 0xe203,
    0x1c03, 0xe403, 0x1a03, 0xe603, 0x1803, 0xe803, 0x03a3, 0xffa3,
    0x0393, 0xff93, 0x0383, 0xff83, 0x0373, 0xff73, 0x0363, 0xff63,
    /*Nine leading zeros*/
    0x3e04, 0xc204, 0x3c04, 0xc404, 0x3a04, 0xc604, 0x3804, 0xc804,
    0x3604, 0xca04, 0x3404, 0xcc04, 0x3204, 0xce04, 0x3004, 0xd004,
    0x2e04, 0xd204, 0x2c04, 0xd404, 0x2a04, 0xd604, 0x2804, 0xd804,
    0x2604, 0xda04, 0x2404, 0xdc04, 0x2204, 0xde04, 0x2004, 0xe004,
    /*Ten leading zeros*/
    0x5005, 0xb005, 0x4e05, 0xb205, 0x4c05, 0xb405, 0x4a05, 0xb605,
    0x4805, 0xb805, 0x4605, 0xba05, 0x4405, 0xbc05, 0x4205, 0xbe05,
    0x4005, 0xc005, 0x1c15, 0xe415, 0x1a15, 0xe615, 0x1815, 0xe815,
    0x1615, 0xea15, 0x1415, 0xec15, 0x1215, 0xee15, 0x1015, 0xf015,
    /*Eleven leading zeros*/
    0x2416, 0xdc16, 0x2216, 0xde16, 0x2016, 0xe016, 0x1e16, 0xe216,
    0x0666, 0xfa66, 0x0506, 0xfd06, 0x04f6, 0xfcf6, 0x04e6, 0xfce6,
    0x04d6, 0xfcd6, 0x04c6, 0xfcc6, 0x04b6, 0xfcb6, 0x03f6, 0xfff6,
    0x03e6, 0xffe6, 0x03d6, 0xffd6, 0x03c6, 0xffc6, 0x03b6, 0xffb6

};

/* Table B.14 DCT Coefficients Table one */
const UWORD16 gau2_impeg2d_dct_coeff_one[] =
{
    2640,2608,2576,2544,12400,32848,30800,28752,26704,24656,22608,63536,61488,
    59440,57392,55344,1295,1263,1231,1199,1167,1135,1103,1071,1039,2511,2479,
    2447,2415,2383,2351,2319,1006,974,942,910,878,846,814,782,750,718,686,654,
    622,590,558,526,20557,18509,10349,6285,4269,2285,2253,0,0,0,0,53293,51245,
    49197,47149,45101,16460,8300,0,0,14412,43052,41004,0,38956,36908,0,6252,
    0,12364,34860,10313,10313,28713,28713,4234,32810,30761,30761,ESCAPE_CODE,
    14375,16423,12327,4167,230,198,8230,10278,2216,22568,360,328,26664,24616,
    6216,2184,4133,4133,4133,4133,4133,4133,4133,4133,2117,2117,2117,2117,2117,
    2117,2117,2117,6181,6181,6181,6181,6181,6181,6181,6181,2083,2083,
    END_OF_BLOCK,100,18471,18471,2151,2151,20519,20519,263,263,295,295,392,424,
    4200,8264,456,488,34,34,34,34,34,34,34,34,67,67,67,67,133,165
};

/* tab Zero b.15 for 1-9 bits*/
const UWORD16 gau2_impeg2d_tab_one_1_9[] =
{
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x01f6, 0x01f6, 0x01f6, 0x01f6, 0x01f6, 0x01f6, 0x01f6, 0x01f6,
    0x0278, 0x0278, 0xfe78, 0xfe78, 0x0288, 0x0288, 0xfe88, 0xfe88,
    0x0268, 0x0268, 0xfe68, 0xfe68, 0x0428, 0x0428, 0xfc28, 0xfc28,
    0x0e07, 0x0e07, 0x0e07, 0x0e07, 0xf207, 0xf207, 0xf207, 0xf207,
    0x0c07, 0x0c07, 0x0c07, 0x0c07, 0xf407, 0xf407, 0xf407, 0xf407,
    0x0247, 0x0247, 0x0247, 0x0247, 0xfe47, 0xfe47, 0xfe47, 0xfe47,
    0x0257, 0x0257, 0x0257, 0x0257, 0xfe57, 0xfe57, 0xfe57, 0xfe57,
    0x0a19, 0xf619, 0x02b9, 0xfeb9, 0x1609, 0xea09, 0x1409, 0xec09,
    0x02d9, 0xfed9, 0x02c9, 0xfec9, 0x0439, 0xfc39, 0x0819, 0xf819,
    0x0226, 0x0226, 0x0226, 0x0226, 0x0226, 0x0226, 0x0226, 0x0226,
    0xfe26, 0xfe26, 0xfe26, 0xfe26, 0xfe26, 0xfe26, 0xfe26, 0xfe26,
    0x0416, 0x0416, 0x0416, 0x0416, 0x0416, 0x0416, 0x0416, 0x0416,
    0xfc16, 0xfc16, 0xfc16, 0xfc16, 0xfc16, 0xfc16, 0xfc16, 0xfc16,
    0x0236, 0x0236, 0x0236, 0x0236, 0x0236, 0x0236, 0x0236, 0x0236,
    0xfe36, 0xfe36, 0xfe36, 0xfe36, 0xfe36, 0xfe36, 0xfe36, 0xfe36,
    0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214,
    0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214,
    0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214,
    0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214, 0x0214,
    0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14,
    0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14,
    0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14,
    0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14, 0xfe14,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff, 0x01ff,
    0x0605, 0x0605, 0x0605, 0x0605, 0x0605, 0x0605, 0x0605, 0x0605,
    0x0605, 0x0605, 0x0605, 0x0605, 0x0605, 0x0605, 0x0605, 0x0605,
    0xfa05, 0xfa05, 0xfa05, 0xfa05, 0xfa05, 0xfa05, 0xfa05, 0xfa05,
    0xfa05, 0xfa05, 0xfa05, 0xfa05, 0xfa05, 0xfa05, 0xfa05, 0xfa05,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203, 0x0203,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03,
    0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03, 0xfe03,
    0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404,
    0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404,
    0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404,
    0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404, 0x0404,
    0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04,
    0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04,
    0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04,
    0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04, 0xfc04,
    0x0806, 0x0806, 0x0806, 0x0806, 0x0806, 0x0806, 0x0806, 0x0806,
    0xf806, 0xf806, 0xf806, 0xf806, 0xf806, 0xf806, 0xf806, 0xf806,
    0x0a06, 0x0a06, 0x0a06, 0x0a06, 0x0a06, 0x0a06, 0x0a06, 0x0a06,
    0xf606, 0xf606, 0xf606, 0xf606, 0xf606, 0xf606, 0xf606, 0xf606,
    0x0298, 0x0298, 0xfe98, 0xfe98, 0x0618, 0x0618, 0xfa18, 0xfa18,
    0x02a8, 0x02a8, 0xfea8, 0xfea8, 0x1008, 0x1008, 0xf008, 0xf008,
    0x1208, 0x1208, 0xee08, 0xee08, 0x1809, 0xe809, 0x1a09, 0xe609,
    0x0629, 0xfa29, 0x0449, 0xfc49, 0x1c09, 0xe409, 0x1e09, 0xe209
};

const UWORD16 gau2_impeg2d_tab_one_10_16[] =
{
    /*Six leading zeros*/
    0x0458, 0x0458, 0x0458, 0x0458, 0xfc58, 0xfc58, 0xfc58, 0xfc58,
    0x02e8, 0x02e8, 0x02e8, 0x02e8, 0xfee8, 0xfee8, 0xfee8, 0xfee8,
    0x0829, 0x0829, 0xf829, 0xf829, 0x0309, 0x0309, 0xff09, 0xff09,
    0x02f8, 0x02f8, 0x02f8, 0x02f8, 0xfef8, 0xfef8, 0xfef8, 0xfef8,
    /*Seven leading zeros*/
    0x000b, 0x000b, 0x048b, 0xfc8b, 0x064b, 0xfa4b, 0x000b, 0x000b,
    0x000b, 0x000b, 0x047b, 0xfc7b, 0x035b, 0xff5b, 0x034b, 0xff4b,
    0x000b, 0x000b, 0x033b, 0xff3b, 0x032b, 0xff2b, 0x000b, 0x000b,
    0x063b, 0xfa3b, 0x000b, 0x000b, 0x046b, 0xfc6b, 0x031b, 0xff1b,
    /*Eight leading zeros*/
    0x04ac, 0xfcac, 0x049c, 0xfc9c, 0x065c, 0xfa5c, 0x083c, 0xf83c,
    0x0a2c, 0xf62c, 0x0e1c, 0xf21c, 0x0c1c, 0xf41c, 0x000c, 0x000c,
    0x000c, 0x000c, 0x000c, 0x000c, 0x000c, 0x000c, 0x03ac, 0xffac,
    0x039c, 0xff9c, 0x038c, 0xff8c, 0x037c, 0xff7c, 0x036c, 0xff6c,
    /*Nine leading zeros*/
    0x3e0d, 0xc20d, 0x3c0d, 0xc40d, 0x3a0d, 0xc60d, 0x380d, 0xc80d,
    0x360d, 0xca0d, 0x340d, 0xcc0d, 0x320d, 0xce0d, 0x300d, 0xd00d,
    0x2e0d, 0xd20d, 0x2c0d, 0xd40d, 0x2a0d, 0xd60d, 0x280d, 0xd80d,
    0x260d, 0xda0d, 0x240d, 0xdc0d, 0x220d, 0xde0d, 0x200d, 0xe00d,
    /*Ten leading zeros*/
    0x500e, 0xb00e, 0x4e0e, 0xb20e, 0x4c0e, 0xb40e, 0x4a0e, 0xb60e,
    0x480e, 0xb80e, 0x460e, 0xba0e, 0x440e, 0xbc0e, 0x420e, 0xbe0e,
    0x400e, 0xc00e, 0x1c1e, 0xe41e, 0x1a1e, 0xe61e, 0x181e, 0xe81e,
    0x161e, 0xea1e, 0x141e, 0xec1e, 0x121e, 0xee1e, 0x101e, 0xf01e,
    /*Eleven leading zeros*/
    0x241f, 0xdc1f, 0x221f, 0xde1f, 0x201f, 0xe01f, 0x1e1f, 0xe21f,
    0x066f, 0xfa6f, 0x050f, 0xfd0f, 0x04ff, 0xfcff, 0x04ef, 0xfcef,
    0x04df, 0xfcdf, 0x04cf, 0xfccf, 0x04bf, 0xfcbf, 0x03ff, 0xffff,
    0x03ef, 0xffef, 0x03df, 0xffdf, 0x03cf, 0xffcf, 0x03bf, 0xffbf
};

/* Depending upon the various groups identified in the Ac Vld Coeffs the
following tables are used to index into the DCT Coefficients Tables Zero and
One defined above */
const UWORD16 gau2_impeg2d_offset_zero[] =
{
    0,
    1369,
    1434,1434,
    1048,1048,1048,1048,
    2012,2012,2012,2012,2012,2012,2012,2012,
    2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,
    2110,2110,
    258,
    515,515,
    772,772,772,772,
    1158,1158,1158,1158,1158,1158,1158,1158,
    1402,1402,1402,1402,1402,1402,1402,1402,1402,1402,1402,1402,1402,1402,
    1402,1402,
    0,
    1
};

const UWORD16 gau2_impeg2d_offset_one[] =
{
    132,
    1386,
    1353,1353,
    1418,1418,1418,1418,
    1032,1032,1032,1032,1032,1032,1032,1032,
    1996,1996,1996,1996,1996,1996,1996,1996,1996,1996,1996,1996,1996,1996,
    1996,1996,
    1,
    258,258,
    515,515,515,515,
    756,756,756,756,756,756,756,756,
    1142,1142,1142,1142,1142,1142,1142,1142,1142,1142,1142,1142,1142,1142,
    1142,1142,
    0
};


/* Table to be used for decoding dct_dc_size_luminance */
const WORD16 gai2_impeg2d_dct_dc_size[][11][2] =
{
    {
        {3,1},{2,4},{-12,-9},{-11,-10},{-8,5},{-7,6},{-6,7},{-5,8},{-4,9},{-3,10},{-2,-1}
    },
    {
        {1,2},{-12,-11},{-10,3},{-9,4},{-8,5},{-7,6},{-6,7},{-5,8},{-4,9},{-3,10},{-2,-1}
    }
};