[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.6.2.3, Thu Jan 16 21:16:04 2003 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    
# Line 5  Line 61 
61  #include "mbcoding.h"  #include "mbcoding.h"
62    
63  #define VLC_ERROR       (-1)  #define VLC_ERROR       (-1)
64    #define ESCAPE 7167
65    
66  #define ESCAPE  3  /*****************************************************************************
67  #define ESCAPE1 6   * The Vector Length Coding structure
68  #define ESCAPE2 14   ****************************************************************************/
 #define ESCAPE3 15  
69    
70  typedef struct  typedef struct
71  {  {
72          uint32_t code;          uint32_t code;
73          uint8_t len;          int8_t len;
74  }  }
75  VLC;  VLC;
76    
77  typedef struct  static VLC *DCT3D[2];
 {  
         uint8_t last;  
         uint8_t run;  
         int8_t level;  
 }  
 EVENT;  
78    
 typedef struct  
 {  
         uint8_t len;  
         EVENT event;  
 }  
 REVERSE_EVENT;  
79    
80  typedef struct  /*****************************************************************************
81  {   * common tables between encoder/decoder
82          VLC vlc;   ****************************************************************************/
         EVENT event;  
 }  
 VLC_TABLE;  
83    
84    /* constants taken from momusys/vm_common/inlcude/max_level.h */
85  /******************************************************************  static char const max_level[4][64] = {
86   * common tables between encoder/decoder                          *          /* intra, last = 0 */
  ******************************************************************/  
   
 static VLC_TABLE const coeff_tab[2][102] =  
 {  
         /* intra = 0 */  
87          {          {
88                  {{ 2,  2}, {0, 0, 1}},           27, 10, 5, 4, 3, 3, 3, 3,
89                  {{15,  4}, {0, 0, 2}},           2, 2, 1, 1, 1, 1, 1, 0,
90                  {{21,  6}, {0, 0, 3}},           0, 0, 0, 0, 0, 0, 0, 0,
91                  {{23,  7}, {0, 0, 4}},           0, 0, 0, 0, 0, 0, 0, 0,
92                  {{31,  8}, {0, 0, 5}},           0, 0, 0, 0, 0, 0, 0, 0,
93                  {{37,  9}, {0, 0, 6}},           0, 0, 0, 0, 0, 0, 0, 0,
94                  {{36,  9}, {0, 0, 7}},           0, 0, 0, 0, 0, 0, 0, 0,
95                  {{33, 10}, {0, 0, 8}},           0, 0, 0, 0, 0, 0, 0, 0
                 {{32, 10}, {0, 0, 9}},  
                 {{ 7, 11}, {0, 0, 10}},  
                 {{ 6, 11}, {0, 0, 11}},  
                 {{32, 11}, {0, 0, 12}},  
                 {{ 6,  3}, {0, 1, 1}},  
                 {{20,  6}, {0, 1, 2}},  
                 {{30,  8}, {0, 1, 3}},  
                 {{15, 10}, {0, 1, 4}},  
                 {{33, 11}, {0, 1, 5}},  
                 {{80, 12}, {0, 1, 6}},  
                 {{14,  4}, {0, 2, 1}},  
                 {{29,  8}, {0, 2, 2}},  
                 {{14, 10}, {0, 2, 3}},  
                 {{81, 12}, {0, 2, 4}},  
                 {{13,  5}, {0, 3, 1}},  
                 {{35,  9}, {0, 3, 2}},  
                 {{13, 10}, {0, 3, 3}},  
                 {{12,  5}, {0, 4, 1}},  
                 {{34,  9}, {0, 4, 2}},  
                 {{82, 12}, {0, 4, 3}},  
                 {{11,  5}, {0, 5, 1}},  
                 {{12, 10}, {0, 5, 2}},  
                 {{83, 12}, {0, 5, 3}},  
                 {{19,  6}, {0, 6, 1}},  
                 {{11, 10}, {0, 6, 2}},  
                 {{84, 12}, {0, 6, 3}},  
                 {{18,  6}, {0, 7, 1}},  
                 {{10, 10}, {0, 7, 2}},  
                 {{17,  6}, {0, 8, 1}},  
                 {{ 9, 10}, {0, 8, 2}},  
                 {{16,  6}, {0, 9, 1}},  
                 {{ 8, 10}, {0, 9, 2}},  
                 {{22,  7}, {0, 10, 1}},  
                 {{85, 12}, {0, 10, 2}},  
                 {{21,  7}, {0, 11, 1}},  
                 {{20,  7}, {0, 12, 1}},  
                 {{28,  8}, {0, 13, 1}},  
                 {{27,  8}, {0, 14, 1}},  
                 {{33,  9}, {0, 15, 1}},  
                 {{32,  9}, {0, 16, 1}},  
                 {{31,  9}, {0, 17, 1}},  
                 {{30,  9}, {0, 18, 1}},  
                 {{29,  9}, {0, 19, 1}},  
                 {{28,  9}, {0, 20, 1}},  
                 {{27,  9}, {0, 21, 1}},  
                 {{26,  9}, {0, 22, 1}},  
                 {{34, 11}, {0, 23, 1}},  
                 {{35, 11}, {0, 24, 1}},  
                 {{86, 12}, {0, 25, 1}},  
                 {{87, 12}, {0, 26, 1}},  
                 {{ 7,  4}, {1, 0, 1}},  
                 {{25,  9}, {1, 0, 2}},  
                 {{ 5, 11}, {1, 0, 3}},  
                 {{15,  6}, {1, 1, 1}},  
                 {{ 4, 11}, {1, 1, 2}},  
                 {{14,  6}, {1, 2, 1}},  
                 {{13,  6}, {1, 3, 1}},  
                 {{12,  6}, {1, 4, 1}},  
                 {{19,  7}, {1, 5, 1}},  
                 {{18,  7}, {1, 6, 1}},  
                 {{17,  7}, {1, 7, 1}},  
                 {{16,  7}, {1, 8, 1}},  
                 {{26,  8}, {1, 9, 1}},  
                 {{25,  8}, {1, 10, 1}},  
                 {{24,  8}, {1, 11, 1}},  
                 {{23,  8}, {1, 12, 1}},  
                 {{22,  8}, {1, 13, 1}},  
                 {{21,  8}, {1, 14, 1}},  
                 {{20,  8}, {1, 15, 1}},  
                 {{19,  8}, {1, 16, 1}},  
                 {{24,  9}, {1, 17, 1}},  
                 {{23,  9}, {1, 18, 1}},  
                 {{22,  9}, {1, 19, 1}},  
                 {{21,  9}, {1, 20, 1}},  
                 {{20,  9}, {1, 21, 1}},  
                 {{19,  9}, {1, 22, 1}},  
                 {{18,  9}, {1, 23, 1}},  
                 {{17,  9}, {1, 24, 1}},  
                 {{ 7, 10}, {1, 25, 1}},  
                 {{ 6, 10}, {1, 26, 1}},  
                 {{ 5, 10}, {1, 27, 1}},  
                 {{ 4, 10}, {1, 28, 1}},  
                 {{36, 11}, {1, 29, 1}},  
                 {{37, 11}, {1, 30, 1}},  
                 {{38, 11}, {1, 31, 1}},  
                 {{39, 11}, {1, 32, 1}},  
                 {{88, 12}, {1, 33, 1}},  
                 {{89, 12}, {1, 34, 1}},  
                 {{90, 12}, {1, 35, 1}},  
                 {{91, 12}, {1, 36, 1}},  
                 {{92, 12}, {1, 37, 1}},  
                 {{93, 12}, {1, 38, 1}},  
                 {{94, 12}, {1, 39, 1}},  
                 {{95, 12}, {1, 40, 1}}  
96          },          },
         /* intra = 1 */  
         {  
                 {{ 2,  2}, {0, 0, 1}},  
                 {{15,  4}, {0, 0, 3}},  
                 {{21,  6}, {0, 0, 6}},  
                 {{23,  7}, {0, 0, 9}},  
                 {{31,  8}, {0, 0, 10}},  
                 {{37,  9}, {0, 0, 13}},  
                 {{36,  9}, {0, 0, 14}},  
                 {{33, 10}, {0, 0, 17}},  
                 {{32, 10}, {0, 0, 18}},  
                 {{ 7, 11}, {0, 0, 21}},  
                 {{ 6, 11}, {0, 0, 22}},  
                 {{32, 11}, {0, 0, 23}},  
                 {{ 6,  3}, {0, 0, 2}},  
                 {{20,  6}, {0, 1, 2}},  
                 {{30,  8}, {0, 0, 11}},  
                 {{15, 10}, {0, 0, 19}},  
                 {{33, 11}, {0, 0, 24}},  
                 {{80, 12}, {0, 0, 25}},  
                 {{14,  4}, {0, 1, 1}},  
                 {{29,  8}, {0, 0, 12}},  
                 {{14, 10}, {0, 0, 20}},  
                 {{81, 12}, {0, 0, 26}},  
                 {{13,  5}, {0, 0, 4}},  
                 {{35,  9}, {0, 0, 15}},  
                 {{13, 10}, {0, 1, 7}},  
                 {{12,  5}, {0, 0, 5}},  
                 {{34,  9}, {0, 4, 2}},  
                 {{82, 12}, {0, 0, 27}},  
                 {{11,  5}, {0, 2, 1}},  
                 {{12, 10}, {0, 2, 4}},  
                 {{83, 12}, {0, 1, 9}},  
                 {{19,  6}, {0, 0, 7}},  
                 {{11, 10}, {0, 3, 4}},  
                 {{84, 12}, {0, 6, 3}},  
                 {{18,  6}, {0, 0, 8}},  
                 {{10, 10}, {0, 4, 3}},  
                 {{17,  6}, {0, 3, 1}},  
                 {{ 9, 10}, {0, 8, 2}},  
                 {{16,  6}, {0, 4, 1}},  
                 {{ 8, 10}, {0, 5, 3}},  
                 {{22,  7}, {0, 1, 3}},  
                 {{85, 12}, {0, 1, 10}},  
                 {{21,  7}, {0, 2, 2}},  
                 {{20,  7}, {0, 7, 1}},  
                 {{28,  8}, {0, 1, 4}},  
                 {{27,  8}, {0, 3, 2}},  
                 {{33,  9}, {0, 0, 16}},  
                 {{32,  9}, {0, 1, 5}},  
                 {{31,  9}, {0, 1, 6}},  
                 {{30,  9}, {0, 2, 3}},  
                 {{29,  9}, {0, 3, 3}},  
                 {{28,  9}, {0, 5, 2}},  
                 {{27,  9}, {0, 6, 2}},  
                 {{26,  9}, {0, 7, 2}},  
                 {{34, 11}, {0, 1, 8}},  
                 {{35, 11}, {0, 9, 2}},  
                 {{86, 12}, {0, 2, 5}},  
                 {{87, 12}, {0, 7, 3}},  
                 {{ 7,  4}, {1, 0, 1}},  
                 {{25,  9}, {0, 11, 1}},  
                 {{ 5, 11}, {1, 0, 6}},  
                 {{15,  6}, {1, 1, 1}},  
                 {{ 4, 11}, {1, 0, 7}},  
                 {{14,  6}, {1, 2, 1}},  
                 {{13,  6}, {0, 5, 1}},  
                 {{12,  6}, {1, 0, 2}},  
                 {{19,  7}, {1, 5, 1}},  
                 {{18,  7}, {0, 6, 1}},  
                 {{17,  7}, {1, 3, 1}},  
                 {{16,  7}, {1, 4, 1}},  
                 {{26,  8}, {1, 9, 1}},  
                 {{25,  8}, {0, 8, 1}},  
                 {{24,  8}, {0, 9, 1}},  
                 {{23,  8}, {0, 10, 1}},  
                 {{22,  8}, {1, 0, 3}},  
                 {{21,  8}, {1, 6, 1}},  
                 {{20,  8}, {1, 7, 1}},  
                 {{19,  8}, {1, 8, 1}},  
                 {{24,  9}, {0, 12, 1}},  
                 {{23,  9}, {1, 0, 4}},  
                 {{22,  9}, {1, 1, 2}},  
                 {{21,  9}, {1, 10, 1}},  
                 {{20,  9}, {1, 11, 1}},  
                 {{19,  9}, {1, 12, 1}},  
                 {{18,  9}, {1, 13, 1}},  
                 {{17,  9}, {1, 14, 1}},  
                 {{ 7, 10}, {0, 13, 1}},  
                 {{ 6, 10}, {1, 0, 5}},  
                 {{ 5, 10}, {1, 1, 3}},  
                 {{ 4, 10}, {1, 2, 2}},  
                 {{36, 11}, {1, 3, 2}},  
                 {{37, 11}, {1, 4, 2}},  
                 {{38, 11}, {1, 15, 1}},  
                 {{39, 11}, {1, 16, 1}},  
                 {{88, 12}, {0, 14, 1}},  
                 {{89, 12}, {1, 0, 8}},  
                 {{90, 12}, {1, 5, 2}},  
                 {{91, 12}, {1, 6, 2}},  
                 {{92, 12}, {1, 17, 1}},  
                 {{93, 12}, {1, 18, 1}},  
                 {{94, 12}, {1, 19, 1}},  
                 {{95, 12}, {1, 20, 1}}  
         }  
 };  
97    
98  /* constants taken from momusys/vm_common/inlcude/max_level.h */          /* intra, last = 1 */
 static uint8_t const max_level[2][2][64] = {  
99          {          {
100                  /* intra = 0, last = 0 */           8, 3, 2, 2, 2, 2, 2, 1,
101             1, 1, 1, 1, 1, 1, 1, 1,
102             1, 1, 1, 1, 1, 0, 0, 0,
103             0, 0, 0, 0, 0, 0, 0, 0,
104             0, 0, 0, 0, 0, 0, 0, 0,
105             0, 0, 0, 0, 0, 0, 0, 0,
106             0, 0, 0, 0, 0, 0, 0, 0,
107             0, 0, 0, 0, 0, 0, 0, 0
108             },
109    
110            /* 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,
# Line 273  Line 118 
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                  /* intra = 0, last = 1 */  
122            /* 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,
# Line 284  Line 130 
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                  /* intra = 1, last = 0 */  static char const max_run[4][256] = {
136            /* intra, last = 0 */
137                  {                  {
138                          27, 10, 5, 4, 3, 3, 3, 3,           0, 14, 9, 7, 3, 2, 1, 1,
139                          2, 2, 1, 1, 1, 1, 1, 0,           1, 1, 1, 0, 0, 0, 0, 0,
140             0, 0, 0, 0, 0, 0, 0, 0,
141             0, 0, 0, 0, 0, 0, 0, 0,
142             0, 0, 0, 0, 0, 0, 0, 0,
143             0, 0, 0, 0, 0, 0, 0, 0,
144             0, 0, 0, 0, 0, 0, 0, 0,
145             0, 0, 0, 0, 0, 0, 0, 0,
146             0, 0, 0, 0, 0, 0, 0, 0,
147             0, 0, 0, 0, 0, 0, 0, 0,
148             0, 0, 0, 0, 0, 0, 0, 0,
149             0, 0, 0, 0, 0, 0, 0, 0,
150             0, 0, 0, 0, 0, 0, 0, 0,
151             0, 0, 0, 0, 0, 0, 0, 0,
152             0, 0, 0, 0, 0, 0, 0, 0,
153             0, 0, 0, 0, 0, 0, 0, 0,
154             0, 0, 0, 0, 0, 0, 0, 0,
155             0, 0, 0, 0, 0, 0, 0, 0,
156             0, 0, 0, 0, 0, 0, 0, 0,
157             0, 0, 0, 0, 0, 0, 0, 0,
158             0, 0, 0, 0, 0, 0, 0, 0,
159             0, 0, 0, 0, 0, 0, 0, 0,
160             0, 0, 0, 0, 0, 0, 0, 0,
161             0, 0, 0, 0, 0, 0, 0, 0,
162             0, 0, 0, 0, 0, 0, 0, 0,
163             0, 0, 0, 0, 0, 0, 0, 0,
164                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
165                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
166                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
# Line 297  Line 168 
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                  /* intra = 1, last = 1 */  
172            /* intra, last = 1 */
173                  {                  {
174                          8, 3, 2, 2, 2, 2, 2, 1,           0, 20, 6, 1, 0, 0, 0, 0,
175                          1, 1, 1, 1, 1, 1, 1, 1,           0, 0, 0, 0, 0, 0, 0, 0,
176                          1, 1, 1, 1, 1, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
177             0, 0, 0, 0, 0, 0, 0, 0,
178             0, 0, 0, 0, 0, 0, 0, 0,
179             0, 0, 0, 0, 0, 0, 0, 0,
180             0, 0, 0, 0, 0, 0, 0, 0,
181             0, 0, 0, 0, 0, 0, 0, 0,
182             0, 0, 0, 0, 0, 0, 0, 0,
183             0, 0, 0, 0, 0, 0, 0, 0,
184             0, 0, 0, 0, 0, 0, 0, 0,
185             0, 0, 0, 0, 0, 0, 0, 0,
186             0, 0, 0, 0, 0, 0, 0, 0,
187             0, 0, 0, 0, 0, 0, 0, 0,
188             0, 0, 0, 0, 0, 0, 0, 0,
189             0, 0, 0, 0, 0, 0, 0, 0,
190             0, 0, 0, 0, 0, 0, 0, 0,
191             0, 0, 0, 0, 0, 0, 0, 0,
192             0, 0, 0, 0, 0, 0, 0, 0,
193             0, 0, 0, 0, 0, 0, 0, 0,
194             0, 0, 0, 0, 0, 0, 0, 0,
195             0, 0, 0, 0, 0, 0, 0, 0,
196             0, 0, 0, 0, 0, 0, 0, 0,
197             0, 0, 0, 0, 0, 0, 0, 0,
198             0, 0, 0, 0, 0, 0, 0, 0,
199             0, 0, 0, 0, 0, 0, 0, 0,
200             0, 0, 0, 0, 0, 0, 0, 0,
201                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
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  static uint8_t const max_run[2][2][64] = {          /* inter, last = 0 */
         {  
                 /* intra = 0, 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,
# Line 323  Line 215 
215                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
216                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
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,
219             0, 0, 0, 0, 0, 0, 0, 0,
220             0, 0, 0, 0, 0, 0, 0, 0,
221             0, 0, 0, 0, 0, 0, 0, 0,
222             0, 0, 0, 0, 0, 0, 0, 0,
223             0, 0, 0, 0, 0, 0, 0, 0,
224             0, 0, 0, 0, 0, 0, 0, 0,
225             0, 0, 0, 0, 0, 0, 0, 0,
226             0, 0, 0, 0, 0, 0, 0, 0,
227             0, 0, 0, 0, 0, 0, 0, 0,
228             0, 0, 0, 0, 0, 0, 0, 0,
229             0, 0, 0, 0, 0, 0, 0, 0,
230             0, 0, 0, 0, 0, 0, 0, 0,
231             0, 0, 0, 0, 0, 0, 0, 0,
232             0, 0, 0, 0, 0, 0, 0, 0,
233             0, 0, 0, 0, 0, 0, 0, 0,
234             0, 0, 0, 0, 0, 0, 0, 0,
235             0, 0, 0, 0, 0, 0, 0, 0,
236             0, 0, 0, 0, 0, 0, 0, 0,
237             0, 0, 0, 0, 0, 0, 0, 0,
238             0, 0, 0, 0, 0, 0, 0, 0,
239             0, 0, 0, 0, 0, 0, 0, 0,
240             0, 0, 0, 0, 0, 0, 0, 0,
241             0, 0, 0, 0, 0, 0, 0, 0
242                  },                  },
243                  /* intra = 0, last = 1 */  
244            /* 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,
# Line 334  Line 251 
251                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
252                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
253                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
                 }  
         },  
         {  
                 /* intra = 1, last = 0 */  
                 {  
                         0, 14, 9, 7, 3, 2, 1, 1,  
                         1, 1, 1, 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                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
258                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
259                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
                 },  
                 /* intra = 1, last = 1 */  
                 {  
                         0, 20, 6, 1, 0, 0, 0, 0,  
260                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
261                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
262                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
# Line 358  Line 264 
264                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
265                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
266                          0, 0, 0, 0, 0, 0, 0, 0,                          0, 0, 0, 0, 0, 0, 0, 0,
267                  }           0, 0, 0, 0, 0, 0, 0, 0,
268             0, 0, 0, 0, 0, 0, 0, 0,
269             0, 0, 0, 0, 0, 0, 0, 0,
270             0, 0, 0, 0, 0, 0, 0, 0,
271             0, 0, 0, 0, 0, 0, 0, 0,
272             0, 0, 0, 0, 0, 0, 0, 0,
273             0, 0, 0, 0, 0, 0, 0, 0,
274             0, 0, 0, 0, 0, 0, 0, 0,
275             0, 0, 0, 0, 0, 0, 0, 0,
276             0, 0, 0, 0, 0, 0, 0, 0,
277             0, 0, 0, 0, 0, 0, 0, 0
278          }          }
279  };  };
280    
281    
282  /******************************************************************  /******************************************************************
283   * encoder tables                                                 *   * encoder tables                                                 *
284   ******************************************************************/   ******************************************************************/
285    
286  static VLC sprite_trajectory_code[32768];  /* DCT coefficients. Four tables, two for last = 0, two for last = 1.
287       the sign bit must be added afterwards. */
288    
289  static VLC sprite_trajectory_len[15] = {  /* first part of coeffs for last = 0. Indexed by [run][level-1] */
         { 0x00 , 2},  
         { 0x02 , 3}, { 0x03, 3}, { 0x04, 3}, { 0x05, 3}, { 0x06, 3},  
         { 0x0E , 4}, { 0x1E, 5}, { 0x3E, 6}, { 0x7F, 7}, { 0xFE, 8},  
         { 0x1FE, 9}, {0x3FE,10}, {0x7FE,11}, {0xFFE,12} };  
290    
291    static VLC const coeff_tab0[2][12] = {
292            /* run = 0  */
293            {
294                    {0x02, 2},  {0x0f, 4},  {0x15, 6},  {0x17, 7},
295                    {0x1f, 8},  {0x25, 9},  {0x24, 9},  {0x21, 10},
296                    {0x20, 10}, {0x07, 11}, {0x06, 11}, {0x20, 11}
297            },
298    
299  /* DCT coefficients. Four tables, two for last = 0, two for last = 1.          /* run = 1 */
300     the sign bit must be added afterwards. */          {
301                    {0x06, 3},  {0x14, 6},  {0x1e, 8}, {0x0f, 10},
302                    {0x21, 11}, {0x50, 12}, {0x00, 0}, {0x00, 0},
303                    {0x00, 0},  {0x00, 0},  {0x00, 0}, {0x00, 0}
304            }
305    };
306    
307    /* rest of coeffs for last = 0. indexing by [run-2][level-1] */
308    
309    static VLC const coeff_tab1[25][4] = {
310            /* First row is run=2, then each row is run 2 + index */
311            {{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            {{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            {{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            {{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            {{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            {{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            {{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            {{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            {{0x57, 12}, {0x00, 0}, {0x00, 0},  {0x00, 0}}
336    
337    };
338    
339    /* first coeffs of last = 1. indexing by [run][level-1] */
340    
341    static VLC const coeff_tab2[2][3] = {
342            /*  run = 0 */
343            {{0x07, 4}, {0x19, 9},  {0x05, 11}},
344            /* run = 1 */
345            {{0x0f, 6}, {0x04, 11}, {0x00, 0}}
346    };
347    
348    /* rest of coeffs for last = 1. indexing by [run-2] */
349    
350    static VLC const coeff_tab3[40][1] = {
351            {{0x0e, 6}},  {{0x0d, 6}},  {{0x0c, 6}},  {{0x13, 7}},
352            {{0x12, 7}},  {{0x11, 7}},  {{0x10, 7}},  {{0x1a, 8}},
353            {{0x19, 8}},  {{0x18, 8}},  {{0x17, 8}},  {{0x16, 8}},
354            {{0x15, 8}},  {{0x14, 8}},  {{0x13, 8}},  {{0x18, 9}},
355            {{0x17, 9}},  {{0x16, 9}},  {{0x15, 9}},  {{0x14, 9}},
356            {{0x13, 9}},  {{0x12, 9}},  {{0x11, 9}},  {{0x07, 10}},
357            {{0x06, 10}}, {{0x05, 10}}, {{0x04, 10}}, {{0x24, 11}},
358            {{0x25, 11}}, {{0x26, 11}}, {{0x27, 11}}, {{0x58, 12}},
359            {{0x59, 12}}, {{0x5a, 12}}, {{0x5b, 12}}, {{0x5c, 12}},
360            {{0x5d, 12}}, {{0x5e, 12}}, {{0x5f, 12}}, {{0x00, 0}}
361    };
362    
363    /*
364     * New tables for Intra luminance coefficients. Same codewords,
365     * different meaning
366     */
367    
368    /* Coeffs for last = 0, run = 0. Indexed by [level-1] */
369    
370    static VLC const coeff_tab4[27] = {
371            /* run = 0 */
372            {0x02, 2},  {0x06, 3},  {0x0f, 4},
373            {0x0d, 5},  {0x0c, 5},  {0x15, 6},
374            {0x13, 6},  {0x12, 6},  {0x17, 7},
375            {0x1f, 8},  {0x1e, 8},  {0x1d, 8},
376            {0x25, 9},  {0x24, 9},  {0x23, 9},
377            {0x21, 9},  {0x21, 10}, {0x20, 10},
378            {0x0f, 10}, {0x0e, 10}, {0x07, 11},
379            {0x06, 11}, {0x20, 11}, {0x21, 11},
380            {0x50, 12}, {0x51, 12}, {0x52, 12}
381    };
382    
383    /* Coeffs for last = 0, run = 1. Indexed by [level-1] */
384    
385    static VLC const coeff_tab5[10] = {
386            {0x0e, 4}, {0x14, 6},  {0x16, 7},  {0x1c, 8},  {0x20, 9},
387            {0x1f, 9}, {0x0d, 10}, {0x22, 11}, {0x53, 12}, {0x55, 12}
388    };
389    
390    /* Coeffs for last = 0, run = 2 -> 9. Indexed by [run-2][level-1] */
391    
392  /* MCBPC Indexing by cbpc in first two bits, mode in last two.  static VLC coeff_tab6[8][5] = {
393   CBPC as in table 4/H.263, MB type (mode): 3 = 01, 4 = 10.          /* run = 2 */
394   Example: cbpc = 01 and mode = 4 gives index = 0110 = 6. */          {{0x0b, 5}, {0x15, 7}, {0x1e, 9}, {0x0c, 10}, {0x56, 12}},
395    
396  static VLC mcbpc_intra_tab[15] = {          /* run = 3 */
397            {{0x11, 6}, {0x1b, 8}, {0x1d, 9}, {0x0b, 10}, {0x00, 0}},
398    
399            /* run = 4 */
400            {{0x10, 6}, {0x22, 9}, {0x0a, 10}, {0x00, 0}, {0x00, 0}},
401    
402            /* run = 5 */
403            {{0x0d, 6}, {0x1c, 9}, {0x08, 10}, {0x00, 0}, {0x00, 0}},
404    
405            /* run = 6 */
406            {{0x12, 7}, {0x1b, 9}, {0x54, 12}, {0x00, 0}, {0x00, 0}},
407    
408            /* run = 7 */
409            {{0x14, 7}, {0x1a, 9}, {0x57, 12}, {0x00, 0}, {0x00, 0}},
410    
411            /* run = 8 */
412            {{0x19, 8}, {0x09, 10}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
413    
414            /* run = 9 */
415            {{0x18, 8}, {0x23, 11}, {0x00, 0}, {0x00, 0}, {0x00, 0}}
416    };
417    
418    /* Coeffs for last = 0, run = 10 -> 14. Indexed by [run-10] */
419    
420    static VLC const coeff_tab7[5][1] = {
421            {{0x17, 8}},
422            {{0x19, 9}},
423            {{0x18, 9}},
424            {{0x07, 10}},
425            {{0x58, 12}}
426    };
427    
428    /* Coeffs for last = 1, run = 0. Indexed by [level-1] */
429    
430    static VLC const coeff_tab8[8] = {
431            {0x07, 4},  {0x0c, 6},  {0x16, 8},  {0x17, 9},
432            {0x06, 10}, {0x05, 11}, {0x04, 11}, {0x59, 12}
433    };
434    
435    /* Coeffs for last = 1, run = 1 -> 6. Indexed by [run-1][level-1] */
436    
437    static VLC const coeff_tab9[6][3] = {
438            /* run = 1 */
439            {{0x0f, 6}, {0x16, 9}, {0x05, 10}},
440    
441            /* run = 2 */
442            {{0x0e, 6}, {0x04, 10}, {0x00, 0}},
443    
444            /* run = 3 */
445            {{0x11, 7}, {0x24, 11}, {0x00, 0}},
446    
447            /* run = 4 */
448            {{0x10, 7}, {0x25, 11}, {0x00, 0}},
449    
450            /* run = 5 */
451            {{0x13, 7}, {0x5a, 12}, {0x00, 0}},
452    
453            /* run = 6 */
454            {{0x15, 8}, {0x5b, 12}, {0x00, 0}}
455    };
456    
457    /* Coeffs for last = 1, run = 7 -> 20. Indexed by [run-7] */
458    
459    static VLC const coeff_tab10[14][1] = {
460            {{0x14, 8}},
461            {{0x13, 8}},
462            {{0x1a, 8}},
463            {{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 const *coeff_intra_last0[15] = {
478            coeff_tab4,
479            coeff_tab5,
480            coeff_tab6[0],
481            coeff_tab6[1],
482            coeff_tab6[2],
483            coeff_tab6[3],
484            coeff_tab6[4],
485            coeff_tab6[5],
486            coeff_tab6[6],
487            coeff_tab6[7],
488            coeff_tab7[0],
489            coeff_tab7[1],
490            coeff_tab7[2],
491            coeff_tab7[3],
492            coeff_tab7[4]
493    };
494    
495    static VLC const *coeff_intra_last1[21] = {
496            coeff_tab8,
497            coeff_tab9[0],
498            coeff_tab9[1],
499            coeff_tab9[2],
500            coeff_tab9[3],
501            coeff_tab9[4],
502            coeff_tab9[5],
503            coeff_tab10[0],
504            coeff_tab10[1],
505            coeff_tab10[2],
506            coeff_tab10[3],
507            coeff_tab10[4],
508            coeff_tab10[5],
509            coeff_tab10[6],
510            coeff_tab10[7],
511            coeff_tab10[8],
512            coeff_tab10[9],
513            coeff_tab10[10],
514            coeff_tab10[11],
515            coeff_tab10[12],
516            coeff_tab10[13],
517    };
518    
519    static VLC const *coeff_inter_last0[27] = {
520            coeff_tab0[0],
521            coeff_tab0[1],
522            coeff_tab1[0],
523            coeff_tab1[1],
524            coeff_tab1[2],
525            coeff_tab1[3],
526            coeff_tab1[4],
527            coeff_tab1[5],
528            coeff_tab1[6],
529            coeff_tab1[7],
530            coeff_tab1[8],
531            coeff_tab1[9],
532            coeff_tab1[10],
533            coeff_tab1[11],
534            coeff_tab1[12],
535            coeff_tab1[13],
536            coeff_tab1[14],
537            coeff_tab1[15],
538            coeff_tab1[16],
539            coeff_tab1[17],
540            coeff_tab1[18],
541            coeff_tab1[19],
542            coeff_tab1[20],
543            coeff_tab1[21],
544            coeff_tab1[22],
545            coeff_tab1[23],
546            coeff_tab1[24],
547    };
548    
549    static VLC const *coeff_inter_last1[42] = {
550            coeff_tab2[0],
551            coeff_tab2[1],
552            coeff_tab3[0],
553            coeff_tab3[1],
554            coeff_tab3[2],
555            coeff_tab3[3],
556            coeff_tab3[4],
557            coeff_tab3[5],
558            coeff_tab3[6],
559            coeff_tab3[7],
560            coeff_tab3[8],
561            coeff_tab3[9],
562            coeff_tab3[10],
563            coeff_tab3[11],
564            coeff_tab3[12],
565            coeff_tab3[13],
566            coeff_tab3[14],
567            coeff_tab3[15],
568            coeff_tab3[16],
569            coeff_tab3[17],
570            coeff_tab3[18],
571            coeff_tab3[19],
572            coeff_tab3[20],
573            coeff_tab3[21],
574            coeff_tab3[22],
575            coeff_tab3[23],
576            coeff_tab3[24],
577            coeff_tab3[25],
578            coeff_tab3[26],
579            coeff_tab3[27],
580            coeff_tab3[28],
581            coeff_tab3[29],
582            coeff_tab3[30],
583            coeff_tab3[31],
584            coeff_tab3[32],
585            coeff_tab3[33],
586            coeff_tab3[34],
587            coeff_tab3[35],
588            coeff_tab3[36],
589            coeff_tab3[37],
590            coeff_tab3[38],
591            coeff_tab3[39],
592    };
593    
594    static VLC const **coeff_vlc[4] = {
595            coeff_intra_last0,
596            coeff_intra_last1,
597            coeff_inter_last0,
598            coeff_inter_last1,
599    };
600    
601    /*
602     * MCBPC Indexing by cbpc in first two bits, mode in last two.
603     * 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 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 392  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 535  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 667  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 703  Line 925 
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}
926  };  };
927    
928    
929  static VLC const mcbpc_inter_table[257] = {  static VLC const mcbpc_inter_table[257] = {
930          {VLC_ERROR, 0}, {255, 9}, {52, 9}, {36, 9}, {20, 9}, {49, 9}, {35, 8}, {35, 8},          {VLC_ERROR, 0}, {255, 9}, {52, 9}, {36, 9}, {20, 9}, {49, 9}, {35, 8}, {35, 8},
931          {19, 8}, {19, 8}, {50, 8}, {50, 8}, {51, 7}, {51, 7}, {51, 7}, {51, 7},          {19, 8}, {19, 8}, {50, 8}, {50, 8}, {51, 7}, {51, 7}, {51, 7}, {51, 7},
# Line 750  Line 973 
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}
974  };  };
975    
976    
977  static VLC const TMNMVtab0[] = {  static VLC const TMNMVtab0[] = {
978          {3, 4}, {-3, 4}, {2, 3}, {2, 3}, {-2, 3}, {-2, 3}, {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}, {-1, 2}, {-1, 2}, {-1, 2}
# Line 816  Line 1040 
1040          {-13, 10}, {-13, 10}, {-13, 10}, {-13, 10}          {-13, 10}, {-13, 10}, {-13, 10}, {-13, 10}
1041  };  };
1042    
1043    
1044    static VLC const DCT3Dtab0[] = {
1045            {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},
1047            {4129, 6}, {4129, 6}, {4113, 6}, {4113, 6}, {145, 6}, {145, 6},
1048            {129, 6}, {129, 6}, {113, 6}, {113, 6}, {97, 6}, {97, 6},
1049            {18, 6}, {18, 6}, {3, 6}, {3, 6}, {81, 5}, {81, 5},
1050            {81, 5}, {81, 5}, {65, 5}, {65, 5}, {65, 5}, {65, 5},
1051            {49, 5}, {49, 5}, {49, 5}, {49, 5}, {4097, 4}, {4097, 4},
1052            {4097, 4}, {4097, 4}, {4097, 4}, {4097, 4}, {4097, 4}, {4097, 4},
1053            {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
1054            {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
1055            {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
1056            {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
1057            {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
1058            {1, 2}, {1, 2}, {17, 3}, {17, 3}, {17, 3}, {17, 3},
1059            {17, 3}, {17, 3}, {17, 3}, {17, 3}, {17, 3}, {17, 3},
1060            {17, 3}, {17, 3}, {17, 3}, {17, 3}, {17, 3}, {17, 3},
1061            {33, 4}, {33, 4}, {33, 4}, {33, 4}, {33, 4}, {33, 4},
1062            {33, 4}, {33, 4}, {2, 4}, {2, 4}, {2, 4}, {2, 4},
1063            {2, 4}, {2, 4}, {2, 4}, {2, 4}
1064    };
1065    
1066    
1067    static VLC const DCT3Dtab1[] = {
1068            {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},
1070            {4401, 9}, {4401, 9}, {4385, 9}, {4385, 9}, {4369, 9}, {4369, 9},
1071            {4098, 9}, {4098, 9}, {353, 9}, {353, 9}, {337, 9}, {337, 9},
1072            {321, 9}, {321, 9}, {305, 9}, {305, 9}, {289, 9}, {289, 9},
1073            {273, 9}, {273, 9}, {257, 9}, {257, 9}, {241, 9}, {241, 9},
1074            {66, 9}, {66, 9}, {50, 9}, {50, 9}, {7, 9}, {7, 9},
1075            {6, 9}, {6, 9}, {4353, 8}, {4353, 8}, {4353, 8}, {4353, 8},
1076            {4337, 8}, {4337, 8}, {4337, 8}, {4337, 8}, {4321, 8}, {4321, 8},
1077            {4321, 8}, {4321, 8}, {4305, 8}, {4305, 8}, {4305, 8}, {4305, 8},
1078            {4289, 8}, {4289, 8}, {4289, 8}, {4289, 8}, {4273, 8}, {4273, 8},
1079            {4273, 8}, {4273, 8}, {4257, 8}, {4257, 8}, {4257, 8}, {4257, 8},
1080            {4241, 8}, {4241, 8}, {4241, 8}, {4241, 8}, {225, 8}, {225, 8},
1081            {225, 8}, {225, 8}, {209, 8}, {209, 8}, {209, 8}, {209, 8},
1082            {34, 8}, {34, 8}, {34, 8}, {34, 8}, {19, 8}, {19, 8},
1083            {19, 8}, {19, 8}, {5, 8}, {5, 8}, {5, 8}, {5, 8}
1084    };
1085    
1086    static VLC const DCT3Dtab2[] = {
1087            {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},
1089            {4529, 10}, {4529, 10}, {4529, 10}, {4529, 10}, {4513, 10}, {4513, 10},
1090            {4513, 10}, {4513, 10}, {4497, 10}, {4497, 10}, {4497, 10}, {4497, 10},
1091            {146, 10}, {146, 10}, {146, 10}, {146, 10}, {130, 10}, {130, 10},
1092            {130, 10}, {130, 10}, {114, 10}, {114, 10}, {114, 10}, {114, 10},
1093            {98, 10}, {98, 10}, {98, 10}, {98, 10}, {82, 10}, {82, 10},
1094            {82, 10}, {82, 10}, {51, 10}, {51, 10}, {51, 10}, {51, 10},
1095            {35, 10}, {35, 10}, {35, 10}, {35, 10}, {20, 10}, {20, 10},
1096            {20, 10}, {20, 10}, {12, 11}, {12, 11}, {21, 11}, {21, 11},
1097            {369, 11}, {369, 11}, {385, 11}, {385, 11}, {4561, 11}, {4561, 11},
1098            {4577, 11}, {4577, 11}, {4593, 11}, {4593, 11}, {4609, 11}, {4609, 11},
1099            {22, 12}, {36, 12}, {67, 12}, {83, 12}, {99, 12}, {162, 12},
1100            {401, 12}, {417, 12}, {4625, 12}, {4641, 12}, {4657, 12}, {4673, 12},
1101            {4689, 12}, {4705, 12}, {4721, 12}, {4737, 12}, {7167, 7},
1102            {7167, 7}, {7167, 7}, {7167, 7}, {7167, 7}, {7167, 7}, {7167, 7},
1103            {7167, 7}, {7167, 7}, {7167, 7}, {7167, 7}, {7167, 7}, {7167, 7},
1104            {7167, 7}, {7167, 7}, {7167, 7}, {7167, 7}, {7167, 7}, {7167, 7},
1105            {7167, 7}, {7167, 7}, {7167, 7}, {7167, 7}, {7167, 7}, {7167, 7},
1106            {7167, 7}, {7167, 7}, {7167, 7}, {7167, 7}, {7167, 7}, {7167, 7},
1107            {7167, 7}
1108    };
1109    
1110    
1111    /* New tables for Intra luminance blocks */
1112    
1113    static VLC const DCT3Dtab3[] = {
1114            {0x10401, 7}, {0x10301, 7}, {0x00601, 7}, {0x10501, 7},
1115            {0x00701, 7}, {0x00202, 7}, {0x00103, 7}, {0x00009, 7},
1116            {0x10002, 6}, {0x10002, 6}, {0x00501, 6}, {0x00501, 6},
1117            {0x10201, 6}, {0x10201, 6}, {0x10101, 6}, {0x10101, 6},
1118            {0x00401, 6}, {0x00401, 6}, {0x00301, 6}, {0x00301, 6},
1119            {0x00008, 6}, {0x00008, 6}, {0x00007, 6}, {0x00007, 6},
1120            {0x00102, 6}, {0x00102, 6}, {0x00006, 6}, {0x00006, 6},
1121            {0x00201, 5}, {0x00201, 5}, {0x00201, 5}, {0x00201, 5},
1122            {0x00005, 5}, {0x00005, 5}, {0x00005, 5}, {0x00005, 5},
1123            {0x00004, 5}, {0x00004, 5}, {0x00004, 5}, {0x00004, 5},
1124            {0x10001, 4}, {0x10001, 4}, {0x10001, 4}, {0x10001, 4},
1125            {0x10001, 4}, {0x10001, 4}, {0x10001, 4}, {0x10001, 4},
1126            {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},
1127            {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},
1128            {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},
1129            {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},
1130            {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},
1131            {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},
1132            {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},
1133            {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},
1134            {0x00002, 3}, {0x00002, 3}, {0x00002, 3}, {0x00002, 3},
1135            {0x00002, 3}, {0x00002, 3}, {0x00002, 3}, {0x00002, 3},
1136            {0x00002, 3}, {0x00002, 3}, {0x00002, 3}, {0x00002, 3},
1137            {0x00002, 3}, {0x00002, 3}, {0x00002, 3}, {0x00002, 3},
1138            {0x00101, 4}, {0x00101, 4}, {0x00101, 4}, {0x00101, 4},
1139            {0x00101, 4}, {0x00101, 4}, {0x00101, 4}, {0x00101, 4},
1140            {0x00003, 4}, {0x00003, 4}, {0x00003, 4}, {0x00003, 4},
1141            {0x00003, 4}, {0x00003, 4}, {0x00003, 4}, {0x00003, 4}
1142    };
1143    
1144    
1145    static VLC const DCT3Dtab4[] = {
1146            {0x00012, 10}, {0x00011, 10}, {0x10e01, 9}, {0x10e01, 9},
1147            {0x10d01, 9}, {0x10d01, 9}, {0x10c01, 9}, {0x10c01, 9},
1148            {0x10b01, 9}, {0x10b01, 9}, {0x10a01, 9}, {0x10a01, 9},
1149            {0x10102, 9}, {0x10102, 9}, {0x10004, 9}, {0x10004, 9},
1150            {0x00c01, 9}, {0x00c01, 9}, {0x00b01, 9}, {0x00b01, 9},
1151            {0x00702, 9}, {0x00702, 9}, {0x00602, 9}, {0x00602, 9},
1152            {0x00502, 9}, {0x00502, 9}, {0x00303, 9}, {0x00303, 9},
1153            {0x00203, 9}, {0x00203, 9}, {0x00106, 9}, {0x00106, 9},
1154            {0x00105, 9}, {0x00105, 9}, {0x00010, 9}, {0x00010, 9},
1155            {0x00402, 9}, {0x00402, 9}, {0x0000f, 9}, {0x0000f, 9},
1156            {0x0000e, 9}, {0x0000e, 9}, {0x0000d, 9}, {0x0000d, 9},
1157            {0x10801, 8}, {0x10801, 8}, {0x10801, 8}, {0x10801, 8},
1158            {0x10701, 8}, {0x10701, 8}, {0x10701, 8}, {0x10701, 8},
1159            {0x10601, 8}, {0x10601, 8}, {0x10601, 8}, {0x10601, 8},
1160            {0x10003, 8}, {0x10003, 8}, {0x10003, 8}, {0x10003, 8},
1161            {0x00a01, 8}, {0x00a01, 8}, {0x00a01, 8}, {0x00a01, 8},
1162            {0x00901, 8}, {0x00901, 8}, {0x00901, 8}, {0x00901, 8},
1163            {0x00801, 8}, {0x00801, 8}, {0x00801, 8}, {0x00801, 8},
1164            {0x10901, 8}, {0x10901, 8}, {0x10901, 8}, {0x10901, 8},
1165            {0x00302, 8}, {0x00302, 8}, {0x00302, 8}, {0x00302, 8},
1166            {0x00104, 8}, {0x00104, 8}, {0x00104, 8}, {0x00104, 8},
1167            {0x0000c, 8}, {0x0000c, 8}, {0x0000c, 8}, {0x0000c, 8},
1168            {0x0000b, 8}, {0x0000b, 8}, {0x0000b, 8}, {0x0000b, 8},
1169            {0x0000a, 8}, {0x0000a, 8}, {0x0000a, 8}, {0x0000a, 8}
1170    };
1171    
1172    static VLC const DCT3Dtab5[] = {
1173            {0x10007, 11}, {0x10007, 11}, {0x10006, 11}, {0x10006, 11},
1174            {0x00016, 11}, {0x00016, 11}, {0x00015, 11}, {0x00015, 11},
1175            {0x10202, 10}, {0x10202, 10}, {0x10202, 10}, {0x10202, 10},
1176            {0x10103, 10}, {0x10103, 10}, {0x10103, 10}, {0x10103, 10},
1177            {0x10005, 10}, {0x10005, 10}, {0x10005, 10}, {0x10005, 10},
1178            {0x00d01, 10}, {0x00d01, 10}, {0x00d01, 10}, {0x00d01, 10},
1179            {0x00503, 10}, {0x00503, 10}, {0x00503, 10}, {0x00503, 10},
1180            {0x00802, 10}, {0x00802, 10}, {0x00802, 10}, {0x00802, 10},
1181            {0x00403, 10}, {0x00403, 10}, {0x00403, 10}, {0x00403, 10},
1182            {0x00304, 10}, {0x00304, 10}, {0x00304, 10}, {0x00304, 10},
1183            {0x00204, 10}, {0x00204, 10}, {0x00204, 10}, {0x00204, 10},
1184            {0x00107, 10}, {0x00107, 10}, {0x00107, 10}, {0x00107, 10},
1185            {0x00014, 10}, {0x00014, 10}, {0x00014, 10}, {0x00014, 10},
1186            {0x00013, 10}, {0x00013, 10}, {0x00013, 10}, {0x00013, 10},
1187            {0x00017, 11}, {0x00017, 11}, {0x00018, 11}, {0x00018, 11},
1188            {0x00108, 11}, {0x00108, 11}, {0x00902, 11}, {0x00902, 11},
1189            {0x10302, 11}, {0x10302, 11}, {0x10402, 11}, {0x10402, 11},
1190            {0x10f01, 11}, {0x10f01, 11}, {0x11001, 11}, {0x11001, 11},
1191            {0x00019, 12}, {0x0001a, 12}, {0x0001b, 12}, {0x00109, 12},
1192            {0x00603, 12}, {0x0010a, 12}, {0x00205, 12}, {0x00703, 12},
1193            {0x00e01, 12}, {0x10008, 12}, {0x10502, 12}, {0x10602, 12},
1194            {0x11101, 12}, {0x11201, 12}, {0x11301, 12}, {0x11401, 12},
1195            {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
1196            {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
1197            {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
1198            {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
1199            {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
1200            {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
1201            {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
1202            {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}
1203    };
1204    
1205  static short const dc_threshold[] = {  static short const dc_threshold[] = {
1206          21514, 26984,  8307, 28531, 29798, 24951, 25970, 26912,          26708,   29545,   25120,   28265,   29281,    8313,   29557,   29541,
1207           8307, 25956, 26994, 25974,  8292, 29286, 28015, 29728,          18208,   21838,   18208,   19536,   29472,   26223,   30580,   29281,
1208          25960, 18208, 21838, 18208, 19536, 22560, 26998,  8260,           8293,   25956,   26994,   25974,    8292,   29286,   28015,   22560,
1209          28515, 25956,  8291, 25640, 30309, 27749, 11817, 22794,          18774,    8260,   20557,   18245,    8244,   26664,   29812,   14960,
1210          30063,  8306, 28531, 29798, 24951, 25970, 25632, 29545,          12079,   30583,   11895,   30328,   25705,   28462,   26482,   29472,
1211          29300, 25193, 29813, 29295, 26656, 29537, 29728,  8303,          30063,   25458,   29541,    8233,   29505,    8299,   28518,    8306,
1212          26983, 25974, 24864, 25443, 29541,  8307, 28532, 26912,          26740,    8293,   28531,   29301,   25955,    8307,   28532,   31008,
1213          29556, 29472, 30063, 25458,  8293, 28515, 25956,  2606          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},
1219            {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},
1220            {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},
1221            {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},
1222            {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0}
1223  };  };
1224    
1225  static VLC const dc_lum_tab[] = {  static VLC const dc_lum_tab[] = {

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

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