[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.4, Fri Mar 15 09:19:57 2002 UTC revision 1.12, Sun Nov 17 00:57:57 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     *  This file is part of XviD, a free MPEG-4 video encoder/decoder
9     *
10     *  XviD is free software; you can redistribute it and/or modify it
11     *  under the terms of the GNU General Public License as published by
12     *  the Free Software Foundation; either version 2 of the License, or
13     *  (at your option) any later version.
14     *
15     *  This program is distributed in the hope that it will be useful,
16     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18     *  GNU General Public License for more details.
19     *
20     *  You should have received a copy of the GNU General Public License
21     *  along with this program; if not, write to the Free Software
22     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23     *
24     *  Under section 8 of the GNU General Public License, the copyright
25     *  holders of XVID explicitly forbid distribution in the following
26     *  countries:
27     *
28     *    - Japan
29     *    - United States of America
30     *
31     *  Linking XviD statically or dynamically with other modules is making a
32     *  combined work based on XviD.  Thus, the terms and conditions of the
33     *  GNU General Public License cover the whole combination.
34     *
35     *  As a special exception, the copyright holders of XviD give you
36     *  permission to link XviD with independent modules that communicate with
37     *  XviD solely through the VFW1.1 and DShow interfaces, regardless of the
38     *  license terms of these independent modules, and to copy and distribute
39     *  the resulting combined work under terms of your choice, provided that
40     *  every copy of the combined work is accompanied by a complete copy of
41     *  the source code of XviD (the version of XviD used to produce the
42     *  combined work), being distributed under the terms of the GNU General
43     *  Public License plus this exception.  An independent module is a module
44     *  which is not derived from or based on XviD.
45     *
46     *  Note that people who make modified versions of XviD are not obligated
47     *  to grant this special exception for their modified versions; it is
48     *  their choice whether to do so.  The GNU General Public License gives
49     *  permission to release a modified version without this exception; this
50     *  exception also makes it possible to release a modified version which
51     *  carries forward this exception.
52     *
53     * $Id$
54     *
55     ****************************************************************************/
56    
57  #ifndef _VLC_CODES_H_  #ifndef _VLC_CODES_H_
58  #define _VLC_CODES_H_  #define _VLC_CODES_H_
59    
60  #include "../portab.h"  #include "../portab.h"
61    #include "mbcoding.h"
62    
63  #define VLC_ERROR       (-1)  #define VLC_ERROR       (-1)
64    #define ESCAPE 7167
65    
66    /*****************************************************************************
67     * The Vector Length Coding structure
68     ****************************************************************************/
69    
70  typedef struct  typedef struct
71  {  {
72          uint32_t code;          uint32_t code;
73          int8_t len;          int8_t len;
74  } VLC;  }
75    VLC;
76    
77    static VLC *DCT3D[2];
78    
79  /******************************************************************  
80   * common tables between encoder/decoder                          *  /*****************************************************************************
81   ******************************************************************/   * common tables between encoder/decoder
82     ****************************************************************************/
83    
84  /* constants taken from momusys/vm_common/inlcude/max_level.h */  /* constants taken from momusys/vm_common/inlcude/max_level.h */
85  static char max_level[4][64] = {  static char const max_level[4][64] = {
86          { // intra, last = 0          /* intra, last = 0 */
87            {
88                  27, 10,  5,  4,  3,  3,  3,  3,                  27, 10,  5,  4,  3,  3,  3,  3,
89                  2,  2,  1,  1,  1,  1,  1,  0,                  2,  2,  1,  1,  1,  1,  1,  0,
90                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
# Line 26  Line 92 
92                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
93                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
94                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
95                  0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
96          },          },
97    
98          { // intra, last = 1          /* intra, last = 1 */
99            {
100                  8,  3,  2,  2,  2,  2,  2,  1,                  8,  3,  2,  2,  2,  2,  2,  1,
101                  1,  1,  1,  1,  1,  1,  1,  1,                  1,  1,  1,  1,  1,  1,  1,  1,
102                  1,  1,  1,  1,  1,  0,  0,  0,                  1,  1,  1,  1,  1,  0,  0,  0,
# Line 37  Line 104 
104                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
105                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
106                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
107                  0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
108          },          },
109    
110          { // inter, last = 0          /* inter, last = 0 */
111            {
112                  12,  6,  4,  3,  3,  3,  3,  2,                  12,  6,  4,  3,  3,  3,  3,  2,
113                  2,  2,  2,  1,  1,  1,  1,  1,                  2,  2,  2,  1,  1,  1,  1,  1,
114                  1,  1,  1,  1,  1,  1,  1,  1,                  1,  1,  1,  1,  1,  1,  1,  1,
# Line 48  Line 116 
116                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
117                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
118                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
119                  0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
120          },          },
121    
122          { // inter, last = 1          /* inter, last = 1 */
123            {
124                  3,  2,  1,  1,  1,  1,  1,  1,                  3,  2,  1,  1,  1,  1,  1,  1,
125                  1,  1,  1,  1,  1,  1,  1,  1,                  1,  1,  1,  1,  1,  1,  1,  1,
126                  1,  1,  1,  1,  1,  1,  1,  1,                  1,  1,  1,  1,  1,  1,  1,  1,
# Line 59  Line 128 
128                  1,  1,  1,  1,  1,  1,  1,  1,                  1,  1,  1,  1,  1,  1,  1,  1,
129                  1,  0,  0,  0,  0,  0,  0,  0,                  1,  0,  0,  0,  0,  0,  0,  0,
130                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
131                  0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
132          }          }
133  };  };
134    
135  static char max_run[4][256] = {  static char const max_run[4][256] = {
136          { // intra, last = 0          /* intra, last = 0 */
137            {
138                  0, 14,  9,  7,  3,  2,  1,  1,                  0, 14,  9,  7,  3,  2,  1,  1,
139                  1,  1,  1,  0,  0,  0,  0,  0,                  1,  1,  1,  0,  0,  0,  0,  0,
140                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
# Line 96  Line 166 
166                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
167                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
168                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
169                  0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
170          },          },
171    
172          { // intra, last = 1          /* intra, last = 1 */
173            {
174                  0, 20,  6,  1,  0,  0,  0,  0,                  0, 20,  6,  1,  0,  0,  0,  0,
175                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
176                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
# Line 131  Line 202 
202                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
203                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
204                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
205                  0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
206          },          },
207    
208          { // inter, last = 0          /* inter, last = 0 */
209            {
210                  0, 26, 10,  6,  2,  1,  1,  0,                  0, 26, 10,  6,  2,  1,  1,  0,
211                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
212                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
# Line 166  Line 238 
238                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
239                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
240                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
241                  0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
242          },          },
243    
244          { // inter, last = 1          /* inter, last = 1 */
245            {
246                  0, 40,  1,  0,  0,  0,  0,  0,                  0, 40,  1,  0,  0,  0,  0,  0,
247                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
248                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
# Line 201  Line 274 
274                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
275                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
276                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
277                  0,  0,  0,  0,  0,  0,  0,  0,           0, 0, 0, 0, 0, 0, 0, 0
278          }          }
279  };  };
280    
# Line 215  Line 288 
288    
289  /* first part of coeffs for last = 0. Indexed by [run][level-1] */  /* first part of coeffs for last = 0. Indexed by [run][level-1] */
290    
291  static VLC coeff_tab0[2][12] = {  static VLC const coeff_tab0[2][12] = {
292          /*          /* run = 0  */
           run = 0  
         */  
293          {          {
294                  {0x02, 2}, {0x0f, 4}, {0x15, 6}, {0x17, 7},                  {0x02, 2}, {0x0f, 4}, {0x15, 6}, {0x17, 7},
295                  {0x1f, 8}, {0x25, 9}, {0x24, 9}, {0x21, 10},                  {0x1f, 8}, {0x25, 9}, {0x24, 9}, {0x21, 10},
296                  {0x20, 10}, {0x07, 11}, {0x06, 11}, {0x20, 11}                  {0x20, 10}, {0x07, 11}, {0x06, 11}, {0x20, 11}
297          },          },
298          /*  
299            run = 1          /* run = 1 */
         */  
300          {          {
301                  {0x06, 3}, {0x14, 6}, {0x1e, 8}, {0x0f, 10},                  {0x06, 3}, {0x14, 6}, {0x1e, 8}, {0x0f, 10},
302                  {0x21, 11}, {0x50, 12}, {0x00, 0}, {0x00, 0},                  {0x21, 11}, {0x50, 12}, {0x00, 0}, {0x00, 0},
# Line 236  Line 306 
306    
307  /* rest of coeffs for last = 0. indexing by [run-2][level-1] */  /* rest of coeffs for last = 0. indexing by [run-2][level-1] */
308    
309  static VLC coeff_tab1[25][4] = {  static VLC const coeff_tab1[25][4] = {
310          /*          /* First row is run=2, then each row is run 2 + index */
311            run = 2          {{0x0e, 4}, {0x1d, 8}, {0x0e, 10}, {0x51, 12}},
312          */          {{0x0d, 5}, {0x23, 9},  {0x0d, 10}, {0x00, 0}},
313          {          {{0x0c, 5}, {0x22, 9},  {0x52, 12}, {0x00, 0}},
314                  {0x0e, 4}, {0x1d, 8}, {0x0e, 10}, {0x51, 12}          {{0x0b, 5}, {0x0c, 10}, {0x53, 12}, {0x00, 0}},
315          },          {{0x13, 6}, {0x0b, 10}, {0x54, 12}, {0x00, 0}},
316          /*          {{0x12, 6}, {0x0a, 10}, {0x00, 0},  {0x00, 0}},
317            run = 3          {{0x11, 6}, {0x09, 10}, {0x00, 0},  {0x00, 0}},
318          */          {{0x10, 6}, {0x08, 10}, {0x00, 0},  {0x00, 0}},
319          {          {{0x16, 7}, {0x55, 12}, {0x00, 0},  {0x00, 0}},
320                  {0x0d, 5}, {0x23, 9}, {0x0d, 10}, {0x00, 0}          {{0x15, 7}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
321          },          {{0x14, 7}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
322          /*          {{0x1c, 8}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
323            run = 4-26          {{0x1b, 8}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
324          */          {{0x21, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
325          {          {{0x20, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
326                  {0x0c, 5}, {0x22, 9}, {0x52, 12}, {0x00, 0}          {{0x1f, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
327          },          {{0x1e, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
328          {          {{0x1d, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
329                  {0x0b, 5}, {0x0c, 10}, {0x53, 12}, {0x00, 0}          {{0x1c, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
330          },          {{0x1b, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
331          {          {{0x1a, 9}, {0x00, 0},  {0x00, 0},  {0x00, 0}},
332                  {0x13, 6}, {0x0b, 10}, {0x54, 12}, {0x00, 0}          {{0x22, 11}, {0x00, 0}, {0x00, 0},  {0x00, 0}},
333          },          {{0x23, 11}, {0x00, 0}, {0x00, 0},  {0x00, 0}},
334          {          {{0x56, 12}, {0x00, 0}, {0x00, 0},  {0x00, 0}},
335                  {0x12, 6}, {0x0a, 10}, {0x00, 0}, {0x00, 0}          {{0x57, 12}, {0x00, 0}, {0x00, 0},  {0x00, 0}}
336          },  
         {  
                 {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}  
         }  
337  };  };
338    
339  /* first coeffs of last = 1. indexing by [run][level-1] */  /* first coeffs of last = 1. indexing by [run][level-1] */
340    
341  static VLC coeff_tab2[2][3] = {  static VLC const coeff_tab2[2][3] = {
342          /*          /*  run = 0 */
343            run = 0          {{0x07, 4}, {0x19, 9},  {0x05, 11}},
344          */          /* run = 1 */
345          {          {{0x0f, 6}, {0x04, 11}, {0x00, 0}}
                 {0x07, 4}, {0x19, 9}, {0x05, 11}  
         },  
         /*  
           run = 1  
         */  
         {  
                 {0x0f, 6}, {0x04, 11}, {0x00, 0}  
         }  
346  };  };
347    
348  /* rest of coeffs for last = 1. indexing by [run-2] */  /* rest of coeffs for last = 1. indexing by [run-2] */
349    
350  static VLC coeff_tab3[40][1] = {  static VLC const coeff_tab3[40][1] = {
351          {{0x0e, 6}},  {{0x0d, 6}},  {{0x0c, 6}},          {{0x0e, 6}},  {{0x0d, 6}},  {{0x0c, 6}},  {{0x13, 7}},
352          {{0x13, 7}},  {{0x12, 7}},  {{0x11, 7}},  {{0x10, 7}},          {{0x12, 7}},  {{0x11, 7}},  {{0x10, 7}},  {{0x1a, 8}},
353          {{0x1a, 8}},  {{0x19, 8}},  {{0x18, 8}},  {{0x17, 8}},          {{0x19, 8}},  {{0x18, 8}},  {{0x17, 8}},  {{0x16, 8}},
354          {{0x16, 8}},  {{0x15, 8}},  {{0x14, 8}},  {{0x13, 8}},          {{0x15, 8}},  {{0x14, 8}},  {{0x13, 8}},  {{0x18, 9}},
355          {{0x18, 9}},  {{0x17, 9}},  {{0x16, 9}},  {{0x15, 9}},          {{0x17, 9}},  {{0x16, 9}},  {{0x15, 9}},  {{0x14, 9}},
356          {{0x14, 9}},  {{0x13, 9}},  {{0x12, 9}},  {{0x11, 9}},          {{0x13, 9}},  {{0x12, 9}},  {{0x11, 9}},  {{0x07, 10}},
357          {{0x07, 10}}, {{0x06, 10}}, {{0x05, 10}}, {{0x04, 10}},          {{0x06, 10}}, {{0x05, 10}}, {{0x04, 10}}, {{0x24, 11}},
358          {{0x24, 11}}, {{0x25, 11}}, {{0x26, 11}}, {{0x27, 11}},          {{0x25, 11}}, {{0x26, 11}}, {{0x27, 11}}, {{0x58, 12}},
359          {{0x58, 12}}, {{0x59, 12}}, {{0x5a, 12}}, {{0x5b, 12}},          {{0x59, 12}}, {{0x5a, 12}}, {{0x5b, 12}}, {{0x5c, 12}},
360          {{0x5c, 12}}, {{0x5d, 12}}, {{0x5e, 12}}, {{0x5f, 12}},          {{0x5d, 12}}, {{0x5e, 12}}, {{0x5f, 12}}, {{0x00, 0}}
         {{0x00, 0}}  
361  };  };
362    
363  /* New tables for Intra luminance coefficients. Same codewords,  /*
364     different meaning */   * New tables for Intra luminance coefficients. Same codewords,
365     * different meaning
366     */
367    
368  /* Coeffs for last = 0, run = 0. Indexed by [level-1] */  /* Coeffs for last = 0, run = 0. Indexed by [level-1] */
369    
370  static VLC coeff_tab4[27] = {  static VLC const coeff_tab4[27] = {
371          /*          /* run = 0 */
372            run = 0          {0x02, 2},  {0x06, 3},  {0x0f, 4},
373          */          {0x0d, 5},  {0x0c, 5},  {0x15, 6},
374          {0x02, 2}, {0x06, 3}, {0x0f, 4}, {0x0d, 5},          {0x13, 6},  {0x12, 6},  {0x17, 7},
375          {0x0c, 5}, {0x15, 6}, {0x13, 6}, {0x12, 6},          {0x1f, 8},  {0x1e, 8},  {0x1d, 8},
376          {0x17, 7}, {0x1f, 8}, {0x1e, 8}, {0x1d, 8},          {0x25, 9},  {0x24, 9},  {0x23, 9},
377          {0x25, 9}, {0x24, 9}, {0x23, 9}, {0x21, 9},          {0x21, 9},  {0x21, 10}, {0x20, 10},
378          {0x21, 10}, {0x20, 10}, {0x0f, 10}, {0x0e, 10},          {0x0f, 10}, {0x0e, 10}, {0x07, 11},
379          {0x07, 11}, {0x06, 11}, {0x20, 11}, {0x21, 11},          {0x06, 11}, {0x20, 11}, {0x21, 11},
380          {0x50, 12}, {0x51, 12}, {0x52, 12}          {0x50, 12}, {0x51, 12}, {0x52, 12}
381  };  };
382    
383  /* Coeffs for last = 0, run = 1. Indexed by [level-1] */  /* Coeffs for last = 0, run = 1. Indexed by [level-1] */
384    
385  static VLC coeff_tab5[10] = {  static VLC const coeff_tab5[10] = {
386          {0x0e, 4}, {0x14, 6}, {0x16, 7}, {0x1c, 8},          {0x0e, 4}, {0x14, 6},  {0x16, 7},  {0x1c, 8},  {0x20, 9},
387          {0x20, 9}, {0x1f, 9}, {0x0d, 10}, {0x22, 11},          {0x1f, 9}, {0x0d, 10}, {0x22, 11}, {0x53, 12}, {0x55, 12}
         {0x53, 12}, {0x55, 12}  
388  };  };
389    
390  /* 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] */
391    
392  static VLC coeff_tab6[8][5] = {  static VLC coeff_tab6[8][5] = {
393          /*          /* run = 2 */
394            run = 2          {{0x0b, 5}, {0x15, 7}, {0x1e, 9}, {0x0c, 10}, {0x56, 12}},
395          */  
396          {          /* run = 3 */
397                  {0x0b, 5}, {0x15, 7}, {0x1e, 9}, {0x0c, 10},          {{0x11, 6}, {0x1b, 8}, {0x1d, 9}, {0x0b, 10}, {0x00, 0}},
398                  {0x56, 12}  
399          },          /* run = 4 */
400          /*          {{0x10, 6}, {0x22, 9}, {0x0a, 10}, {0x00, 0}, {0x00, 0}},
401            run = 3  
402          */          /* run = 5 */
403          {          {{0x0d, 6}, {0x1c, 9}, {0x08, 10}, {0x00, 0}, {0x00, 0}},
404                  {0x11, 6}, {0x1b, 8}, {0x1d, 9}, {0x0b, 10},  
405                  {0x00, 0}          /* run = 6 */
406          },          {{0x12, 7}, {0x1b, 9}, {0x54, 12}, {0x00, 0}, {0x00, 0}},
407          /*  
408            run = 4          /* run = 7 */
409          */          {{0x14, 7}, {0x1a, 9}, {0x57, 12}, {0x00, 0}, {0x00, 0}},
410          {  
411                  {0x10, 6}, {0x22, 9}, {0x0a, 10}, {0x00, 0},          /* run = 8 */
412                  {0x00, 0}          {{0x19, 8}, {0x09, 10}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
413          },  
414          /*          /* run = 9 */
415            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}  
         }  
416  };  };
417    
418  /* Coeffs for last = 0, run = 10 -> 14. Indexed by [run-10] */  /* Coeffs for last = 0, run = 10 -> 14. Indexed by [run-10] */
419    
420  static VLC coeff_tab7[5][1] = {  static VLC const coeff_tab7[5][1] = {
421          {{0x17, 8}}, {{0x19, 9}}, {{0x18, 9}}, {{0x07, 10}},          {{0x17, 8}},
422            {{0x19, 9}},
423            {{0x18, 9}},
424            {{0x07, 10}},
425          {{0x58, 12}}          {{0x58, 12}}
426  };  };
427    
428  /* Coeffs for last = 1, run = 0. Indexed by [level-1] */  /* Coeffs for last = 1, run = 0. Indexed by [level-1] */
429    
430  static VLC coeff_tab8[8] = {  static VLC const coeff_tab8[8] = {
431          {0x07, 4}, {0x0c, 6}, {0x16, 8}, {0x17, 9},          {0x07, 4}, {0x0c, 6}, {0x16, 8}, {0x17, 9},
432          {0x06, 10}, {0x05, 11}, {0x04, 11}, {0x59, 12}          {0x06, 10}, {0x05, 11}, {0x04, 11}, {0x59, 12}
433  };  };
434    
435  /* 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] */
436    
437  static VLC coeff_tab9[6][3] = {  static VLC const coeff_tab9[6][3] = {
438          /*          /* run = 1 */
439            run = 1          {{0x0f, 6}, {0x16, 9}, {0x05, 10}},
440          */  
441          {          /* run = 2 */
442                  {0x0f, 6}, {0x16, 9}, {0x05, 10}          {{0x0e, 6}, {0x04, 10}, {0x00, 0}},
443          },  
444          /*          /* run = 3 */
445            run = 2          {{0x11, 7}, {0x24, 11}, {0x00, 0}},
446          */  
447          {          /* run = 4 */
448                  {0x0e, 6}, {0x04, 10}, {0x00, 0}          {{0x10, 7}, {0x25, 11}, {0x00, 0}},
449          },  
450          /*          /* run = 5 */
451            run = 3          {{0x13, 7}, {0x5a, 12}, {0x00, 0}},
452          */  
453          {          /* run = 6 */
454                  {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}  
         }  
455  };  };
456    
457  /* Coeffs for last = 1, run = 7 -> 20. Indexed by [run-7] */  /* Coeffs for last = 1, run = 7 -> 20. Indexed by [run-7] */
458    
459  static VLC coeff_tab10[14][1] = {  static VLC const coeff_tab10[14][1] = {
460          {{0x14, 8}},  {{0x13, 8}}, {{0x1a, 8}}, {{0x15, 9}},          {{0x14, 8}},
461          {{0x14, 9}},  {{0x13, 9}}, {{0x12, 9}}, {{0x11, 9}},          {{0x13, 8}},
462          {{0x26, 11}}, {{0x27, 11}}, {{0x5c, 12}}, {{0x5d, 12}},          {{0x1a, 8}},
463          {{0x5e, 12}}, {{0x5f, 12}}          {{0x15, 9}},
464            {{0x14, 9}},
465            {{0x13, 9}},
466            {{0x12, 9}},
467            {{0x11, 9}},
468            {{0x26, 11}},
469            {{0x27, 11}},
470            {{0x5c, 12}},
471            {{0x5d, 12}},
472            {{0x5e, 12}},
473            {{0x5f, 12}}
474  };  };
475    
476    
477  static VLC *coeff_intra_last0[15] = {  static VLC const *coeff_intra_last0[15] = {
478          coeff_tab4,          coeff_tab4,
479          coeff_tab5,          coeff_tab5,
480          coeff_tab6[0],          coeff_tab6[0],
# Line 526  Line 492 
492          coeff_tab7[4]          coeff_tab7[4]
493  };  };
494    
495  static VLC *coeff_intra_last1[21] = {  static VLC const *coeff_intra_last1[21] = {
496          coeff_tab8,          coeff_tab8,
497          coeff_tab9[0],          coeff_tab9[0],
498          coeff_tab9[1],          coeff_tab9[1],
# Line 550  Line 516 
516          coeff_tab10[13],          coeff_tab10[13],
517  };  };
518    
519  static VLC *coeff_inter_last0[27] = {  static VLC const *coeff_inter_last0[27] = {
520          coeff_tab0[0],          coeff_tab0[0],
521          coeff_tab0[1],          coeff_tab0[1],
522          coeff_tab1[0],          coeff_tab1[0],
# Line 580  Line 546 
546          coeff_tab1[24],          coeff_tab1[24],
547  };  };
548    
549  static VLC *coeff_inter_last1[42] = {  static VLC const *coeff_inter_last1[42] = {
550          coeff_tab2[0],          coeff_tab2[0],
551          coeff_tab2[1],          coeff_tab2[1],
552          coeff_tab3[0],          coeff_tab3[0],
# Line 625  Line 591 
591          coeff_tab3[39],          coeff_tab3[39],
592  };  };
593    
594  static VLC **coeff_vlc[4] = {  static VLC const **coeff_vlc[4] = {
595          coeff_intra_last0,          coeff_intra_last0,
596          coeff_intra_last1,          coeff_intra_last1,
597          coeff_inter_last0,          coeff_inter_last0,
598          coeff_inter_last1,          coeff_inter_last1,
599  };  };
600    
601  /* MCBPC Indexing by cbpc in first two bits, mode in last two.  /*
602   CBPC as in table 4/H.263, MB type (mode): 3 = 01, 4 = 10.   * MCBPC Indexing by cbpc in first two bits, mode in last two.
603   Example: cbpc = 01 and mode = 4 gives index = 0110 = 6. */   * CBPC as in table 4/H.263, MB type (mode): 3 = 01, 4 = 10.
604     * Example: cbpc = 01 and mode = 4 gives index = 0110 = 6.
605     */
606    
607  static VLC mcbpc_intra_tab[15] = {  static VLC const mcbpc_intra_tab[15] = {
608      {0x01, 9}, {0x01, 1}, {0x01, 4}, {0x00, 0},      {0x01, 9}, {0x01, 1}, {0x01, 4}, {0x00, 0},
609      {0x00, 0}, {0x01, 3}, {0x01, 6}, {0x00, 0},      {0x00, 0}, {0x01, 3}, {0x01, 6}, {0x00, 0},
610      {0x00, 0}, {0x02, 3}, {0x02, 6}, {0x00, 0},      {0x00, 0}, {0x02, 3}, {0x02, 6}, {0x00, 0},
# Line 646  Line 614 
614  /* MCBPC inter.  /* MCBPC inter.
615     Addressing: 5 bit ccmmm (cc = CBPC, mmm = mode (1-4 binary)) */     Addressing: 5 bit ccmmm (cc = CBPC, mmm = mode (1-4 binary)) */
616    
617  static VLC mcbpc_inter_tab[29] = {  static VLC const mcbpc_inter_tab[29] = {
618      {1, 1}, {3, 3}, {2, 3}, {3, 5}, {4, 6}, {1, 9}, {0, 0}, {0, 0},      {1, 1}, {3, 3}, {2, 3}, {3, 5}, {4, 6}, {1, 9}, {0, 0}, {0, 0},
619      {3, 4}, {7, 7}, {5, 7}, {4, 8}, {4, 9}, {0, 0}, {0, 0}, {0, 0},      {3, 4}, {7, 7}, {5, 7}, {4, 8}, {4, 9}, {0, 0}, {0, 0}, {0, 0},
620      {2, 4}, {6, 7}, {4, 7}, {3, 8}, {3, 9}, {0, 0}, {0, 0}, {0, 0},      {2, 4}, {6, 7}, {4, 7}, {3, 8}, {3, 9}, {0, 0}, {0, 0}, {0, 0},
621      {5, 6}, {5, 9}, {5, 8}, {3, 7}, {2, 9}      {5, 6}, {5, 9}, {5, 8}, {3, 7}, {2, 9}
622  };  };
623    
624  static const VLC cbpy_tab[16] = {  static VLC const cbpy_tab[16] = {
625          {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},
626          {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}
627  };  };
628    
629  static const VLC dcy_tab[511] = {  static VLC const dcy_tab[511] = {
630          {0x100, 15}, {0x101, 15}, {0x102, 15}, {0x103, 15},          {0x100, 15}, {0x101, 15}, {0x102, 15}, {0x103, 15},
631          {0x104, 15}, {0x105, 15}, {0x106, 15}, {0x107, 15},          {0x104, 15}, {0x105, 15}, {0x106, 15}, {0x107, 15},
632          {0x108, 15}, {0x109, 15}, {0x10a, 15}, {0x10b, 15},          {0x108, 15}, {0x109, 15}, {0x10a, 15}, {0x10b, 15},
# Line 789  Line 757 
757          {0x1fd, 15}, {0x1fe, 15}, {0x1ff, 15},          {0x1fd, 15}, {0x1fe, 15}, {0x1ff, 15},
758  };  };
759    
760  static const VLC dcc_tab[511] = {  static VLC const dcc_tab[511] = {
761          {0x100, 16}, {0x101, 16}, {0x102, 16}, {0x103, 16},          {0x100, 16}, {0x101, 16}, {0x102, 16}, {0x103, 16},
762          {0x104, 16}, {0x105, 16}, {0x106, 16}, {0x107, 16},          {0x104, 16}, {0x105, 16}, {0x106, 16}, {0x107, 16},
763          {0x108, 16}, {0x109, 16}, {0x10a, 16}, {0x10b, 16},          {0x108, 16}, {0x109, 16}, {0x10a, 16}, {0x10b, 16},
# Line 921  Line 889 
889  };  };
890    
891    
892  static const VLC mb_motion_table[65] = {  static VLC const mb_motion_table[65] = {
893          {0x05, 13}, {0x07, 13}, {0x05, 12}, {0x07, 12},          {0x05, 13}, {0x07, 13}, {0x05, 12}, {0x07, 12},
894          {0x09, 12}, {0x0b, 12}, {0x0d, 12}, {0x0f, 12},          {0x09, 12}, {0x0b, 12}, {0x0d, 12}, {0x0f, 12},
895          {0x09, 11}, {0x0b, 11}, {0x0d, 11}, {0x0f, 11},          {0x09, 11}, {0x0b, 11}, {0x0d, 11}, {0x0f, 11},
# Line 946  Line 914 
914   * decoder tables                                                 *   * decoder tables                                                 *
915   ******************************************************************/   ******************************************************************/
916    
917  static const VLC mcbpc_intra_table[64] = {  static VLC const mcbpc_intra_table[64] = {
918          {-1,0},          {-1, 0}, {20, 6}, {36, 6}, {52, 6}, {4, 4},  {4, 4},  {4, 4},  {4, 4},
919          {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},
920          {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},
921          {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},
922          {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},
923          {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},
924          {51,3}, {3, 1},          {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},
925          {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}  
926  };  };
927    
928    
929  static const VLC mcbpc_inter_table[257] = {  static VLC const mcbpc_inter_table[257] = {
930          {VLC_ERROR,0},          {VLC_ERROR, 0}, {255, 9}, {52, 9}, {36, 9}, {20, 9}, {49, 9}, {35, 8}, {35, 8},
931          {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},
932          {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},
933          {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},
934          {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},
935          {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},
936          {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},
937          {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},
938          {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},
939          {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},
940          {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},
941          {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},
942          {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},
943          {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},
944          {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},
945          {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},
946          {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},
947          {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},
948          {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},
949          {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},
950          {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},
951          {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},
952          {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},
953          {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},
954          {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},
955          {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},
956          {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},
957          {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},
958          {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},
959          {1,3}, {1,3}, {1,3}, {0,1}          {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
960            {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
961            {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
962            {0, 1}
963  };  };
964    
965  static const VLC cbpy_table[64] =  static VLC const cbpy_table[64] = {
 {  
966          {-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},
967          {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},
968          {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},
969          {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},
970          {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},
971          {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},
972          {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},
973          {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}  
974  };  };
975    
976    
977  VLC TMNMVtab0[] = {  static VLC const TMNMVtab0[] = {
978          {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},
979          {-1,2}, {-1,2}, {-1,2}, {-1,2}          {1, 2}, {1, 2}, {1, 2}, {-1, 2}, {-1, 2}, {-1, 2}, {-1, 2}
980  };  };
981    
982  VLC TMNMVtab1[] = {  static VLC const TMNMVtab1[] = {
983          {12,10}, {-12,10}, {11,10}, {-11,10}, {10,9}, {10,9}, {-10,9}, {-10,9},          {12, 10}, {-12, 10}, {11, 10}, {-11, 10},
984          {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},
985          {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},
986          {-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},
987          {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},
988          {-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},
989          {-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},
990          {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},
991          {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},
992          {-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},
993  };          {-6, 7}, {-6, 7}, {-6, 7}, {-6, 7},
994            {-6, 7}, {-6, 7}, {-6, 7}, {-6, 7},
995  VLC TMNMVtab2[] = {          {5, 7}, {5, 7}, {5, 7}, {5, 7},
996          {32,12}, {-32,12}, {31,12}, {-31,12}, {30,11}, {30,11}, {-30,11}, {-30,11},          {5, 7}, {5, 7}, {5, 7}, {5, 7},
997          {29,11}, {29,11}, {-29,11}, {-29,11}, {28,11}, {28,11}, {-28,11}, {-28,11},          {-5, 7}, {-5, 7}, {-5, 7}, {-5, 7},
998          {27,11}, {27,11}, {-27,11}, {-27,11}, {26,11}, {26,11}, {-26,11}, {-26,11},          {-5, 7}, {-5, 7}, {-5, 7}, {-5, 7},
999          {25,11}, {25,11}, {-25,11}, {-25,11}, {24,10}, {24,10}, {24,10}, {24,10},          {4, 6}, {4, 6}, {4, 6}, {4, 6},
1000          {-24,10}, {-24,10}, {-24,10}, {-24,10}, {23,10}, {23,10}, {23,10}, {23,10},          {4, 6}, {4, 6}, {4, 6}, {4, 6},
1001          {-23,10}, {-23,10}, {-23,10}, {-23,10}, {22,10}, {22,10}, {22,10}, {22,10},          {4, 6}, {4, 6}, {4, 6}, {4, 6},
1002          {-22,10}, {-22,10}, {-22,10}, {-22,10}, {21,10}, {21,10}, {21,10}, {21,10},          {4, 6}, {4, 6}, {4, 6}, {4, 6},
1003          {-21,10}, {-21,10}, {-21,10}, {-21,10}, {20,10}, {20,10}, {20,10}, {20,10},          {-4, 6}, {-4, 6}, {-4, 6}, {-4, 6},
1004          {-20,10}, {-20,10}, {-20,10}, {-20,10}, {19,10}, {19,10}, {19,10}, {19,10},          {-4, 6}, {-4, 6}, {-4, 6}, {-4, 6},
1005          {-19,10}, {-19,10}, {-19,10}, {-19,10}, {18,10}, {18,10}, {18,10}, {18,10},          {-4, 6}, {-4, 6}, {-4, 6}, {-4, 6},
1006          {-18,10}, {-18,10}, {-18,10}, {-18,10}, {17,10}, {17,10}, {17,10}, {17,10},          {-4, 6}, {-4, 6}, {-4, 6}, {-4, 6}
1007          {-17,10}, {-17,10}, {-17,10}, {-17,10}, {16,10}, {16,10}, {16,10}, {16,10},  };
1008          {-16,10}, {-16,10}, {-16,10}, {-16,10}, {15,10}, {15,10}, {15,10}, {15,10},  
1009          {-15,10}, {-15,10}, {-15,10}, {-15,10}, {14,10}, {14,10}, {14,10}, {14,10},  static VLC const TMNMVtab2[] = {
1010          {-14,10}, {-14,10}, {-14,10}, {-14,10}, {13,10}, {13,10}, {13,10}, {13,10},          {32, 12}, {-32, 12}, {31, 12}, {-31, 12},
1011            {30, 11}, {30, 11}, {-30, 11}, {-30, 11},
1012            {29, 11}, {29, 11}, {-29, 11}, {-29, 11},
1013            {28, 11}, {28, 11}, {-28, 11}, {-28, 11},
1014            {27, 11}, {27, 11}, {-27, 11}, {-27, 11},
1015            {26, 11}, {26, 11}, {-26, 11}, {-26, 11},
1016            {25, 11}, {25, 11}, {-25, 11}, {-25, 11},
1017            {24, 10}, {24, 10}, {24, 10}, {24, 10},
1018            {-24, 10}, {-24, 10}, {-24, 10}, {-24, 10},
1019            {23, 10}, {23, 10}, {23, 10}, {23, 10},
1020            {-23, 10}, {-23, 10}, {-23, 10}, {-23, 10},
1021            {22, 10}, {22, 10}, {22, 10}, {22, 10},
1022            {-22, 10}, {-22, 10}, {-22, 10}, {-22, 10},
1023            {21, 10}, {21, 10}, {21, 10}, {21, 10},
1024            {-21, 10}, {-21, 10}, {-21, 10}, {-21, 10},
1025            {20, 10}, {20, 10}, {20, 10}, {20, 10},
1026            {-20, 10}, {-20, 10}, {-20, 10}, {-20, 10},
1027            {19, 10}, {19, 10}, {19, 10}, {19, 10},
1028            {-19, 10}, {-19, 10}, {-19, 10}, {-19, 10},
1029            {18, 10}, {18, 10}, {18, 10}, {18, 10},
1030            {-18, 10}, {-18, 10}, {-18, 10}, {-18, 10},
1031            {17, 10}, {17, 10}, {17, 10}, {17, 10},
1032            {-17, 10}, {-17, 10}, {-17, 10}, {-17, 10},
1033            {16, 10}, {16, 10}, {16, 10}, {16, 10},
1034            {-16, 10}, {-16, 10}, {-16, 10}, {-16, 10},
1035            {15, 10}, {15, 10}, {15, 10}, {15, 10},
1036            {-15, 10}, {-15, 10}, {-15, 10}, {-15, 10},
1037            {14, 10}, {14, 10}, {14, 10}, {14, 10},
1038            {-14, 10}, {-14, 10}, {-14, 10}, {-14, 10},
1039            {13, 10}, {13, 10}, {13, 10}, {13, 10},
1040          {-13,10}, {-13,10}, {-13,10}, {-13,10}          {-13,10}, {-13,10}, {-13,10}, {-13,10}
1041  };  };
1042    
1043    
1044  VLC DCT3Dtab0[] = {  static VLC const DCT3Dtab0[] = {
1045          {4225,7}, {4209,7}, {4193,7}, {4177,7}, {193,7}, {177,7},          {4225,7}, {4209,7}, {4193,7}, {4177,7}, {193,7}, {177,7},
1046          {161,7}, {4,7}, {4161,6}, {4161,6}, {4145,6}, {4145,6},          {161,7}, {4,7}, {4161,6}, {4161,6}, {4145,6}, {4145,6},
1047          {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 1071  Line 1064 
1064  };  };
1065    
1066    
1067  VLC DCT3Dtab1[] = {  static VLC const DCT3Dtab1[] = {
1068          {9,10}, {8,10}, {4481,9}, {4481,9}, {4465,9}, {4465,9},          {9,10}, {8,10}, {4481,9}, {4481,9}, {4465,9}, {4465,9},
1069          {4449,9}, {4449,9}, {4433,9}, {4433,9}, {4417,9}, {4417,9},          {4449,9}, {4449,9}, {4433,9}, {4433,9}, {4417,9}, {4417,9},
1070          {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 1090  Line 1083 
1083          {19,8}, {19,8}, {5,8}, {5,8}, {5,8}, {5,8}          {19,8}, {19,8}, {5,8}, {5,8}, {5,8}, {5,8}
1084  };  };
1085    
1086  VLC DCT3Dtab2[] = {  static VLC const DCT3Dtab2[] = {
1087          {4114,11}, {4114,11}, {4099,11}, {4099,11}, {11,11}, {11,11},          {4114,11}, {4114,11}, {4099,11}, {4099,11}, {11,11}, {11,11},
1088          {10,11}, {10,11}, {4545,10}, {4545,10}, {4545,10}, {4545,10},          {10,11}, {10,11}, {4545,10}, {4545,10}, {4545,10}, {4545,10},
1089          {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 1117  Line 1110 
1110    
1111  /* New tables for Intra luminance blocks */  /* New tables for Intra luminance blocks */
1112    
1113  VLC DCT3Dtab3[] = {  static VLC const DCT3Dtab3[] = {
1114          {0x10401, 7}, {0x10301, 7}, {0x00601, 7}, {0x10501, 7},          {0x10401, 7}, {0x10301, 7}, {0x00601, 7}, {0x10501, 7},
1115          {0x00701, 7}, {0x00202, 7}, {0x00103, 7}, {0x00009, 7},          {0x00701, 7}, {0x00202, 7}, {0x00103, 7}, {0x00009, 7},
1116          {0x10002, 6}, {0x10002, 6}, {0x00501, 6}, {0x00501, 6},          {0x10002, 6}, {0x10002, 6}, {0x00501, 6}, {0x00501, 6},
# Line 1149  Line 1142 
1142  };  };
1143    
1144    
1145  VLC DCT3Dtab4[] = {  static VLC const DCT3Dtab4[] = {
1146          {0x00012,10}, {0x00011,10}, {0x10e01, 9}, {0x10e01, 9},          {0x00012,10}, {0x00011,10}, {0x10e01, 9}, {0x10e01, 9},
1147          {0x10d01, 9}, {0x10d01, 9}, {0x10c01, 9}, {0x10c01, 9},          {0x10d01, 9}, {0x10d01, 9}, {0x10c01, 9}, {0x10c01, 9},
1148          {0x10b01, 9}, {0x10b01, 9}, {0x10a01, 9}, {0x10a01, 9},          {0x10b01, 9}, {0x10b01, 9}, {0x10a01, 9}, {0x10a01, 9},
# Line 1176  Line 1169 
1169          {0x0000a, 8}, {0x0000a, 8}, {0x0000a, 8}, {0x0000a, 8}          {0x0000a, 8}, {0x0000a, 8}, {0x0000a, 8}, {0x0000a, 8}
1170  };  };
1171    
1172  VLC DCT3Dtab5[] = {  static VLC const DCT3Dtab5[] = {
1173          {0x10007,11}, {0x10007,11}, {0x10006,11}, {0x10006,11},          {0x10007,11}, {0x10007,11}, {0x10006,11}, {0x10006,11},
1174          {0x00016,11}, {0x00016,11}, {0x00015,11}, {0x00015,11},          {0x00016,11}, {0x00016,11}, {0x00015,11}, {0x00015,11},
1175          {0x10202,10}, {0x10202,10}, {0x10202,10}, {0x10202,10},          {0x10202,10}, {0x10202,10}, {0x10202,10}, {0x10202,10},
# Line 1209  Line 1202 
1202          {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}          {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}
1203  };  };
1204    
1205  VLC ERRtab[] = {  static short const dc_threshold[] = {
1206            26708,   29545,   25120,   28265,   29281,    8313,   29557,   29541,
1207            18208,   21838,   18208,   19536,   29472,   26223,   30580,   29281,
1208             8293,   25956,   26994,   25974,    8292,   29286,   28015,   22560,
1209            18774,    8260,   20557,   18245,    8244,   26664,   29812,   14960,
1210            12079,   30583,   11895,   30328,   25705,   28462,   26482,   29472,
1211            30063,   25458,   29541,    8233,   29505,    8299,   28518,    8306,
1212            26740,    8293,   28531,   29301,   25955,    8307,   28532,   31008,
1213            30063,    8306,   26980,   29811,   26994,   30050,   28532,    2674
1214    };
1215    
1216    
1217    static VLC const ERRtab[] = {
1218          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},
1219          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},
1220          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},
# Line 1217  Line 1222 
1222          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0}          {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0}
1223  };  };
1224    
1225  static const VLC dc_lum_tab[] = {  static VLC const dc_lum_tab[] = {
1226          {0, 0},          {0, 0}, {4, 3}, {3, 3}, {0, 3},
         {4, 3}, {3, 3}, {0, 3},  
1227          {2, 2}, {2, 2}, {1, 2}, {1, 2},          {2, 2}, {2, 2}, {1, 2}, {1, 2},
1228  };  };
1229    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.12

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