[cvs] / xvidcore / src / bitstream / vlc_codes.h Repository:
ViewVC logotype

Diff of /xvidcore/src/bitstream/vlc_codes.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Fri Mar 8 02:44:38 2002 UTC revision 1.11, Sat Oct 19 11:41:11 2002 UTC
# Line 1  Line 1 
1    /*****************************************************************************
2     *
3     *  XVID MPEG-4 VIDEO CODEC
4     *  - Vector Length Coding tables -
5     *
6     *  Copyright(C) 2002 Michael Militzer <isibaar@xvid.org>
7     *
8     *
9     *  This program is an implementation of a part of one or more MPEG-4
10     *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending
11     *  to use this software module in hardware or software products are
12     *  advised that its use may infringe existing patents or copyrights, and
13     *  any such use would be at such party's own risk.  The original
14     *  developer of this software module and his/her company, and subsequent
15     *  editors and their companies, will have no liability for use of this
16     *  software or modifications or derivatives thereof.
17     *
18     *  This program is free software; you can redistribute it and/or modify
19     *  it under the terms of the GNU General Public License as published by
20     *  the Free Software Foundation; either version 2 of the License, or
21     *  (at your option) any later version.
22     *
23     *  This program is distributed in the hope that it will be useful,
24     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
25     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26     *  GNU General Public License for more details.
27     *
28     *  You should have received a copy of the GNU General Public License
29     *  along with this program; if not, write to the Free Software
30     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
31     *
32     * $Id$
33     *
34     ****************************************************************************/
35    
36  #ifndef _VLC_CODES_H_  #ifndef _VLC_CODES_H_
37  #define _VLC_CODES_H_  #define _VLC_CODES_H_
38    
39  #include "../portab.h"  #include "../portab.h"
40    #include "mbcoding.h"
41    
42  #define VLC_ERROR       (-1)  #define VLC_ERROR       (-1)
43    #define ESCAPE 7167
44    
45    /*****************************************************************************
46     * The Vector Length Coding structure
47     ****************************************************************************/
48    
49  typedef struct  typedef struct
50  {  {
51          uint32_t code;          uint32_t code;
52          int8_t len;          int8_t len;
53  } VLC;  }
54    VLC;
55    
56    static VLC *DCT3D[2];
57    
58  /******************************************************************  
59  /* common tables between encoder/decoder                          *  /*****************************************************************************
60  /******************************************************************/   * common tables between encoder/decoder
61     ****************************************************************************/
62    
63  /* constants taken from momusys/vm_common/inlcude/max_level.h */  /* constants taken from momusys/vm_common/inlcude/max_level.h */
64  static char max_level[4][64] = {  static char const max_level[4][64] = {
65          { // intra, last = 0          /* intra, last = 0 */
66            {
67                  27, 10,  5,  4,  3,  3,  3,  3,                  27, 10,  5,  4,  3,  3,  3,  3,
68                  2,  2,  1,  1,  1,  1,  1,  0,                  2,  2,  1,  1,  1,  1,  1,  0,
69                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
# Line 26  Line 71 
71                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
72                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
73                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
74                  0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
75          },          },
76    
77          { // intra, last = 1          /* intra, last = 1 */
78            {
79                  8,  3,  2,  2,  2,  2,  2,  1,                  8,  3,  2,  2,  2,  2,  2,  1,
80                  1,  1,  1,  1,  1,  1,  1,  1,                  1,  1,  1,  1,  1,  1,  1,  1,
81                  1,  1,  1,  1,  1,  0,  0,  0,                  1,  1,  1,  1,  1,  0,  0,  0,
# Line 37  Line 83 
83                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
84                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
85                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
86                  0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
87          },          },
88    
89          { // inter, last = 0          /* inter, last = 0 */
90            {
91                  12,  6,  4,  3,  3,  3,  3,  2,                  12,  6,  4,  3,  3,  3,  3,  2,
92                  2,  2,  2,  1,  1,  1,  1,  1,                  2,  2,  2,  1,  1,  1,  1,  1,
93                  1,  1,  1,  1,  1,  1,  1,  1,                  1,  1,  1,  1,  1,  1,  1,  1,
# Line 48  Line 95 
95                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
96                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
97                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
98                  0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
99          },          },
100    
101          { // inter, last = 1          /* inter, last = 1 */
102            {
103                  3,  2,  1,  1,  1,  1,  1,  1,                  3,  2,  1,  1,  1,  1,  1,  1,
104                  1,  1,  1,  1,  1,  1,  1,  1,                  1,  1,  1,  1,  1,  1,  1,  1,
105                  1,  1,  1,  1,  1,  1,  1,  1,                  1,  1,  1,  1,  1,  1,  1,  1,
# Line 59  Line 107 
107                  1,  1,  1,  1,  1,  1,  1,  1,                  1,  1,  1,  1,  1,  1,  1,  1,
108                  1,  0,  0,  0,  0,  0,  0,  0,                  1,  0,  0,  0,  0,  0,  0,  0,
109                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
110                  0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
111          }          }
112  };  };
113    
114  static char max_run[4][256] = {  static char const max_run[4][256] = {
115          { // intra, last = 0          /* intra, last = 0 */
116            {
117                    0, 14,  9,  7,  3,  2,  1,  1,                    0, 14,  9,  7,  3,  2,  1,  1,
118                    1,  1,  1,  0,  0,  0,  0,  0,                    1,  1,  1,  0,  0,  0,  0,  0,
119                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
# Line 96  Line 145 
145                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
146                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
147                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
148                    0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
149          },          },
150    
151          { // intra, last = 1          /* intra, last = 1 */
152            {
153                    0, 20,  6,  1,  0,  0,  0,  0,                    0, 20,  6,  1,  0,  0,  0,  0,
154                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
155                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
# Line 131  Line 181 
181                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
182                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
183                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
184                    0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
185          },          },
186    
187          { // inter, last = 0          /* inter, last = 0 */
188            {
189                    0, 26, 10,  6,  2,  1,  1,  0,                    0, 26, 10,  6,  2,  1,  1,  0,
190                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
191                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
# Line 166  Line 217 
217                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
218                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
219                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
220                    0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
221          },          },
222    
223          { // inter, last = 1          /* inter, last = 1 */
224            {
225                    0, 40,  1,  0,  0,  0,  0,  0,                    0, 40,  1,  0,  0,  0,  0,  0,
226                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
227                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
# Line 201  Line 253 
253                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
254                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
255                    0,  0,  0,  0,  0,  0,  0,  0,                    0,  0,  0,  0,  0,  0,  0,  0,
256                    0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
257          }          }
258  };  };
259    
260    
261  /******************************************************************  /******************************************************************
262  /* encoder tables                                                 *   * encoder tables                                                 *
263  /******************************************************************/   ******************************************************************/
264    
265  /* DCT coefficients. Four tables, two for last = 0, two for last = 1.  /* DCT coefficients. Four tables, two for last = 0, two for last = 1.
266     the sign bit must be added afterwards. */     the sign bit must be added afterwards. */
267    
268  /* first part of coeffs for last = 0. Indexed by [run][level-1] */  /* first part of coeffs for last = 0. Indexed by [run][level-1] */
269    
270  static VLC coeff_tab0[2][12] = {  static VLC const coeff_tab0[2][12] = {
271      /*          /* run = 0  */
        run = 0  
      */  
272      {      {
273       {0x02, 2}, {0x0f, 4}, {0x15, 6}, {0x17, 7},       {0x02, 2}, {0x0f, 4}, {0x15, 6}, {0x17, 7},
274       {0x1f, 8}, {0x25, 9}, {0x24, 9}, {0x21, 10},       {0x1f, 8}, {0x25, 9}, {0x24, 9}, {0x21, 10},
275       {0x20, 10}, {0x07, 11}, {0x06, 11}, {0x20, 11}       {0x20, 10}, {0x07, 11}, {0x06, 11}, {0x20, 11}
276       },       },
277      /*  
278         run = 1          /* run = 1 */
      */  
279      {      {
280       {0x06, 3}, {0x14, 6}, {0x1e, 8}, {0x0f, 10},       {0x06, 3}, {0x14, 6}, {0x1e, 8}, {0x0f, 10},
281       {0x21, 11}, {0x50, 12}, {0x00, 0}, {0x00, 0},       {0x21, 11}, {0x50, 12}, {0x00, 0}, {0x00, 0},
# Line 236  Line 285 
285    
286  /* rest of coeffs for last = 0. indexing by [run-2][level-1] */  /* rest of coeffs for last = 0. indexing by [run-2][level-1] */
287    
288  static VLC coeff_tab1[25][4] = {  static VLC const coeff_tab1[25][4] = {
289      /*          /* First row is run=2, then each row is run 2 + index */
290         run = 2          {{0x0e, 4}, {0x1d, 8}, {0x0e, 10}, {0x51, 12}},
291       */          {{0x0d, 5}, {0x23, 9},  {0x0d, 10}, {0x00, 0}},
292      {          {{0x0c, 5}, {0x22, 9},  {0x52, 12}, {0x00, 0}},
293       {0x0e, 4}, {0x1d, 8}, {0x0e, 10}, {0x51, 12}          {{0x0b, 5}, {0x0c, 10}, {0x53, 12}, {0x00, 0}},
294       },          {{0x13, 6}, {0x0b, 10}, {0x54, 12}, {0x00, 0}},
295      /*          {{0x12, 6}, {0x0a, 10}, {0x00, 0},  {0x00, 0}},
296         run = 3          {{0x11, 6}, {0x09, 10}, {0x00, 0},  {0x00, 0}},
297       */          {{0x10, 6}, {0x08, 10}, {0x00, 0},  {0x00, 0}},
298      {          {{0x16, 7}, {0x55, 12}, {0x00, 0},  {0x00, 0}},
299       {0x0d, 5}, {0x23, 9}, {0x0d, 10}, {0x00, 0}          {{0x15, 7}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
300       },          {{0x14, 7}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
301      /*          {{0x1c, 8}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
302         run = 4-26          {{0x1b, 8}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
303       */          {{0x21, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
304      {          {{0x20, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
305       {0x0c, 5}, {0x22, 9}, {0x52, 12}, {0x00, 0}          {{0x1f, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
306       },          {{0x1e, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
307      {          {{0x1d, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
308       {0x0b, 5}, {0x0c, 10}, {0x53, 12}, {0x00, 0}          {{0x1c, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
309       },          {{0x1b, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
310      {          {{0x1a, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
311       {0x13, 6}, {0x0b, 10}, {0x54, 12}, {0x00, 0}          {{0x22, 11}, {0x00, 0}, {0x00, 0},  {0x00, 0}},
312       },          {{0x23, 11}, {0x00, 0}, {0x00, 0},  {0x00, 0}},
313      {          {{0x56, 12}, {0x00, 0}, {0x00, 0},  {0x00, 0}},
314       {0x12, 6}, {0x0a, 10}, {0x00, 0}, {0x00, 0}          {{0x57, 12}, {0x00, 0}, {0x00, 0},  {0x00, 0}}
315       },  
     {  
      {0x11, 6}, {0x09, 10}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x10, 6}, {0x08, 10}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x16, 7}, {0x55, 12}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x15, 7}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x14, 7}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x1c, 8}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x1b, 8}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x21, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x20, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x1f, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x1e, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x1d, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x1c, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x1b, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x1a, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x22, 11}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x23, 11}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x56, 12}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      },  
     {  
      {0x57, 12}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
      }  
316  };  };
317    
318  /* first coeffs of last = 1. indexing by [run][level-1] */  /* first coeffs of last = 1. indexing by [run][level-1] */
319    
320  static VLC coeff_tab2[2][3] = {  static VLC const coeff_tab2[2][3] = {
321      /*          /*  run = 0 */
322         run = 0          {{0x07, 4}, {0x19, 9},  {0x05, 11}},
323       */          /* run = 1 */
324      {          {{0x0f, 6}, {0x04, 11}, {0x00, 0}}
      {0x07, 4}, {0x19, 9}, {0x05, 11}  
      },  
     /*  
        run = 1  
      */  
     {  
      {0x0f, 6}, {0x04, 11}, {0x00, 0}  
      }  
325  };  };
326    
327  /* rest of coeffs for last = 1. indexing by [run-2] */  /* rest of coeffs for last = 1. indexing by [run-2] */
328    
329  static VLC coeff_tab3[40][1] = {  static VLC const coeff_tab3[40][1] = {
330      {0x0e, 6}, {0x0d, 6}, {0x0c, 6},          {{0x0e, 6}},  {{0x0d, 6}},  {{0x0c, 6}},  {{0x13, 7}},
331      {0x13, 7}, {0x12, 7}, {0x11, 7}, {0x10, 7},          {{0x12, 7}},  {{0x11, 7}},  {{0x10, 7}},  {{0x1a, 8}},
332      {0x1a, 8}, {0x19, 8}, {0x18, 8}, {0x17, 8},          {{0x19, 8}},  {{0x18, 8}},  {{0x17, 8}},  {{0x16, 8}},
333      {0x16, 8}, {0x15, 8}, {0x14, 8}, {0x13, 8},          {{0x15, 8}},  {{0x14, 8}},  {{0x13, 8}},  {{0x18, 9}},
334      {0x18, 9}, {0x17, 9}, {0x16, 9}, {0x15, 9},          {{0x17, 9}},  {{0x16, 9}},  {{0x15, 9}},  {{0x14, 9}},
335      {0x14, 9}, {0x13, 9}, {0x12, 9}, {0x11, 9},          {{0x13, 9}},  {{0x12, 9}},  {{0x11, 9}},  {{0x07, 10}},
336      {0x07, 10}, {0x06, 10}, {0x05, 10}, {0x04, 10},          {{0x06, 10}}, {{0x05, 10}}, {{0x04, 10}}, {{0x24, 11}},
337      {0x24, 11}, {0x25, 11}, {0x26, 11}, {0x27, 11},          {{0x25, 11}}, {{0x26, 11}}, {{0x27, 11}}, {{0x58, 12}},
338      {0x58, 12}, {0x59, 12}, {0x5a, 12}, {0x5b, 12},          {{0x59, 12}}, {{0x5a, 12}}, {{0x5b, 12}}, {{0x5c, 12}},
339      {0x5c, 12}, {0x5d, 12}, {0x5e, 12}, {0x5f, 12},          {{0x5d, 12}}, {{0x5e, 12}}, {{0x5f, 12}}, {{0x00, 0}}
     {0x00, 0}  
340  };  };
341    
342  /* New tables for Intra luminance coefficients. Same codewords,  /*
343     different meaning */   * New tables for Intra luminance coefficients. Same codewords,
344     * different meaning
345     */
346    
347  /* Coeffs for last = 0, run = 0. Indexed by [level-1] */  /* Coeffs for last = 0, run = 0. Indexed by [level-1] */
348    
349  static VLC coeff_tab4[27] = {  static VLC const coeff_tab4[27] = {
350      /*          /* run = 0 */
351         run = 0          {0x02, 2},  {0x06, 3},  {0x0f, 4},
352       */          {0x0d, 5},  {0x0c, 5},  {0x15, 6},
353      {0x02, 2}, {0x06, 3}, {0x0f, 4}, {0x0d, 5},          {0x13, 6},  {0x12, 6},  {0x17, 7},
354      {0x0c, 5}, {0x15, 6}, {0x13, 6}, {0x12, 6},          {0x1f, 8},  {0x1e, 8},  {0x1d, 8},
355      {0x17, 7}, {0x1f, 8}, {0x1e, 8}, {0x1d, 8},          {0x25, 9},  {0x24, 9},  {0x23, 9},
356      {0x25, 9}, {0x24, 9}, {0x23, 9}, {0x21, 9},          {0x21, 9},  {0x21, 10}, {0x20, 10},
357      {0x21, 10}, {0x20, 10}, {0x0f, 10}, {0x0e, 10},          {0x0f, 10}, {0x0e, 10}, {0x07, 11},
358      {0x07, 11}, {0x06, 11}, {0x20, 11}, {0x21, 11},          {0x06, 11}, {0x20, 11}, {0x21, 11},
359      {0x50, 12}, {0x51, 12}, {0x52, 12}      {0x50, 12}, {0x51, 12}, {0x52, 12}
360  };  };
361    
362  /* Coeffs for last = 0, run = 1. Indexed by [level-1] */  /* Coeffs for last = 0, run = 1. Indexed by [level-1] */
363    
364  static VLC coeff_tab5[10] = {  static VLC const coeff_tab5[10] = {
365      {0x0e, 4}, {0x14, 6}, {0x16, 7}, {0x1c, 8},          {0x0e, 4}, {0x14, 6},  {0x16, 7},  {0x1c, 8},  {0x20, 9},
366      {0x20, 9}, {0x1f, 9}, {0x0d, 10}, {0x22, 11},          {0x1f, 9}, {0x0d, 10}, {0x22, 11}, {0x53, 12}, {0x55, 12}
     {0x53, 12}, {0x55, 12}  
367  };  };
368    
369  /* Coeffs for last = 0, run = 2 -> 9. Indexed by [run-2][level-1] */  /* Coeffs for last = 0, run = 2 -> 9. Indexed by [run-2][level-1] */
370    
371  static VLC coeff_tab6[8][5] = {  static VLC coeff_tab6[8][5] = {
372      /*          /* run = 2 */
373         run = 2          {{0x0b, 5}, {0x15, 7}, {0x1e, 9}, {0x0c, 10}, {0x56, 12}},
374       */  
375      {          /* run = 3 */
376       {0x0b, 5}, {0x15, 7}, {0x1e, 9}, {0x0c, 10},          {{0x11, 6}, {0x1b, 8}, {0x1d, 9}, {0x0b, 10}, {0x00, 0}},
377       {0x56, 12}  
378       },          /* run = 4 */
379      /*          {{0x10, 6}, {0x22, 9}, {0x0a, 10}, {0x00, 0}, {0x00, 0}},
380         run = 3  
381       */          /* run = 5 */
382      {          {{0x0d, 6}, {0x1c, 9}, {0x08, 10}, {0x00, 0}, {0x00, 0}},
383       {0x11, 6}, {0x1b, 8}, {0x1d, 9}, {0x0b, 10},  
384       {0x00, 0}          /* run = 6 */
385       },          {{0x12, 7}, {0x1b, 9}, {0x54, 12}, {0x00, 0}, {0x00, 0}},
386      /*  
387         run = 4          /* run = 7 */
388       */          {{0x14, 7}, {0x1a, 9}, {0x57, 12}, {0x00, 0}, {0x00, 0}},
389      {  
390       {0x10, 6}, {0x22, 9}, {0x0a, 10}, {0x00, 0},          /* run = 8 */
391       {0x00, 0}          {{0x19, 8}, {0x09, 10}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
392       },  
393      /*          /* run = 9 */
394         run = 5          {{0x18, 8}, {0x23, 11}, {0x00, 0}, {0x00, 0}, {0x00, 0}}
      */  
     {  
      {0x0d, 6}, {0x1c, 9}, {0x08, 10}, {0x00, 0},  
      {0x00, 0}  
      },  
     /*  
        run = 6  
      */  
     {  
      {0x12, 7}, {0x1b, 9}, {0x54, 12}, {0x00, 0},  
      {0x00, 0}  
      },  
     /*  
        run = 7  
      */  
     {  
      {0x14, 7}, {0x1a, 9}, {0x57, 12}, {0x00, 0},  
      {0x00, 0}  
      },  
     /*  
        run = 8  
      */  
     {  
      {0x19, 8}, {0x09, 10}, {0x00, 0}, {0x00, 0},  
      {0x00, 0}  
      },  
     /*  
        run = 9  
      */  
     {  
      {0x18, 8}, {0x23, 11}, {0x00, 0}, {0x00, 0},  
      {0x00, 0}  
      }  
395  };  };
396    
397  /* Coeffs for last = 0, run = 10 -> 14. Indexed by [run-10] */  /* Coeffs for last = 0, run = 10 -> 14. Indexed by [run-10] */
398    
399  static VLC coeff_tab7[5][1] = {  static VLC const coeff_tab7[5][1] = {
400      {0x17, 8}, {0x19, 9}, {0x18, 9}, {0x07, 10},          {{0x17, 8}},
401      {0x58, 12}          {{0x19, 9}},
402            {{0x18, 9}},
403            {{0x07, 10}},
404            {{0x58, 12}}
405  };  };
406    
407  /* Coeffs for last = 1, run = 0. Indexed by [level-1] */  /* Coeffs for last = 1, run = 0. Indexed by [level-1] */
408    
409  static VLC coeff_tab8[8] = {  static VLC const coeff_tab8[8] = {
410      {0x07, 4}, {0x0c, 6}, {0x16, 8}, {0x17, 9},      {0x07, 4}, {0x0c, 6}, {0x16, 8}, {0x17, 9},
411      {0x06, 10}, {0x05, 11}, {0x04, 11}, {0x59, 12}      {0x06, 10}, {0x05, 11}, {0x04, 11}, {0x59, 12}
412  };  };
413    
414  /* Coeffs for last = 1, run = 1 -> 6. Indexed by [run-1][level-1] */  /* Coeffs for last = 1, run = 1 -> 6. Indexed by [run-1][level-1] */
415    
416  static VLC coeff_tab9[6][3] = {  static VLC const coeff_tab9[6][3] = {
417      /*          /* run = 1 */
418         run = 1          {{0x0f, 6}, {0x16, 9}, {0x05, 10}},
419       */  
420      {          /* run = 2 */
421       {0x0f, 6}, {0x16, 9}, {0x05, 10}          {{0x0e, 6}, {0x04, 10}, {0x00, 0}},
422       },  
423      /*          /* run = 3 */
424         run = 2          {{0x11, 7}, {0x24, 11}, {0x00, 0}},
425       */  
426      {          /* run = 4 */
427       {0x0e, 6}, {0x04, 10}, {0x00, 0}          {{0x10, 7}, {0x25, 11}, {0x00, 0}},
428       },  
429      /*          /* run = 5 */
430         run = 3          {{0x13, 7}, {0x5a, 12}, {0x00, 0}},
431       */  
432      {          /* run = 6 */
433       {0x11, 7}, {0x24, 11}, {0x00, 0}          {{0x15, 8}, {0x5b, 12}, {0x00, 0}}
      },  
     /*  
        run = 4  
      */  
     {  
      {0x10, 7}, {0x25, 11}, {0x00, 0}  
      },  
     /*  
        run = 5  
      */  
     {  
      {0x13, 7}, {0x5a, 12}, {0x00, 0}  
      },  
     /*  
        run = 6  
      */  
     {  
      {0x15, 8}, {0x5b, 12}, {0x00, 0}  
      }  
434  };  };
435    
436  /* Coeffs for last = 1, run = 7 -> 20. Indexed by [run-7] */  /* Coeffs for last = 1, run = 7 -> 20. Indexed by [run-7] */
437    
438  static VLC coeff_tab10[14][1] = {  static VLC const coeff_tab10[14][1] = {
439      {0x14, 8}, {0x13, 8}, {0x1a, 8}, {0x15, 9},          {{0x14, 8}},
440      {0x14, 9}, {0x13, 9}, {0x12, 9}, {0x11, 9},          {{0x13, 8}},
441      {0x26, 11}, {0x27, 11}, {0x5c, 12}, {0x5d, 12},          {{0x1a, 8}},
442      {0x5e, 12}, {0x5f, 12}          {{0x15, 9}},
443            {{0x14, 9}},
444            {{0x13, 9}},
445            {{0x12, 9}},
446            {{0x11, 9}},
447            {{0x26, 11}},
448            {{0x27, 11}},
449            {{0x5c, 12}},
450            {{0x5d, 12}},
451            {{0x5e, 12}},
452            {{0x5f, 12}}
453  };  };
454    
455    
456  static VLC *coeff_intra_last0[15] = {  static VLC const *coeff_intra_last0[15] = {
457    coeff_tab4,    coeff_tab4,
458    coeff_tab5,    coeff_tab5,
459    coeff_tab6[0],    coeff_tab6[0],
# Line 526  Line 471 
471    coeff_tab7[4]    coeff_tab7[4]
472  };  };
473    
474  static VLC *coeff_intra_last1[21] = {  static VLC const *coeff_intra_last1[21] = {
475          coeff_tab8,          coeff_tab8,
476          coeff_tab9[0],          coeff_tab9[0],
477          coeff_tab9[1],          coeff_tab9[1],
# Line 550  Line 495 
495          coeff_tab10[13],          coeff_tab10[13],
496  };  };
497    
498  static VLC *coeff_inter_last0[27] = {  static VLC const *coeff_inter_last0[27] = {
499          coeff_tab0[0],          coeff_tab0[0],
500          coeff_tab0[1],          coeff_tab0[1],
501          coeff_tab1[0],          coeff_tab1[0],
# Line 580  Line 525 
525          coeff_tab1[24],          coeff_tab1[24],
526  };  };
527    
528  static VLC *coeff_inter_last1[42] = {  static VLC const *coeff_inter_last1[42] = {
529          coeff_tab2[0],          coeff_tab2[0],
530          coeff_tab2[1],          coeff_tab2[1],
531          coeff_tab3[0],          coeff_tab3[0],
# Line 625  Line 570 
570          coeff_tab3[39],          coeff_tab3[39],
571  };  };
572    
573  static VLC **coeff_vlc[4] = {  static VLC const **coeff_vlc[4] = {
574          coeff_intra_last0,          coeff_intra_last0,
575          coeff_intra_last1,          coeff_intra_last1,
576          coeff_inter_last0,          coeff_inter_last0,
577          coeff_inter_last1,          coeff_inter_last1,
578  };  };
579    
580  static const VLC mcbpc_I[4] = {  /*
581          {1, 1}, {1, 3}, {2, 3}, {3, 3}   * MCBPC Indexing by cbpc in first two bits, mode in last two.
582  };   * CBPC as in table 4/H.263, MB type (mode): 3 = 01, 4 = 10.
583     * Example: cbpc = 01 and mode = 4 gives index = 0110 = 6.
584     */
585    
586  static const VLC mcbpc_P_intra[4] = {  static VLC const mcbpc_intra_tab[15] = {
587          {3, 5}, {4, 8}, {3, 8}, {3, 7}          {0x01, 9}, {0x01, 1}, {0x01, 4}, {0x00, 0},
588            {0x00, 0}, {0x01, 3}, {0x01, 6}, {0x00, 0},
589            {0x00, 0}, {0x02, 3}, {0x02, 6}, {0x00, 0},
590            {0x00, 0}, {0x03, 3}, {0x03, 6}
591  };  };
592    
593  static const VLC mcbpc_P_inter[4] = {  /* MCBPC inter.
594          {1, 1}, {3, 4}, {2, 4}, {5, 6}     Addressing: 5 bit ccmmm (cc = CBPC, mmm = mode (1-4 binary)) */
 };  
595    
596  static const VLC mcbpc_P_inter4v[4] = {  static VLC const mcbpc_inter_tab[29] = {
597          {2, 3}, {5, 7}, {4, 7}, {5, 8}          {1, 1}, {3, 3}, {2, 3}, {3, 5}, {4, 6}, {1, 9}, {0, 0}, {0, 0},
598            {3, 4}, {7, 7}, {5, 7}, {4, 8}, {4, 9}, {0, 0}, {0, 0}, {0, 0},
599            {2, 4}, {6, 7}, {4, 7}, {3, 8}, {3, 9}, {0, 0}, {0, 0}, {0, 0},
600            {5, 6}, {5, 9}, {5, 8}, {3, 7}, {2, 9}
601  };  };
602    
603  static const VLC cbpy_tab[16] = {  static VLC const cbpy_tab[16] = {
604          {3,4}, {5,5}, {4,5}, {9,4}, {3,5}, {7,4}, {2,6}, {11,4},          {3,4}, {5,5}, {4,5}, {9,4}, {3,5}, {7,4}, {2,6}, {11,4},
605          {2,5}, {3,6}, {5,4}, {10,4}, {4,4}, {8,4}, {6,4}, {3,2}          {2,5}, {3,6}, {5,4}, {10,4}, {4,4}, {8,4}, {6,4}, {3,2}
606  };  };
607    
608  static const VLC dcy_tab[511] = {  static VLC const dcy_tab[511] = {
609  {0x100, 15}, {0x101, 15}, {0x102, 15}, {0x103, 15},  {0x100, 15}, {0x101, 15}, {0x102, 15}, {0x103, 15},
610  {0x104, 15}, {0x105, 15}, {0x106, 15}, {0x107, 15},  {0x104, 15}, {0x105, 15}, {0x106, 15}, {0x107, 15},
611  {0x108, 15}, {0x109, 15}, {0x10a, 15}, {0x10b, 15},  {0x108, 15}, {0x109, 15}, {0x10a, 15}, {0x10b, 15},
# Line 784  Line 736 
736  {0x1fd, 15}, {0x1fe, 15}, {0x1ff, 15},  {0x1fd, 15}, {0x1fe, 15}, {0x1ff, 15},
737  };  };
738    
739  static const VLC dcc_tab[511] = {  static VLC const dcc_tab[511] = {
740  {0x100, 16}, {0x101, 16}, {0x102, 16}, {0x103, 16},  {0x100, 16}, {0x101, 16}, {0x102, 16}, {0x103, 16},
741  {0x104, 16}, {0x105, 16}, {0x106, 16}, {0x107, 16},  {0x104, 16}, {0x105, 16}, {0x106, 16}, {0x107, 16},
742  {0x108, 16}, {0x109, 16}, {0x10a, 16}, {0x10b, 16},  {0x108, 16}, {0x109, 16}, {0x10a, 16}, {0x10b, 16},
# Line 916  Line 868 
868  };  };
869    
870    
871  static const VLC mb_motion_table[65] = {  static VLC const mb_motion_table[65] = {
872  {0x05, 13}, {0x07, 13}, {0x05, 12}, {0x07, 12},  {0x05, 13}, {0x07, 13}, {0x05, 12}, {0x07, 12},
873  {0x09, 12}, {0x0b, 12}, {0x0d, 12}, {0x0f, 12},  {0x09, 12}, {0x0b, 12}, {0x0d, 12}, {0x0f, 12},
874  {0x09, 11}, {0x0b, 11}, {0x0d, 11}, {0x0f, 11},  {0x09, 11}, {0x0b, 11}, {0x0d, 11}, {0x0f, 11},
# Line 933  Line 885 
885  {0x10, 11}, {0x0e, 11}, {0x0c, 11}, {0x0a, 11},  {0x10, 11}, {0x0e, 11}, {0x0c, 11}, {0x0a, 11},
886  {0x08, 11}, {0x0e, 12}, {0x0c, 12}, {0x0a, 12},  {0x08, 11}, {0x0e, 12}, {0x0c, 12}, {0x0a, 12},
887  {0x08, 12}, {0x06, 12}, {0x04, 12}, {0x06, 13},  {0x08, 12}, {0x06, 12}, {0x04, 12}, {0x06, 13},
888  {0x04, 13},          {0x04, 13}
889  };  };
890    
891    
892  /******************************************************************  /******************************************************************
893  /* decoder tables                                                                             *   * decoder tables                                                 *
894  /******************************************************************/   ******************************************************************/
895    
896  static const VLC mcbpc_intra_table[64] = {  static VLC const mcbpc_intra_table[64] = {
897          {-1,0},          {-1, 0}, {20, 6}, {36, 6}, {52, 6}, {4, 4},  {4, 4},  {4, 4},  {4, 4},
898          {20,6}, {36,6}, {52,6}, {4,4}, {4,4}, {4,4},          {19, 3}, {19, 3}, {19, 3}, {19, 3}, {19, 3}, {19, 3}, {19, 3}, {19, 3},
899          {4,4}, {19,3}, {19,3}, {19,3}, {19,3}, {19,3},          {35, 3}, {35, 3}, {35, 3}, {35, 3}, {35, 3}, {35, 3}, {35, 3}, {35, 3},
900          {19,3}, {19,3}, {19,3}, {35,3}, {35,3}, {35,3},          {51, 3}, {51, 3}, {51, 3}, {51, 3}, {51, 3}, {51, 3}, {51, 3}, {51, 3},
901          {35,3}, {35,3}, {35,3}, {35,3}, {35,3}, {51,3},          {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},
902          {51,3}, {51,3}, {51,3}, {51,3}, {51,3}, {51,3},          {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},
903          {51,3}, {3, 1},          {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},
904          {3, 1}, {3, 1}, {3, 1}, {3, 1}, {3, 1}, {3, 1},          {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1}
         {3, 1}, {3, 1}, {3, 1}, {3, 1}, {3, 1}, {3, 1},  
         {3, 1}, {3, 1}, {3, 1}, {3, 1}, {3, 1}, {3, 1},  
         {3, 1}, {3, 1}, {3, 1}, {3, 1}, {3, 1}, {3, 1},  
         {3, 1}, {3, 1}, {3, 1}, {3, 1}, {3, 1}, {3, 1},  
         {3, 1},  
905  };  };
906    
907    
908  static const VLC mcbpc_inter_table[257] = {  static VLC const mcbpc_inter_table[257] = {
909          {VLC_ERROR,0},          {VLC_ERROR, 0}, {255, 9}, {52, 9}, {36, 9}, {20, 9}, {49, 9}, {35, 8}, {35, 8},
910          {255,9}, {52,9}, {36,9}, {20,9}, {49,9}, {35,8}, {35,8}, {19,8}, {19,8},          {19, 8}, {19, 8}, {50, 8}, {50, 8}, {51, 7}, {51, 7}, {51, 7}, {51, 7},
911          {50,8}, {50,8}, {51,7}, {51,7}, {51,7}, {51,7}, {34,7}, {34,7}, {34,7},          {34, 7}, {34, 7}, {34, 7}, {34, 7}, {18, 7}, {18, 7}, {18, 7}, {18, 7},
912          {34,7}, {18,7}, {18,7}, {18,7}, {18,7}, {33,7}, {33,7}, {33,7}, {33,7},          {33, 7}, {33, 7}, {33, 7}, {33, 7}, {17, 7}, {17, 7}, {17, 7}, {17, 7},
913          {17,7}, {17,7}, {17,7}, {17,7}, {4,6}, {4,6}, {4,6}, {4,6}, {4,6},          {4, 6}, {4, 6}, {4, 6}, {4, 6}, {4, 6}, {4, 6}, {4, 6}, {4, 6},
914          {4,6}, {4,6}, {4,6}, {48,6}, {48,6}, {48,6}, {48,6}, {48,6}, {48,6},          {48, 6}, {48, 6}, {48, 6}, {48, 6}, {48, 6}, {48, 6}, {48, 6}, {48, 6},
915          {48,6}, {48,6}, {3,5}, {3,5}, {3,5}, {3,5}, {3,5}, {3,5}, {3,5},          {3, 5}, {3, 5}, {3, 5}, {3, 5}, {3, 5}, {3, 5}, {3, 5}, {3, 5},
916          {3,5}, {3,5}, {3,5}, {3,5}, {3,5}, {3,5}, {3,5}, {3,5}, {3,5},          {3, 5}, {3, 5}, {3, 5}, {3, 5}, {3, 5}, {3, 5}, {3, 5}, {3, 5},
917          {32,4}, {32,4}, {32,4}, {32,4}, {32,4}, {32,4}, {32,4}, {32,4}, {32,4},          {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4},
918          {32,4}, {32,4}, {32,4}, {32,4}, {32,4}, {32,4}, {32,4}, {32,4}, {32,4},          {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4},
919          {32,4}, {32,4}, {32,4}, {32,4}, {32,4}, {32,4}, {32,4}, {32,4}, {32,4},          {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4},
920          {32,4}, {32,4}, {32,4}, {32,4}, {32,4}, {16,4}, {16,4}, {16,4}, {16,4},          {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4},
921          {16,4}, {16,4}, {16,4}, {16,4}, {16,4}, {16,4}, {16,4}, {16,4}, {16,4},          {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4},
922          {16,4}, {16,4}, {16,4}, {16,4}, {16,4}, {16,4}, {16,4}, {16,4}, {16,4},          {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4},
923          {16,4}, {16,4}, {16,4}, {16,4}, {16,4}, {16,4}, {16,4}, {16,4}, {16,4},          {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4},
924          {16,4}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3},          {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4},
925          {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3},          {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3},
926          {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3},          {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3},
927          {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3},          {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3},
928          {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3},          {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3},
929          {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3},          {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3},
930          {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3},          {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3},
931          {2,3}, {2,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3},          {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3},
932          {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3},          {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3}, {2, 3},
933          {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3},          {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
934          {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3},          {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
935          {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3},          {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
936          {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3},          {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
937          {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3},          {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
938          {1,3}, {1,3}, {1,3}, {0,1},          {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
939            {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
940            {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
941            {0, 1}
942  };  };
943    
944  static const VLC cbpy_table[64] =  static VLC const cbpy_table[64] = {
 {  
945          {-1,0}, {-1,0}, {6,6},  {9,6},  {8,5},  {8,5},  {4,5},  {4,5},          {-1,0}, {-1,0}, {6,6},  {9,6},  {8,5},  {8,5},  {4,5},  {4,5},
946          {2,5},  {2,5},  {1,5},  {1,5},  {0,4},  {0,4},  {0,4},  {0,4},          {2,5},  {2,5},  {1,5},  {1,5},  {0,4},  {0,4},  {0,4},  {0,4},
947    {12,4}, {12,4}, {12,4}, {12,4}, {10,4}, {10,4}, {10,4}, {10,4},    {12,4}, {12,4}, {12,4}, {12,4}, {10,4}, {10,4}, {10,4}, {10,4},
948    {14,4}, {14,4}, {14,4}, {14,4}, {5,4},  {5,4},  {5,4},  {5,4},    {14,4}, {14,4}, {14,4}, {14,4}, {5,4},  {5,4},  {5,4},  {5,4},
949    {13,4}, {13,4}, {13,4}, {13,4}, {3,4},  {3,4},  {3,4},  {3,4},    {13,4}, {13,4}, {13,4}, {13,4}, {3,4},  {3,4},  {3,4},  {3,4},
950    {11,4}, {11,4}, {11,4}, {11,4}, {7,4},  {7,4},  {7,4},  {7,4},    {11,4}, {11,4}, {11,4}, {11,4}, {7,4},  {7,4},  {7,4},  {7,4},
951          {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2},          {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2},
952          {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2},          {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}
         {15, 2}, {15, 2},  
953  };  };
954    
955    
956  VLC TMNMVtab0[] = {  static VLC const TMNMVtab0[] = {
957  {3,4}, {-3,4}, {2,3}, {2,3}, {-2,3}, {-2,3}, {1,2}, {1,2}, {1,2}, {1,2},          {3, 4}, {-3, 4}, {2, 3}, {2, 3}, {-2, 3}, {-2, 3}, {1, 2},
958  {-1,2}, {-1,2}, {-1,2}, {-1,2}          {1, 2}, {1, 2}, {1, 2}, {-1, 2}, {-1, 2}, {-1, 2}, {-1, 2}
959  };  };
960    
961  VLC TMNMVtab1[] = {  static VLC const TMNMVtab1[] = {
962  {12,10}, {-12,10}, {11,10}, {-11,10}, {10,9}, {10,9}, {-10,9}, {-10,9},          {12, 10}, {-12, 10}, {11, 10}, {-11, 10},
963  {9,9}, {9,9}, {-9,9}, {-9,9}, {8,9}, {8,9}, {-8,9}, {-8,9}, {7,7}, {7,7},          {10, 9}, {10, 9}, {-10, 9}, {-10, 9},
964  {7,7}, {7,7}, {7,7}, {7,7}, {7,7}, {7,7}, {-7,7}, {-7,7}, {-7,7}, {-7,7},          {9, 9}, {9, 9}, {-9, 9}, {-9, 9},
965  {-7,7}, {-7,7}, {-7,7}, {-7,7}, {6,7}, {6,7}, {6,7}, {6,7}, {6,7}, {6,7},          {8, 9}, {8, 9}, {-8, 9}, {-8, 9},
966  {6,7}, {6,7}, {-6,7}, {-6,7}, {-6,7}, {-6,7}, {-6,7}, {-6,7}, {-6,7},          {7, 7}, {7, 7}, {7, 7}, {7, 7},
967  {-6,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {-5,7},          {7, 7}, {7, 7}, {7, 7}, {7, 7},
968  {-5,7}, {-5,7}, {-5,7}, {-5,7}, {-5,7}, {-5,7}, {-5,7}, {4,6}, {4,6}, {4,6},          {-7, 7}, {-7, 7}, {-7, 7}, {-7, 7},
969  {4,6}, {4,6}, {4,6}, {4,6}, {4,6}, {4,6}, {4,6}, {4,6}, {4,6}, {4,6}, {4,6},          {-7, 7}, {-7, 7}, {-7, 7}, {-7, 7},
970  {4,6}, {4,6}, {-4,6}, {-4,6}, {-4,6}, {-4,6}, {-4,6}, {-4,6}, {-4,6},          {6, 7}, {6, 7}, {6, 7}, {6, 7},
971  {-4,6}, {-4,6}, {-4,6}, {-4,6}, {-4,6}, {-4,6}, {-4,6}, {-4,6}, {-4,6}          {6, 7}, {6, 7}, {6, 7}, {6, 7},
972  };          {-6, 7}, {-6, 7}, {-6, 7}, {-6, 7},
973            {-6, 7}, {-6, 7}, {-6, 7}, {-6, 7},
974  VLC TMNMVtab2[] = {          {5, 7}, {5, 7}, {5, 7}, {5, 7},
975  {32,12}, {-32,12}, {31,12}, {-31,12}, {30,11}, {30,11}, {-30,11}, {-30,11},          {5, 7}, {5, 7}, {5, 7}, {5, 7},
976  {29,11}, {29,11}, {-29,11}, {-29,11}, {28,11}, {28,11}, {-28,11}, {-28,11},          {-5, 7}, {-5, 7}, {-5, 7}, {-5, 7},
977  {27,11}, {27,11}, {-27,11}, {-27,11}, {26,11}, {26,11}, {-26,11}, {-26,11},          {-5, 7}, {-5, 7}, {-5, 7}, {-5, 7},
978  {25,11}, {25,11}, {-25,11}, {-25,11}, {24,10}, {24,10}, {24,10}, {24,10},          {4, 6}, {4, 6}, {4, 6}, {4, 6},
979  {-24,10}, {-24,10}, {-24,10}, {-24,10}, {23,10}, {23,10}, {23,10}, {23,10},          {4, 6}, {4, 6}, {4, 6}, {4, 6},
980  {-23,10}, {-23,10}, {-23,10}, {-23,10}, {22,10}, {22,10}, {22,10}, {22,10},          {4, 6}, {4, 6}, {4, 6}, {4, 6},
981  {-22,10}, {-22,10}, {-22,10}, {-22,10}, {21,10}, {21,10}, {21,10}, {21,10},          {4, 6}, {4, 6}, {4, 6}, {4, 6},
982  {-21,10}, {-21,10}, {-21,10}, {-21,10}, {20,10}, {20,10}, {20,10}, {20,10},          {-4, 6}, {-4, 6}, {-4, 6}, {-4, 6},
983  {-20,10}, {-20,10}, {-20,10}, {-20,10}, {19,10}, {19,10}, {19,10}, {19,10},          {-4, 6}, {-4, 6}, {-4, 6}, {-4, 6},
984  {-19,10}, {-19,10}, {-19,10}, {-19,10}, {18,10}, {18,10}, {18,10}, {18,10},          {-4, 6}, {-4, 6}, {-4, 6}, {-4, 6},
985  {-18,10}, {-18,10}, {-18,10}, {-18,10}, {17,10}, {17,10}, {17,10}, {17,10},          {-4, 6}, {-4, 6}, {-4, 6}, {-4, 6}
986  {-17,10}, {-17,10}, {-17,10}, {-17,10}, {16,10}, {16,10}, {16,10}, {16,10},  };
987  {-16,10}, {-16,10}, {-16,10}, {-16,10}, {15,10}, {15,10}, {15,10}, {15,10},  
988  {-15,10}, {-15,10}, {-15,10}, {-15,10}, {14,10}, {14,10}, {14,10}, {14,10},  static VLC const TMNMVtab2[] = {
989  {-14,10}, {-14,10}, {-14,10}, {-14,10}, {13,10}, {13,10}, {13,10}, {13,10},          {32, 12}, {-32, 12}, {31, 12}, {-31, 12},
990            {30, 11}, {30, 11}, {-30, 11}, {-30, 11},
991            {29, 11}, {29, 11}, {-29, 11}, {-29, 11},
992            {28, 11}, {28, 11}, {-28, 11}, {-28, 11},
993            {27, 11}, {27, 11}, {-27, 11}, {-27, 11},
994            {26, 11}, {26, 11}, {-26, 11}, {-26, 11},
995            {25, 11}, {25, 11}, {-25, 11}, {-25, 11},
996            {24, 10}, {24, 10}, {24, 10}, {24, 10},
997            {-24, 10}, {-24, 10}, {-24, 10}, {-24, 10},
998            {23, 10}, {23, 10}, {23, 10}, {23, 10},
999            {-23, 10}, {-23, 10}, {-23, 10}, {-23, 10},
1000            {22, 10}, {22, 10}, {22, 10}, {22, 10},
1001            {-22, 10}, {-22, 10}, {-22, 10}, {-22, 10},
1002            {21, 10}, {21, 10}, {21, 10}, {21, 10},
1003            {-21, 10}, {-21, 10}, {-21, 10}, {-21, 10},
1004            {20, 10}, {20, 10}, {20, 10}, {20, 10},
1005            {-20, 10}, {-20, 10}, {-20, 10}, {-20, 10},
1006            {19, 10}, {19, 10}, {19, 10}, {19, 10},
1007            {-19, 10}, {-19, 10}, {-19, 10}, {-19, 10},
1008            {18, 10}, {18, 10}, {18, 10}, {18, 10},
1009            {-18, 10}, {-18, 10}, {-18, 10}, {-18, 10},
1010            {17, 10}, {17, 10}, {17, 10}, {17, 10},
1011            {-17, 10}, {-17, 10}, {-17, 10}, {-17, 10},
1012            {16, 10}, {16, 10}, {16, 10}, {16, 10},
1013            {-16, 10}, {-16, 10}, {-16, 10}, {-16, 10},
1014            {15, 10}, {15, 10}, {15, 10}, {15, 10},
1015            {-15, 10}, {-15, 10}, {-15, 10}, {-15, 10},
1016            {14, 10}, {14, 10}, {14, 10}, {14, 10},
1017            {-14, 10}, {-14, 10}, {-14, 10}, {-14, 10},
1018            {13, 10}, {13, 10}, {13, 10}, {13, 10},
1019  {-13,10}, {-13,10}, {-13,10}, {-13,10}  {-13,10}, {-13,10}, {-13,10}, {-13,10}
1020  };  };
1021    
1022    
1023  VLC DCT3Dtab0[] = {  static VLC const DCT3Dtab0[] = {
1024  {4225,7}, {4209,7}, {4193,7}, {4177,7}, {193,7}, {177,7},  {4225,7}, {4209,7}, {4193,7}, {4177,7}, {193,7}, {177,7},
1025  {161,7}, {4,7}, {4161,6}, {4161,6}, {4145,6}, {4145,6},  {161,7}, {4,7}, {4161,6}, {4161,6}, {4145,6}, {4145,6},
1026  {4129,6}, {4129,6}, {4113,6}, {4113,6}, {145,6}, {145,6},  {4129,6}, {4129,6}, {4113,6}, {4113,6}, {145,6}, {145,6},
# Line 1062  Line 1039 
1039  {17,3}, {17,3}, {17,3}, {17,3}, {17,3}, {17,3},  {17,3}, {17,3}, {17,3}, {17,3}, {17,3}, {17,3},
1040  {33,4}, {33,4}, {33,4}, {33,4}, {33,4}, {33,4},  {33,4}, {33,4}, {33,4}, {33,4}, {33,4}, {33,4},
1041  {33,4}, {33,4}, {2,4}, {2,4},{2,4},{2,4},  {33,4}, {33,4}, {2,4}, {2,4},{2,4},{2,4},
1042  {2,4}, {2,4},{2,4},{2,4},          {2, 4}, {2, 4}, {2, 4}, {2, 4}
1043  };  };
1044    
1045    
1046  VLC DCT3Dtab1[] = {  static VLC const DCT3Dtab1[] = {
1047  {9,10}, {8,10}, {4481,9}, {4481,9}, {4465,9}, {4465,9},  {9,10}, {8,10}, {4481,9}, {4481,9}, {4465,9}, {4465,9},
1048  {4449,9}, {4449,9}, {4433,9}, {4433,9}, {4417,9}, {4417,9},  {4449,9}, {4449,9}, {4433,9}, {4433,9}, {4417,9}, {4417,9},
1049  {4401,9}, {4401,9}, {4385,9}, {4385,9}, {4369,9}, {4369,9},  {4401,9}, {4401,9}, {4385,9}, {4385,9}, {4369,9}, {4369,9},
# Line 1082  Line 1059 
1059  {4241,8}, {4241,8}, {4241,8}, {4241,8}, {225,8}, {225,8},  {4241,8}, {4241,8}, {4241,8}, {4241,8}, {225,8}, {225,8},
1060  {225,8}, {225,8}, {209,8}, {209,8}, {209,8}, {209,8},  {225,8}, {225,8}, {209,8}, {209,8}, {209,8}, {209,8},
1061  {34,8}, {34,8}, {34,8}, {34,8}, {19,8}, {19,8},  {34,8}, {34,8}, {34,8}, {34,8}, {19,8}, {19,8},
1062  {19,8}, {19,8}, {5,8}, {5,8}, {5,8}, {5,8},          {19, 8}, {19, 8}, {5, 8}, {5, 8}, {5, 8}, {5, 8}
1063  };  };
1064    
1065  VLC DCT3Dtab2[] = {  static VLC const DCT3Dtab2[] = {
1066  {4114,11}, {4114,11}, {4099,11}, {4099,11}, {11,11}, {11,11},  {4114,11}, {4114,11}, {4099,11}, {4099,11}, {11,11}, {11,11},
1067  {10,11}, {10,11}, {4545,10}, {4545,10}, {4545,10}, {4545,10},  {10,11}, {10,11}, {4545,10}, {4545,10}, {4545,10}, {4545,10},
1068  {4529,10}, {4529,10}, {4529,10}, {4529,10}, {4513,10}, {4513,10},  {4529,10}, {4529,10}, {4529,10}, {4529,10}, {4513,10}, {4513,10},
# Line 1106  Line 1083 
1083  {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},  {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},
1084  {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},  {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},
1085  {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},  {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},
1086  {7167,7}, };          {7167, 7}
1087    };
1088    
1089    
1090  /* New tables for Intra luminance blocks */  /* New tables for Intra luminance blocks */
1091    
1092  VLC DCT3Dtab3[] = {  static VLC const DCT3Dtab3[] = {
1093      {0x10401, 7}, {0x10301, 7}, {0x00601, 7}, {0x10501, 7},      {0x10401, 7}, {0x10301, 7}, {0x00601, 7}, {0x10501, 7},
1094      {0x00701, 7}, {0x00202, 7}, {0x00103, 7}, {0x00009, 7},      {0x00701, 7}, {0x00202, 7}, {0x00103, 7}, {0x00009, 7},
1095      {0x10002, 6}, {0x10002, 6}, {0x00501, 6}, {0x00501, 6},      {0x10002, 6}, {0x10002, 6}, {0x00501, 6}, {0x00501, 6},
# Line 1139  Line 1117 
1117      {0x00101, 4}, {0x00101, 4}, {0x00101, 4}, {0x00101, 4},      {0x00101, 4}, {0x00101, 4}, {0x00101, 4}, {0x00101, 4},
1118      {0x00101, 4}, {0x00101, 4}, {0x00101, 4}, {0x00101, 4},      {0x00101, 4}, {0x00101, 4}, {0x00101, 4}, {0x00101, 4},
1119      {0x00003, 4}, {0x00003, 4}, {0x00003, 4}, {0x00003, 4},      {0x00003, 4}, {0x00003, 4}, {0x00003, 4}, {0x00003, 4},
1120      {0x00003, 4}, {0x00003, 4}, {0x00003, 4}, {0x00003, 4},          {0x00003, 4}, {0x00003, 4}, {0x00003, 4}, {0x00003, 4}
1121  };  };
1122    
1123    
1124  VLC DCT3Dtab4[] = {  static VLC const DCT3Dtab4[] = {
1125      {0x00012,10}, {0x00011,10}, {0x10e01, 9}, {0x10e01, 9},      {0x00012,10}, {0x00011,10}, {0x10e01, 9}, {0x10e01, 9},
1126      {0x10d01, 9}, {0x10d01, 9}, {0x10c01, 9}, {0x10c01, 9},      {0x10d01, 9}, {0x10d01, 9}, {0x10c01, 9}, {0x10c01, 9},
1127      {0x10b01, 9}, {0x10b01, 9}, {0x10a01, 9}, {0x10a01, 9},      {0x10b01, 9}, {0x10b01, 9}, {0x10a01, 9}, {0x10a01, 9},
# Line 1167  Line 1145 
1145      {0x00104, 8}, {0x00104, 8}, {0x00104, 8}, {0x00104, 8},      {0x00104, 8}, {0x00104, 8}, {0x00104, 8}, {0x00104, 8},
1146      {0x0000c, 8}, {0x0000c, 8}, {0x0000c, 8}, {0x0000c, 8},      {0x0000c, 8}, {0x0000c, 8}, {0x0000c, 8}, {0x0000c, 8},
1147      {0x0000b, 8}, {0x0000b, 8}, {0x0000b, 8}, {0x0000b, 8},      {0x0000b, 8}, {0x0000b, 8}, {0x0000b, 8}, {0x0000b, 8},
1148      {0x0000a, 8}, {0x0000a, 8}, {0x0000a, 8}, {0x0000a, 8},          {0x0000a, 8}, {0x0000a, 8}, {0x0000a, 8}, {0x0000a, 8}
1149  };  };
1150    
1151  VLC DCT3Dtab5[] = {  static VLC const DCT3Dtab5[] = {
1152      {0x10007,11}, {0x10007,11}, {0x10006,11}, {0x10006,11},      {0x10007,11}, {0x10007,11}, {0x10006,11}, {0x10006,11},
1153      {0x00016,11}, {0x00016,11}, {0x00015,11}, {0x00015,11},      {0x00016,11}, {0x00016,11}, {0x00015,11}, {0x00015,11},
1154      {0x10202,10}, {0x10202,10}, {0x10202,10}, {0x10202,10},      {0x10202,10}, {0x10202,10}, {0x10202,10}, {0x10202,10},
# Line 1200  Line 1178 
1178      {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},      {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
1179      {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},      {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
1180      {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},      {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
1181      {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},          {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}
1182  };  };
1183    
1184  VLC ERRtab[] = {  static short const dc_threshold[] = {
1185          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},          26708,   29545,   25120,   28265,   29281,    8313,   29557,   29541,
1186            18208,   21838,   18208,   19536,   29472,   26223,   30580,   29281,
1187             8293,   25956,   26994,   25974,    8292,   29286,   28015,   22560,
1188            18774,    8260,   20557,   18245,    8244,   26664,   29812,   14960,
1189            12079,   30583,   11895,   30328,   25705,   28462,   26482,   29472,
1190            30063,   25458,   29541,    8233,   29505,    8299,   28518,    8306,
1191            26740,    8293,   28531,   29301,   25955,    8307,   28532,   31008,
1192            30063,    8306,   26980,   29811,   26994,   30050,   28532,    2674
1193    };
1194    
1195    
1196    static VLC const ERRtab[] = {
1197          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},
1198          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},
1199          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},
1200          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},
1201            {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0}
1202  };  };
1203    
1204  static const VLC dc_lum_tab[] = {  static VLC const dc_lum_tab[] = {
1205          {0, 0},          {0, 0}, {4, 3}, {3, 3}, {0, 3},
         {4, 3}, {3, 3}, {0, 3},  
1206          {2, 2}, {2, 2}, {1, 2}, {1, 2},          {2, 2}, {2, 2}, {1, 2}, {1, 2},
1207  };  };
1208    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.11

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4