[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.3, Sat Mar 9 15:53:05 2002 UTC revision 1.13, Sun Jan 5 16:54:36 2003 UTC
# Line 1  Line 1 
1    /*****************************************************************************
2     *
3     *  XVID MPEG-4 VIDEO CODEC
4     *  - Variable 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    
65    #define ESCAPE  3
66    #define ESCAPE1 6
67    #define ESCAPE2 14
68    #define ESCAPE3 15
69    
70    /*****************************************************************************
71     * The Vector Length Coding structure
72     ****************************************************************************/
73    
74  typedef struct  typedef struct
75  {  {
76          uint32_t code;          uint32_t code;
77          int8_t len;          uint8_t len;
78  } VLC;  }
79    VLC;
80    
81    typedef struct
82    {
83            uint8_t last;
84            uint8_t run;
85            int8_t level;
86    }
87    EVENT;
88    
89  /******************************************************************  typedef struct
90   * common tables between encoder/decoder                          *  {
91   ******************************************************************/          uint8_t len;
92            EVENT event;
93    }
94    REVERSE_EVENT;
95    
96  /* constants taken from momusys/vm_common/inlcude/max_level.h */  typedef struct
97  static char max_level[4][64] = {  {
98          { // intra, last = 0          VLC vlc;
99                  27, 10,  5,  4,  3,  3,  3,  3,          EVENT event;
100                  2,  2,  1,  1,  1,  1,  1,  0,  }
101                  0,  0,  0,  0,  0,  0,  0,  0,  VLC_TABLE;
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
         },  
102    
         { // intra, last = 1  
                 8,  3,  2,  2,  2,  2,  2,  1,  
                 1,  1,  1,  1,  1,  1,  1,  1,  
                 1,  1,  1,  1,  1,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
         },  
103    
104          { // inter, last = 0  /*****************************************************************************
105     * common tables between encoder/decoder
106     ****************************************************************************/
107    
108    static VLC_TABLE const coeff_tab[2][102] =
109    {
110            /* intra = 0 */
111            {
112                    {{ 2,  2}, {0, 0, 1}},
113                    {{15,  4}, {0, 0, 2}},
114                    {{21,  6}, {0, 0, 3}},
115                    {{23,  7}, {0, 0, 4}},
116                    {{31,  8}, {0, 0, 5}},
117                    {{37,  9}, {0, 0, 6}},
118                    {{36,  9}, {0, 0, 7}},
119                    {{33, 10}, {0, 0, 8}},
120                    {{32, 10}, {0, 0, 9}},
121                    {{ 7, 11}, {0, 0, 10}},
122                    {{ 6, 11}, {0, 0, 11}},
123                    {{32, 11}, {0, 0, 12}},
124                    {{ 6,  3}, {0, 1, 1}},
125                    {{20,  6}, {0, 1, 2}},
126                    {{30,  8}, {0, 1, 3}},
127                    {{15, 10}, {0, 1, 4}},
128                    {{33, 11}, {0, 1, 5}},
129                    {{80, 12}, {0, 1, 6}},
130                    {{14,  4}, {0, 2, 1}},
131                    {{29,  8}, {0, 2, 2}},
132                    {{14, 10}, {0, 2, 3}},
133                    {{81, 12}, {0, 2, 4}},
134                    {{13,  5}, {0, 3, 1}},
135                    {{35,  9}, {0, 3, 2}},
136                    {{13, 10}, {0, 3, 3}},
137                    {{12,  5}, {0, 4, 1}},
138                    {{34,  9}, {0, 4, 2}},
139                    {{82, 12}, {0, 4, 3}},
140                    {{11,  5}, {0, 5, 1}},
141                    {{12, 10}, {0, 5, 2}},
142                    {{83, 12}, {0, 5, 3}},
143                    {{19,  6}, {0, 6, 1}},
144                    {{11, 10}, {0, 6, 2}},
145                    {{84, 12}, {0, 6, 3}},
146                    {{18,  6}, {0, 7, 1}},
147                    {{10, 10}, {0, 7, 2}},
148                    {{17,  6}, {0, 8, 1}},
149                    {{ 9, 10}, {0, 8, 2}},
150                    {{16,  6}, {0, 9, 1}},
151                    {{ 8, 10}, {0, 9, 2}},
152                    {{22,  7}, {0, 10, 1}},
153                    {{85, 12}, {0, 10, 2}},
154                    {{21,  7}, {0, 11, 1}},
155                    {{20,  7}, {0, 12, 1}},
156                    {{28,  8}, {0, 13, 1}},
157                    {{27,  8}, {0, 14, 1}},
158                    {{33,  9}, {0, 15, 1}},
159                    {{32,  9}, {0, 16, 1}},
160                    {{31,  9}, {0, 17, 1}},
161                    {{30,  9}, {0, 18, 1}},
162                    {{29,  9}, {0, 19, 1}},
163                    {{28,  9}, {0, 20, 1}},
164                    {{27,  9}, {0, 21, 1}},
165                    {{26,  9}, {0, 22, 1}},
166                    {{34, 11}, {0, 23, 1}},
167                    {{35, 11}, {0, 24, 1}},
168                    {{86, 12}, {0, 25, 1}},
169                    {{87, 12}, {0, 26, 1}},
170                    {{ 7,  4}, {1, 0, 1}},
171                    {{25,  9}, {1, 0, 2}},
172                    {{ 5, 11}, {1, 0, 3}},
173                    {{15,  6}, {1, 1, 1}},
174                    {{ 4, 11}, {1, 1, 2}},
175                    {{14,  6}, {1, 2, 1}},
176                    {{13,  6}, {1, 3, 1}},
177                    {{12,  6}, {1, 4, 1}},
178                    {{19,  7}, {1, 5, 1}},
179                    {{18,  7}, {1, 6, 1}},
180                    {{17,  7}, {1, 7, 1}},
181                    {{16,  7}, {1, 8, 1}},
182                    {{26,  8}, {1, 9, 1}},
183                    {{25,  8}, {1, 10, 1}},
184                    {{24,  8}, {1, 11, 1}},
185                    {{23,  8}, {1, 12, 1}},
186                    {{22,  8}, {1, 13, 1}},
187                    {{21,  8}, {1, 14, 1}},
188                    {{20,  8}, {1, 15, 1}},
189                    {{19,  8}, {1, 16, 1}},
190                    {{24,  9}, {1, 17, 1}},
191                    {{23,  9}, {1, 18, 1}},
192                    {{22,  9}, {1, 19, 1}},
193                    {{21,  9}, {1, 20, 1}},
194                    {{20,  9}, {1, 21, 1}},
195                    {{19,  9}, {1, 22, 1}},
196                    {{18,  9}, {1, 23, 1}},
197                    {{17,  9}, {1, 24, 1}},
198                    {{ 7, 10}, {1, 25, 1}},
199                    {{ 6, 10}, {1, 26, 1}},
200                    {{ 5, 10}, {1, 27, 1}},
201                    {{ 4, 10}, {1, 28, 1}},
202                    {{36, 11}, {1, 29, 1}},
203                    {{37, 11}, {1, 30, 1}},
204                    {{38, 11}, {1, 31, 1}},
205                    {{39, 11}, {1, 32, 1}},
206                    {{88, 12}, {1, 33, 1}},
207                    {{89, 12}, {1, 34, 1}},
208                    {{90, 12}, {1, 35, 1}},
209                    {{91, 12}, {1, 36, 1}},
210                    {{92, 12}, {1, 37, 1}},
211                    {{93, 12}, {1, 38, 1}},
212                    {{94, 12}, {1, 39, 1}},
213                    {{95, 12}, {1, 40, 1}}
214            },
215            /* intra = 1 */
216            {
217                    {{ 2,  2}, {0, 0, 1}},
218                    {{15,  4}, {0, 0, 3}},
219                    {{21,  6}, {0, 0, 6}},
220                    {{23,  7}, {0, 0, 9}},
221                    {{31,  8}, {0, 0, 10}},
222                    {{37,  9}, {0, 0, 13}},
223                    {{36,  9}, {0, 0, 14}},
224                    {{33, 10}, {0, 0, 17}},
225                    {{32, 10}, {0, 0, 18}},
226                    {{ 7, 11}, {0, 0, 21}},
227                    {{ 6, 11}, {0, 0, 22}},
228                    {{32, 11}, {0, 0, 23}},
229                    {{ 6,  3}, {0, 0, 2}},
230                    {{20,  6}, {0, 1, 2}},
231                    {{30,  8}, {0, 0, 11}},
232                    {{15, 10}, {0, 0, 19}},
233                    {{33, 11}, {0, 0, 24}},
234                    {{80, 12}, {0, 0, 25}},
235                    {{14,  4}, {0, 1, 1}},
236                    {{29,  8}, {0, 0, 12}},
237                    {{14, 10}, {0, 0, 20}},
238                    {{81, 12}, {0, 0, 26}},
239                    {{13,  5}, {0, 0, 4}},
240                    {{35,  9}, {0, 0, 15}},
241                    {{13, 10}, {0, 1, 7}},
242                    {{12,  5}, {0, 0, 5}},
243                    {{34,  9}, {0, 4, 2}},
244                    {{82, 12}, {0, 0, 27}},
245                    {{11,  5}, {0, 2, 1}},
246                    {{12, 10}, {0, 2, 4}},
247                    {{83, 12}, {0, 1, 9}},
248                    {{19,  6}, {0, 0, 7}},
249                    {{11, 10}, {0, 3, 4}},
250                    {{84, 12}, {0, 6, 3}},
251                    {{18,  6}, {0, 0, 8}},
252                    {{10, 10}, {0, 4, 3}},
253                    {{17,  6}, {0, 3, 1}},
254                    {{ 9, 10}, {0, 8, 2}},
255                    {{16,  6}, {0, 4, 1}},
256                    {{ 8, 10}, {0, 5, 3}},
257                    {{22,  7}, {0, 1, 3}},
258                    {{85, 12}, {0, 1, 10}},
259                    {{21,  7}, {0, 2, 2}},
260                    {{20,  7}, {0, 7, 1}},
261                    {{28,  8}, {0, 1, 4}},
262                    {{27,  8}, {0, 3, 2}},
263                    {{33,  9}, {0, 0, 16}},
264                    {{32,  9}, {0, 1, 5}},
265                    {{31,  9}, {0, 1, 6}},
266                    {{30,  9}, {0, 2, 3}},
267                    {{29,  9}, {0, 3, 3}},
268                    {{28,  9}, {0, 5, 2}},
269                    {{27,  9}, {0, 6, 2}},
270                    {{26,  9}, {0, 7, 2}},
271                    {{34, 11}, {0, 1, 8}},
272                    {{35, 11}, {0, 9, 2}},
273                    {{86, 12}, {0, 2, 5}},
274                    {{87, 12}, {0, 7, 3}},
275                    {{ 7,  4}, {1, 0, 1}},
276                    {{25,  9}, {0, 11, 1}},
277                    {{ 5, 11}, {1, 0, 6}},
278                    {{15,  6}, {1, 1, 1}},
279                    {{ 4, 11}, {1, 0, 7}},
280                    {{14,  6}, {1, 2, 1}},
281                    {{13,  6}, {0, 5, 1}},
282                    {{12,  6}, {1, 0, 2}},
283                    {{19,  7}, {1, 5, 1}},
284                    {{18,  7}, {0, 6, 1}},
285                    {{17,  7}, {1, 3, 1}},
286                    {{16,  7}, {1, 4, 1}},
287                    {{26,  8}, {1, 9, 1}},
288                    {{25,  8}, {0, 8, 1}},
289                    {{24,  8}, {0, 9, 1}},
290                    {{23,  8}, {0, 10, 1}},
291                    {{22,  8}, {1, 0, 3}},
292                    {{21,  8}, {1, 6, 1}},
293                    {{20,  8}, {1, 7, 1}},
294                    {{19,  8}, {1, 8, 1}},
295                    {{24,  9}, {0, 12, 1}},
296                    {{23,  9}, {1, 0, 4}},
297                    {{22,  9}, {1, 1, 2}},
298                    {{21,  9}, {1, 10, 1}},
299                    {{20,  9}, {1, 11, 1}},
300                    {{19,  9}, {1, 12, 1}},
301                    {{18,  9}, {1, 13, 1}},
302                    {{17,  9}, {1, 14, 1}},
303                    {{ 7, 10}, {0, 13, 1}},
304                    {{ 6, 10}, {1, 0, 5}},
305                    {{ 5, 10}, {1, 1, 3}},
306                    {{ 4, 10}, {1, 2, 2}},
307                    {{36, 11}, {1, 3, 2}},
308                    {{37, 11}, {1, 4, 2}},
309                    {{38, 11}, {1, 15, 1}},
310                    {{39, 11}, {1, 16, 1}},
311                    {{88, 12}, {0, 14, 1}},
312                    {{89, 12}, {1, 0, 8}},
313                    {{90, 12}, {1, 5, 2}},
314                    {{91, 12}, {1, 6, 2}},
315                    {{92, 12}, {1, 17, 1}},
316                    {{93, 12}, {1, 18, 1}},
317                    {{94, 12}, {1, 19, 1}},
318                    {{95, 12}, {1, 20, 1}}
319            }
320    };
321    
322    /* constants taken from momusys/vm_common/inlcude/max_level.h */
323    static uint8_t const max_level[2][2][64] = {
324            {
325                    /* intra = 0, last = 0 */
326                    {
327                  12,  6,  4,  3,  3,  3,  3,  2,                  12,  6,  4,  3,  3,  3,  3,  2,
328                  2,  2,  2,  1,  1,  1,  1,  1,                  2,  2,  2,  1,  1,  1,  1,  1,
329                  1,  1,  1,  1,  1,  1,  1,  1,                  1,  1,  1,  1,  1,  1,  1,  1,
# Line 48  Line 331 
331                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
332                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
333                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
334                  0,  0,  0,  0,  0,  0,  0,  0,                          0, 0, 0, 0, 0, 0, 0, 0
335          },          },
336                    /* intra = 0, last = 1 */
337          { // inter, last = 1                  {
338                  3,  2,  1,  1,  1,  1,  1,  1,                  3,  2,  1,  1,  1,  1,  1,  1,
339                  1,  1,  1,  1,  1,  1,  1,  1,                  1,  1,  1,  1,  1,  1,  1,  1,
340                  1,  1,  1,  1,  1,  1,  1,  1,                  1,  1,  1,  1,  1,  1,  1,  1,
# Line 59  Line 342 
342                  1,  1,  1,  1,  1,  1,  1,  1,                  1,  1,  1,  1,  1,  1,  1,  1,
343                  1,  0,  0,  0,  0,  0,  0,  0,                  1,  0,  0,  0,  0,  0,  0,  0,
344                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
345                  0,  0,  0,  0,  0,  0,  0,  0,                          0, 0, 0, 0, 0, 0, 0, 0
346          }          }
 };  
   
 static char max_run[4][256] = {  
         { // intra, last = 0  
                 0, 14,  9,  7,  3,  2,  1,  1,  
                 1,  1,  1,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
347          },          },
348            {
349          { // intra, last = 1                  /* intra = 1, last = 0 */
350                  0, 20,  6,  1,  0,  0,  0,  0,                  {
351                  0,  0,  0,  0,  0,  0,  0,  0,                          27, 10, 5, 4, 3, 3, 3, 3,
352                  0,  0,  0,  0,  0,  0,  0,  0,                          2, 2, 1, 1, 1, 1, 1, 0,
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
353                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
354                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
355                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
356                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
357                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
358                            0, 0, 0, 0, 0, 0, 0, 0
359                    },
360                    /* intra = 1, last = 1 */
361                    {
362                            8, 3, 2, 2, 2, 2, 2, 1,
363                            1, 1, 1, 1, 1, 1, 1, 1,
364                            1, 1, 1, 1, 1, 0, 0, 0,
365                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
366                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
367                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
368                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
369          },                          0, 0, 0, 0, 0, 0, 0, 0
370                    }
371            }
372    };
373    
374          { // inter, last = 0  static uint8_t const max_run[2][2][64] = {
375            {
376                    /* intra = 0, last = 0 */
377                    {
378                  0, 26, 10,  6,  2,  1,  1,  0,                  0, 26, 10,  6,  2,  1,  1,  0,
379                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
380                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
# Line 143  Line 383 
383                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
384                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
385                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
386          },          },
387                    /* intra = 0, last = 1 */
388          { // inter, last = 1                  {
389                  0, 40,  1,  0,  0,  0,  0,  0,                  0, 40,  1,  0,  0,  0,  0,  0,
390                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
391                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
# Line 178  Line 394 
394                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
395                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
396                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
397                    }
398            },
399            {
400                    /* intra = 1, last = 0 */
401                    {
402                            0, 14, 9, 7, 3, 2, 1, 1,
403                            1, 1, 1, 0, 0, 0, 0, 0,
404                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
405                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
406                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
407                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
408                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
409                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
410                  0,  0,  0,  0,  0,  0,  0,  0,                  },
411                  0,  0,  0,  0,  0,  0,  0,  0,                  /* intra = 1, last = 1 */
412                  0,  0,  0,  0,  0,  0,  0,  0,                  {
413                  0,  0,  0,  0,  0,  0,  0,  0,                          0, 20, 6, 1, 0, 0, 0, 0,
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
                 0,  0,  0,  0,  0,  0,  0,  0,  
414                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
415                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
416                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
# Line 203  Line 419 
419                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
420                  0,  0,  0,  0,  0,  0,  0,  0,                  0,  0,  0,  0,  0,  0,  0,  0,
421          }          }
422            }
423  };  };
424    
425    
# Line 210  Line 427 
427   * encoder tables                                                 *   * encoder tables                                                 *
428   ******************************************************************/   ******************************************************************/
429    
 /* DCT coefficients. Four tables, two for last = 0, two for last = 1.  
    the sign bit must be added afterwards. */  
   
 /* first part of coeffs for last = 0. Indexed by [run][level-1] */  
   
 static VLC coeff_tab0[2][12] = {  
430          /*          /*
431            run = 0   * MCBPC Indexing by cbpc in first two bits, mode in last two.
432     * CBPC as in table 4/H.263, MB type (mode): 3 = 01, 4 = 10.
433     * Example: cbpc = 01 and mode = 4 gives index = 0110 = 6.
434          */          */
         {  
                 {0x02, 2}, {0x0f, 4}, {0x15, 6}, {0x17, 7},  
                 {0x1f, 8}, {0x25, 9}, {0x24, 9}, {0x21, 10},  
                 {0x20, 10}, {0x07, 11}, {0x06, 11}, {0x20, 11}  
         },  
         /*  
           run = 1  
         */  
         {  
                 {0x06, 3}, {0x14, 6}, {0x1e, 8}, {0x0f, 10},  
                 {0x21, 11}, {0x50, 12}, {0x00, 0}, {0x00, 0},  
                 {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}  
         }  
 };  
   
 /* rest of coeffs for last = 0. indexing by [run-2][level-1] */  
435    
436  static VLC coeff_tab1[25][4] = {  static VLC const mcbpc_intra_tab[15] = {
437          /*          {0x01, 9}, {0x01, 1}, {0x01, 4}, {0x00, 0},
438            run = 2          {0x00, 0}, {0x01, 3}, {0x01, 6}, {0x00, 0},
439          */          {0x00, 0}, {0x02, 3}, {0x02, 6}, {0x00, 0},
440          {          {0x00, 0}, {0x03, 3}, {0x03, 6}
                 {0x0e, 4}, {0x1d, 8}, {0x0e, 10}, {0x51, 12}  
         },  
         /*  
           run = 3  
         */  
         {  
                 {0x0d, 5}, {0x23, 9}, {0x0d, 10}, {0x00, 0}  
         },  
         /*  
           run = 4-26  
         */  
         {  
                 {0x0c, 5}, {0x22, 9}, {0x52, 12}, {0x00, 0}  
         },  
         {  
                 {0x0b, 5}, {0x0c, 10}, {0x53, 12}, {0x00, 0}  
         },  
         {  
                 {0x13, 6}, {0x0b, 10}, {0x54, 12}, {0x00, 0}  
         },  
         {  
                 {0x12, 6}, {0x0a, 10}, {0x00, 0}, {0x00, 0}  
         },  
         {  
                 {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}  
         }  
 };  
   
 /* first coeffs of last = 1. indexing by [run][level-1] */  
   
 static VLC coeff_tab2[2][3] = {  
         /*  
           run = 0  
         */  
         {  
                 {0x07, 4}, {0x19, 9}, {0x05, 11}  
         },  
         /*  
           run = 1  
         */  
         {  
                 {0x0f, 6}, {0x04, 11}, {0x00, 0}  
         }  
 };  
   
 /* rest of coeffs for last = 1. indexing by [run-2] */  
   
 static VLC coeff_tab3[40][1] = {  
         {{0x0e, 6}},  {{0x0d, 6}},  {{0x0c, 6}},  
         {{0x13, 7}},  {{0x12, 7}},  {{0x11, 7}},  {{0x10, 7}},  
         {{0x1a, 8}},  {{0x19, 8}},  {{0x18, 8}},  {{0x17, 8}},  
         {{0x16, 8}},  {{0x15, 8}},  {{0x14, 8}},  {{0x13, 8}},  
         {{0x18, 9}},  {{0x17, 9}},  {{0x16, 9}},  {{0x15, 9}},  
         {{0x14, 9}},  {{0x13, 9}},  {{0x12, 9}},  {{0x11, 9}},  
         {{0x07, 10}}, {{0x06, 10}}, {{0x05, 10}}, {{0x04, 10}},  
         {{0x24, 11}}, {{0x25, 11}}, {{0x26, 11}}, {{0x27, 11}},  
         {{0x58, 12}}, {{0x59, 12}}, {{0x5a, 12}}, {{0x5b, 12}},  
         {{0x5c, 12}}, {{0x5d, 12}}, {{0x5e, 12}}, {{0x5f, 12}},  
         {{0x00, 0}}  
 };  
   
 /* New tables for Intra luminance coefficients. Same codewords,  
    different meaning */  
   
 /* Coeffs for last = 0, run = 0. Indexed by [level-1] */  
   
 static VLC coeff_tab4[27] = {  
         /*  
           run = 0  
         */  
         {0x02, 2}, {0x06, 3}, {0x0f, 4}, {0x0d, 5},  
         {0x0c, 5}, {0x15, 6}, {0x13, 6}, {0x12, 6},  
         {0x17, 7}, {0x1f, 8}, {0x1e, 8}, {0x1d, 8},  
         {0x25, 9}, {0x24, 9}, {0x23, 9}, {0x21, 9},  
         {0x21, 10}, {0x20, 10}, {0x0f, 10}, {0x0e, 10},  
         {0x07, 11}, {0x06, 11}, {0x20, 11}, {0x21, 11},  
         {0x50, 12}, {0x51, 12}, {0x52, 12}  
 };  
   
 /* Coeffs for last = 0, run = 1. Indexed by [level-1] */  
   
 static VLC coeff_tab5[10] = {  
         {0x0e, 4}, {0x14, 6}, {0x16, 7}, {0x1c, 8},  
         {0x20, 9}, {0x1f, 9}, {0x0d, 10}, {0x22, 11},  
         {0x53, 12}, {0x55, 12}  
 };  
   
 /* Coeffs for last = 0, run = 2 -> 9. Indexed by [run-2][level-1] */  
   
 static VLC coeff_tab6[8][5] = {  
         /*  
           run = 2  
         */  
         {  
                 {0x0b, 5}, {0x15, 7}, {0x1e, 9}, {0x0c, 10},  
                 {0x56, 12}  
         },  
         /*  
           run = 3  
         */  
         {  
                 {0x11, 6}, {0x1b, 8}, {0x1d, 9}, {0x0b, 10},  
                 {0x00, 0}  
         },  
         /*  
           run = 4  
         */  
         {  
                 {0x10, 6}, {0x22, 9}, {0x0a, 10}, {0x00, 0},  
                 {0x00, 0}  
         },  
         /*  
           run = 5  
         */  
         {  
                 {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}  
         }  
 };  
   
 /* Coeffs for last = 0, run = 10 -> 14. Indexed by [run-10] */  
   
 static VLC coeff_tab7[5][1] = {  
         {{0x17, 8}}, {{0x19, 9}}, {{0x18, 9}}, {{0x07, 10}},  
         {{0x58, 12}}  
 };  
   
 /* Coeffs for last = 1, run = 0. Indexed by [level-1] */  
   
 static VLC coeff_tab8[8] = {  
         {0x07, 4}, {0x0c, 6}, {0x16, 8}, {0x17, 9},  
         {0x06, 10}, {0x05, 11}, {0x04, 11}, {0x59, 12}  
 };  
   
 /* Coeffs for last = 1, run = 1 -> 6. Indexed by [run-1][level-1] */  
   
 static VLC coeff_tab9[6][3] = {  
         /*  
           run = 1  
         */  
         {  
                 {0x0f, 6}, {0x16, 9}, {0x05, 10}  
         },  
         /*  
           run = 2  
         */  
         {  
                 {0x0e, 6}, {0x04, 10}, {0x00, 0}  
         },  
         /*  
           run = 3  
         */  
         {  
                 {0x11, 7}, {0x24, 11}, {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}  
         }  
 };  
   
 /* Coeffs for last = 1, run = 7 -> 20. Indexed by [run-7] */  
   
 static VLC coeff_tab10[14][1] = {  
         {{0x14, 8}},  {{0x13, 8}}, {{0x1a, 8}}, {{0x15, 9}},  
         {{0x14, 9}},  {{0x13, 9}}, {{0x12, 9}}, {{0x11, 9}},  
         {{0x26, 11}}, {{0x27, 11}}, {{0x5c, 12}}, {{0x5d, 12}},  
         {{0x5e, 12}}, {{0x5f, 12}}  
 };  
   
   
 static VLC *coeff_intra_last0[15] = {  
         coeff_tab4,  
         coeff_tab5,  
         coeff_tab6[0],  
         coeff_tab6[1],  
         coeff_tab6[2],  
         coeff_tab6[3],  
         coeff_tab6[4],  
         coeff_tab6[5],  
         coeff_tab6[6],  
         coeff_tab6[7],  
         coeff_tab7[0],  
         coeff_tab7[1],  
         coeff_tab7[2],  
         coeff_tab7[3],  
         coeff_tab7[4]  
 };  
   
 static VLC *coeff_intra_last1[21] = {  
         coeff_tab8,  
         coeff_tab9[0],  
         coeff_tab9[1],  
         coeff_tab9[2],  
         coeff_tab9[3],  
         coeff_tab9[4],  
         coeff_tab9[5],  
         coeff_tab10[0],  
         coeff_tab10[1],  
         coeff_tab10[2],  
         coeff_tab10[3],  
         coeff_tab10[4],  
         coeff_tab10[5],  
         coeff_tab10[6],  
         coeff_tab10[7],  
         coeff_tab10[8],  
         coeff_tab10[9],  
         coeff_tab10[10],  
         coeff_tab10[11],  
         coeff_tab10[12],  
         coeff_tab10[13],  
441  };  };
442    
443  static VLC *coeff_inter_last0[27] = {  /* MCBPC inter.
444          coeff_tab0[0],     Addressing: 5 bit ccmmm (cc = CBPC, mmm = mode (1-4 binary)) */
         coeff_tab0[1],  
         coeff_tab1[0],  
         coeff_tab1[1],  
         coeff_tab1[2],  
         coeff_tab1[3],  
         coeff_tab1[4],  
         coeff_tab1[5],  
         coeff_tab1[6],  
         coeff_tab1[7],  
         coeff_tab1[8],  
         coeff_tab1[9],  
         coeff_tab1[10],  
         coeff_tab1[11],  
         coeff_tab1[12],  
         coeff_tab1[13],  
         coeff_tab1[14],  
         coeff_tab1[15],  
         coeff_tab1[16],  
         coeff_tab1[17],  
         coeff_tab1[18],  
         coeff_tab1[19],  
         coeff_tab1[20],  
         coeff_tab1[21],  
         coeff_tab1[22],  
         coeff_tab1[23],  
         coeff_tab1[24],  
 };  
   
 static VLC *coeff_inter_last1[42] = {  
         coeff_tab2[0],  
         coeff_tab2[1],  
         coeff_tab3[0],  
         coeff_tab3[1],  
         coeff_tab3[2],  
         coeff_tab3[3],  
         coeff_tab3[4],  
         coeff_tab3[5],  
         coeff_tab3[6],  
         coeff_tab3[7],  
         coeff_tab3[8],  
         coeff_tab3[9],  
         coeff_tab3[10],  
         coeff_tab3[11],  
         coeff_tab3[12],  
         coeff_tab3[13],  
         coeff_tab3[14],  
         coeff_tab3[15],  
         coeff_tab3[16],  
         coeff_tab3[17],  
         coeff_tab3[18],  
         coeff_tab3[19],  
         coeff_tab3[20],  
         coeff_tab3[21],  
         coeff_tab3[22],  
         coeff_tab3[23],  
         coeff_tab3[24],  
         coeff_tab3[25],  
         coeff_tab3[26],  
         coeff_tab3[27],  
         coeff_tab3[28],  
         coeff_tab3[29],  
         coeff_tab3[30],  
         coeff_tab3[31],  
         coeff_tab3[32],  
         coeff_tab3[33],  
         coeff_tab3[34],  
         coeff_tab3[35],  
         coeff_tab3[36],  
         coeff_tab3[37],  
         coeff_tab3[38],  
         coeff_tab3[39],  
 };  
   
 static VLC **coeff_vlc[4] = {  
         coeff_intra_last0,  
         coeff_intra_last1,  
         coeff_inter_last0,  
         coeff_inter_last1,  
 };  
   
 static const VLC mcbpc_I[4] = {  
         {1, 1}, {1, 3}, {2, 3}, {3, 3}  
 };  
   
 static const VLC mcbpc_P_intra[4] = {  
         {3, 5}, {4, 8}, {3, 8}, {3, 7}  
 };  
   
 static const VLC mcbpc_P_inter[4] = {  
         {1, 1}, {3, 4}, {2, 4}, {5, 6}  
 };  
445    
446  static const VLC mcbpc_P_inter4v[4] = {  static VLC const mcbpc_inter_tab[29] = {
447          {2, 3}, {5, 7}, {4, 7}, {5, 8}          {1, 1}, {3, 3}, {2, 3}, {3, 5}, {4, 6}, {1, 9}, {0, 0}, {0, 0},
448            {3, 4}, {7, 7}, {5, 7}, {4, 8}, {4, 9}, {0, 0}, {0, 0}, {0, 0},
449            {2, 4}, {6, 7}, {4, 7}, {3, 8}, {3, 9}, {0, 0}, {0, 0}, {0, 0},
450            {5, 6}, {5, 9}, {5, 8}, {3, 7}, {2, 9}
451  };  };
452    
453  static const VLC cbpy_tab[16] = {  static VLC const cbpy_tab[16] = {
454          {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},
455          {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}
456  };  };
457    
458  static const VLC dcy_tab[511] = {  static VLC const dcy_tab[511] = {
459          {0x100, 15}, {0x101, 15}, {0x102, 15}, {0x103, 15},          {0x100, 15}, {0x101, 15}, {0x102, 15}, {0x103, 15},
460          {0x104, 15}, {0x105, 15}, {0x106, 15}, {0x107, 15},          {0x104, 15}, {0x105, 15}, {0x106, 15}, {0x107, 15},
461          {0x108, 15}, {0x109, 15}, {0x10a, 15}, {0x10b, 15},          {0x108, 15}, {0x109, 15}, {0x10a, 15}, {0x10b, 15},
# Line 784  Line 586 
586          {0x1fd, 15}, {0x1fe, 15}, {0x1ff, 15},          {0x1fd, 15}, {0x1fe, 15}, {0x1ff, 15},
587  };  };
588    
589  static const VLC dcc_tab[511] = {  static VLC const dcc_tab[511] = {
590          {0x100, 16}, {0x101, 16}, {0x102, 16}, {0x103, 16},          {0x100, 16}, {0x101, 16}, {0x102, 16}, {0x103, 16},
591          {0x104, 16}, {0x105, 16}, {0x106, 16}, {0x107, 16},          {0x104, 16}, {0x105, 16}, {0x106, 16}, {0x107, 16},
592          {0x108, 16}, {0x109, 16}, {0x10a, 16}, {0x10b, 16},          {0x108, 16}, {0x109, 16}, {0x10a, 16}, {0x10b, 16},
# Line 916  Line 718 
718  };  };
719    
720    
721  static const VLC mb_motion_table[65] = {  static VLC const mb_motion_table[65] = {
722          {0x05, 13}, {0x07, 13}, {0x05, 12}, {0x07, 12},          {0x05, 13}, {0x07, 13}, {0x05, 12}, {0x07, 12},
723          {0x09, 12}, {0x0b, 12}, {0x0d, 12}, {0x0f, 12},          {0x09, 12}, {0x0b, 12}, {0x0d, 12}, {0x0f, 12},
724          {0x09, 11}, {0x0b, 11}, {0x0d, 11}, {0x0f, 11},          {0x09, 11}, {0x0b, 11}, {0x0d, 11}, {0x0f, 11},
# Line 941  Line 743 
743   * decoder tables                                                 *   * decoder tables                                                 *
744   ******************************************************************/   ******************************************************************/
745    
746  static const VLC mcbpc_intra_table[64] = {  static VLC const mcbpc_intra_table[64] = {
747          {-1,0},          {-1, 0}, {20, 6}, {36, 6}, {52, 6}, {4, 4},  {4, 4},  {4, 4},  {4, 4},
748          {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},
749          {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},
750          {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},
751          {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},
752          {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},
753          {51,3}, {3, 1},          {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},
754          {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}  
755  };  };
756    
757    
758  static const VLC mcbpc_inter_table[257] = {  static VLC const mcbpc_inter_table[257] = {
759          {VLC_ERROR,0},          {VLC_ERROR, 0}, {255, 9}, {52, 9}, {36, 9}, {20, 9}, {49, 9}, {35, 8}, {35, 8},
760          {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},
761          {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},
762          {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},
763          {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},
764          {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},
765          {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},
766          {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},
767          {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},
768          {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},
769          {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},
770          {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},
771          {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},
772          {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},
773          {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},
774          {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},
775          {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},
776          {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},
777          {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},
778          {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},
779          {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},
780          {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},
781          {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},
782          {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},
783          {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},
784          {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},
785          {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},
786          {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},
787          {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},
788          {1,3}, {1,3}, {1,3}, {0,1}          {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
789            {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
790            {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
791            {0, 1}
792  };  };
793    
794  static const VLC cbpy_table[64] =  static VLC const cbpy_table[64] = {
 {  
795          {-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},
796          {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},
797          {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},
798          {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},
799          {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},
800          {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},
801          {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},
802          {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}  
 };  
   
   
 VLC TMNMVtab0[] = {  
         {3,4}, {-3,4}, {2,3}, {2,3}, {-2,3}, {-2,3}, {1,2}, {1,2}, {1,2}, {1,2},  
         {-1,2}, {-1,2}, {-1,2}, {-1,2}  
803  };  };
804    
 VLC TMNMVtab1[] = {  
         {12,10}, {-12,10}, {11,10}, {-11,10}, {10,9}, {10,9}, {-10,9}, {-10,9},  
         {9,9}, {9,9}, {-9,9}, {-9,9}, {8,9}, {8,9}, {-8,9}, {-8,9}, {7,7}, {7,7},  
         {7,7}, {7,7}, {7,7}, {7,7}, {7,7}, {7,7}, {-7,7}, {-7,7}, {-7,7}, {-7,7},  
         {-7,7}, {-7,7}, {-7,7}, {-7,7}, {6,7}, {6,7}, {6,7}, {6,7}, {6,7}, {6,7},  
         {6,7}, {6,7}, {-6,7}, {-6,7}, {-6,7}, {-6,7}, {-6,7}, {-6,7}, {-6,7},  
         {-6,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {-5,7},  
         {-5,7}, {-5,7}, {-5,7}, {-5,7}, {-5,7}, {-5,7}, {-5,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}, {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}, {-4,6}, {-4,6}, {-4,6}, {-4,6}, {-4,6}, {-4,6}  
 };  
805    
806  VLC TMNMVtab2[] = {  static VLC const TMNMVtab0[] = {
807          {32,12}, {-32,12}, {31,12}, {-31,12}, {30,11}, {30,11}, {-30,11}, {-30,11},          {3, 4}, {-3, 4}, {2, 3}, {2, 3}, {-2, 3}, {-2, 3}, {1, 2},
808          {29,11}, {29,11}, {-29,11}, {-29,11}, {28,11}, {28,11}, {-28,11}, {-28,11},          {1, 2}, {1, 2}, {1, 2}, {-1, 2}, {-1, 2}, {-1, 2}, {-1, 2}
809          {27,11}, {27,11}, {-27,11}, {-27,11}, {26,11}, {26,11}, {-26,11}, {-26,11},  };
810          {25,11}, {25,11}, {-25,11}, {-25,11}, {24,10}, {24,10}, {24,10}, {24,10},  
811          {-24,10}, {-24,10}, {-24,10}, {-24,10}, {23,10}, {23,10}, {23,10}, {23,10},  static VLC const TMNMVtab1[] = {
812          {-23,10}, {-23,10}, {-23,10}, {-23,10}, {22,10}, {22,10}, {22,10}, {22,10},          {12, 10}, {-12, 10}, {11, 10}, {-11, 10},
813          {-22,10}, {-22,10}, {-22,10}, {-22,10}, {21,10}, {21,10}, {21,10}, {21,10},          {10, 9}, {10, 9}, {-10, 9}, {-10, 9},
814          {-21,10}, {-21,10}, {-21,10}, {-21,10}, {20,10}, {20,10}, {20,10}, {20,10},          {9, 9}, {9, 9}, {-9, 9}, {-9, 9},
815          {-20,10}, {-20,10}, {-20,10}, {-20,10}, {19,10}, {19,10}, {19,10}, {19,10},          {8, 9}, {8, 9}, {-8, 9}, {-8, 9},
816          {-19,10}, {-19,10}, {-19,10}, {-19,10}, {18,10}, {18,10}, {18,10}, {18,10},          {7, 7}, {7, 7}, {7, 7}, {7, 7},
817          {-18,10}, {-18,10}, {-18,10}, {-18,10}, {17,10}, {17,10}, {17,10}, {17,10},          {7, 7}, {7, 7}, {7, 7}, {7, 7},
818          {-17,10}, {-17,10}, {-17,10}, {-17,10}, {16,10}, {16,10}, {16,10}, {16,10},          {-7, 7}, {-7, 7}, {-7, 7}, {-7, 7},
819          {-16,10}, {-16,10}, {-16,10}, {-16,10}, {15,10}, {15,10}, {15,10}, {15,10},          {-7, 7}, {-7, 7}, {-7, 7}, {-7, 7},
820          {-15,10}, {-15,10}, {-15,10}, {-15,10}, {14,10}, {14,10}, {14,10}, {14,10},          {6, 7}, {6, 7}, {6, 7}, {6, 7},
821          {-14,10}, {-14,10}, {-14,10}, {-14,10}, {13,10}, {13,10}, {13,10}, {13,10},          {6, 7}, {6, 7}, {6, 7}, {6, 7},
822            {-6, 7}, {-6, 7}, {-6, 7}, {-6, 7},
823            {-6, 7}, {-6, 7}, {-6, 7}, {-6, 7},
824            {5, 7}, {5, 7}, {5, 7}, {5, 7},
825            {5, 7}, {5, 7}, {5, 7}, {5, 7},
826            {-5, 7}, {-5, 7}, {-5, 7}, {-5, 7},
827            {-5, 7}, {-5, 7}, {-5, 7}, {-5, 7},
828            {4, 6}, {4, 6}, {4, 6}, {4, 6},
829            {4, 6}, {4, 6}, {4, 6}, {4, 6},
830            {4, 6}, {4, 6}, {4, 6}, {4, 6},
831            {4, 6}, {4, 6}, {4, 6}, {4, 6},
832            {-4, 6}, {-4, 6}, {-4, 6}, {-4, 6},
833            {-4, 6}, {-4, 6}, {-4, 6}, {-4, 6},
834            {-4, 6}, {-4, 6}, {-4, 6}, {-4, 6},
835            {-4, 6}, {-4, 6}, {-4, 6}, {-4, 6}
836    };
837    
838    static VLC const TMNMVtab2[] = {
839            {32, 12}, {-32, 12}, {31, 12}, {-31, 12},
840            {30, 11}, {30, 11}, {-30, 11}, {-30, 11},
841            {29, 11}, {29, 11}, {-29, 11}, {-29, 11},
842            {28, 11}, {28, 11}, {-28, 11}, {-28, 11},
843            {27, 11}, {27, 11}, {-27, 11}, {-27, 11},
844            {26, 11}, {26, 11}, {-26, 11}, {-26, 11},
845            {25, 11}, {25, 11}, {-25, 11}, {-25, 11},
846            {24, 10}, {24, 10}, {24, 10}, {24, 10},
847            {-24, 10}, {-24, 10}, {-24, 10}, {-24, 10},
848            {23, 10}, {23, 10}, {23, 10}, {23, 10},
849            {-23, 10}, {-23, 10}, {-23, 10}, {-23, 10},
850            {22, 10}, {22, 10}, {22, 10}, {22, 10},
851            {-22, 10}, {-22, 10}, {-22, 10}, {-22, 10},
852            {21, 10}, {21, 10}, {21, 10}, {21, 10},
853            {-21, 10}, {-21, 10}, {-21, 10}, {-21, 10},
854            {20, 10}, {20, 10}, {20, 10}, {20, 10},
855            {-20, 10}, {-20, 10}, {-20, 10}, {-20, 10},
856            {19, 10}, {19, 10}, {19, 10}, {19, 10},
857            {-19, 10}, {-19, 10}, {-19, 10}, {-19, 10},
858            {18, 10}, {18, 10}, {18, 10}, {18, 10},
859            {-18, 10}, {-18, 10}, {-18, 10}, {-18, 10},
860            {17, 10}, {17, 10}, {17, 10}, {17, 10},
861            {-17, 10}, {-17, 10}, {-17, 10}, {-17, 10},
862            {16, 10}, {16, 10}, {16, 10}, {16, 10},
863            {-16, 10}, {-16, 10}, {-16, 10}, {-16, 10},
864            {15, 10}, {15, 10}, {15, 10}, {15, 10},
865            {-15, 10}, {-15, 10}, {-15, 10}, {-15, 10},
866            {14, 10}, {14, 10}, {14, 10}, {14, 10},
867            {-14, 10}, {-14, 10}, {-14, 10}, {-14, 10},
868            {13, 10}, {13, 10}, {13, 10}, {13, 10},
869          {-13,10}, {-13,10}, {-13,10}, {-13,10}          {-13,10}, {-13,10}, {-13,10}, {-13,10}
870  };  };
871    
872    static short const dc_threshold[] = {
873  VLC DCT3Dtab0[] = {          21514, 26984,  8307, 28531, 29798, 24951, 25970, 26912,
874          {4225,7}, {4209,7}, {4193,7}, {4177,7}, {193,7}, {177,7},           8307, 25956, 26994, 25974,  8292, 29286, 28015, 29728,
875          {161,7}, {4,7}, {4161,6}, {4161,6}, {4145,6}, {4145,6},          25960, 18208, 21838, 18208, 19536, 22560, 26998,  8260,
876          {4129,6}, {4129,6}, {4113,6}, {4113,6}, {145,6}, {145,6},          28515, 25956,  8291, 12328, 14638, 12334, 11817, 22794,
877          {129,6}, {129,6}, {113,6}, {113,6}, {97,6}, {97,6},          30063,  8306, 28531, 29798, 24951, 25970, 25632, 29545,
878          {18,6}, {18,6}, {3,6}, {3,6}, {81,5}, {81,5},          29300, 25193, 29813, 29295, 26656, 29537, 29728,  8303,
879          {81,5}, {81,5}, {65,5}, {65,5}, {65,5}, {65,5},          26983, 25974, 24864, 25443, 29541,  8307, 28532, 26912,
880          {49,5}, {49,5}, {49,5}, {49,5}, {4097,4}, {4097,4},          29556, 29472, 30063, 25458,  8293, 28515, 25956,  2606
         {4097,4}, {4097,4}, {4097,4}, {4097,4}, {4097,4}, {4097,4},  
         {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}, {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}, {1,2}, {1,2},  
         {1,2}, {1,2}, {17,3}, {17,3}, {17,3}, {17,3},  
         {17,3}, {17,3}, {17,3}, {17,3}, {17,3}, {17,3},  
         {17,3}, {17,3}, {17,3}, {17,3}, {17,3}, {17,3},  
         {33,4}, {33,4}, {33,4}, {33,4}, {33,4}, {33,4},  
         {33,4}, {33,4}, {2,4}, {2,4},{2,4},{2,4},  
         {2,4}, {2,4},{2,4},{2,4}  
 };  
   
   
 VLC DCT3Dtab1[] = {  
         {9,10}, {8,10}, {4481,9}, {4481,9}, {4465,9}, {4465,9},  
         {4449,9}, {4449,9}, {4433,9}, {4433,9}, {4417,9}, {4417,9},  
         {4401,9}, {4401,9}, {4385,9}, {4385,9}, {4369,9}, {4369,9},  
         {4098,9}, {4098,9}, {353,9}, {353,9}, {337,9}, {337,9},  
         {321,9}, {321,9}, {305,9}, {305,9}, {289,9}, {289,9},  
         {273,9}, {273,9}, {257,9}, {257,9}, {241,9}, {241,9},  
         {66,9}, {66,9}, {50,9}, {50,9}, {7,9}, {7,9},  
         {6,9}, {6,9}, {4353,8}, {4353,8}, {4353,8}, {4353,8},  
         {4337,8}, {4337,8}, {4337,8}, {4337,8}, {4321,8}, {4321,8},  
         {4321,8}, {4321,8}, {4305,8}, {4305,8}, {4305,8}, {4305,8},  
         {4289,8}, {4289,8}, {4289,8}, {4289,8}, {4273,8}, {4273,8},  
         {4273,8}, {4273,8}, {4257,8}, {4257,8}, {4257,8}, {4257,8},  
         {4241,8}, {4241,8}, {4241,8}, {4241,8}, {225,8}, {225,8},  
         {225,8}, {225,8}, {209,8}, {209,8}, {209,8}, {209,8},  
         {34,8}, {34,8}, {34,8}, {34,8}, {19,8}, {19,8},  
         {19,8}, {19,8}, {5,8}, {5,8}, {5,8}, {5,8}  
 };  
   
 VLC DCT3Dtab2[] = {  
         {4114,11}, {4114,11}, {4099,11}, {4099,11}, {11,11}, {11,11},  
         {10,11}, {10,11}, {4545,10}, {4545,10}, {4545,10}, {4545,10},  
         {4529,10}, {4529,10}, {4529,10}, {4529,10}, {4513,10}, {4513,10},  
         {4513,10}, {4513,10}, {4497,10}, {4497,10}, {4497,10}, {4497,10},  
         {146,10}, {146,10}, {146,10}, {146,10}, {130,10}, {130,10},  
         {130,10}, {130,10}, {114,10}, {114,10}, {114,10}, {114,10},  
         {98,10}, {98,10}, {98,10}, {98,10}, {82,10}, {82,10},  
         {82,10}, {82,10}, {51,10}, {51,10}, {51,10}, {51,10},  
         {35,10}, {35,10}, {35,10}, {35,10}, {20,10}, {20,10},  
         {20,10}, {20,10}, {12,11}, {12,11}, {21,11}, {21,11},  
         {369,11}, {369,11}, {385,11}, {385,11}, {4561,11}, {4561,11},  
         {4577,11}, {4577,11}, {4593,11}, {4593,11}, {4609,11}, {4609,11},  
         {22,12}, {36,12}, {67,12}, {83,12}, {99,12}, {162,12},  
         {401,12}, {417,12}, {4625,12}, {4641,12}, {4657,12}, {4673,12},  
         {4689,12}, {4705,12}, {4721,12}, {4737,12}, {7167,7},  
         {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},  
         {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},  
         {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},  
         {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},  
         {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},  
         {7167,7}  
 };  
   
   
 /* New tables for Intra luminance blocks */  
   
 VLC DCT3Dtab3[] = {  
         {0x10401, 7}, {0x10301, 7}, {0x00601, 7}, {0x10501, 7},  
         {0x00701, 7}, {0x00202, 7}, {0x00103, 7}, {0x00009, 7},  
         {0x10002, 6}, {0x10002, 6}, {0x00501, 6}, {0x00501, 6},  
         {0x10201, 6}, {0x10201, 6}, {0x10101, 6}, {0x10101, 6},  
         {0x00401, 6}, {0x00401, 6}, {0x00301, 6}, {0x00301, 6},  
         {0x00008, 6}, {0x00008, 6}, {0x00007, 6}, {0x00007, 6},  
         {0x00102, 6}, {0x00102, 6}, {0x00006, 6}, {0x00006, 6},  
         {0x00201, 5}, {0x00201, 5}, {0x00201, 5}, {0x00201, 5},  
         {0x00005, 5}, {0x00005, 5}, {0x00005, 5}, {0x00005, 5},  
         {0x00004, 5}, {0x00004, 5}, {0x00004, 5}, {0x00004, 5},  
         {0x10001, 4}, {0x10001, 4}, {0x10001, 4}, {0x10001, 4},  
         {0x10001, 4}, {0x10001, 4}, {0x10001, 4}, {0x10001, 4},  
         {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},  
         {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},  
         {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},  
         {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},  
         {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},  
         {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},  
         {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},  
         {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},  
         {0x00002, 3}, {0x00002, 3}, {0x00002, 3}, {0x00002, 3},  
         {0x00002, 3}, {0x00002, 3}, {0x00002, 3}, {0x00002, 3},  
         {0x00002, 3}, {0x00002, 3}, {0x00002, 3}, {0x00002, 3},  
         {0x00002, 3}, {0x00002, 3}, {0x00002, 3}, {0x00002, 3},  
         {0x00101, 4}, {0x00101, 4}, {0x00101, 4}, {0x00101, 4},  
         {0x00101, 4}, {0x00101, 4}, {0x00101, 4}, {0x00101, 4},  
         {0x00003, 4}, {0x00003, 4}, {0x00003, 4}, {0x00003, 4},  
         {0x00003, 4}, {0x00003, 4}, {0x00003, 4}, {0x00003, 4}  
 };  
   
   
 VLC DCT3Dtab4[] = {  
         {0x00012,10}, {0x00011,10}, {0x10e01, 9}, {0x10e01, 9},  
         {0x10d01, 9}, {0x10d01, 9}, {0x10c01, 9}, {0x10c01, 9},  
         {0x10b01, 9}, {0x10b01, 9}, {0x10a01, 9}, {0x10a01, 9},  
         {0x10102, 9}, {0x10102, 9}, {0x10004, 9}, {0x10004, 9},  
         {0x00c01, 9}, {0x00c01, 9}, {0x00b01, 9}, {0x00b01, 9},  
         {0x00702, 9}, {0x00702, 9}, {0x00602, 9}, {0x00602, 9},  
         {0x00502, 9}, {0x00502, 9}, {0x00303, 9}, {0x00303, 9},  
         {0x00203, 9}, {0x00203, 9}, {0x00106, 9}, {0x00106, 9},  
         {0x00105, 9}, {0x00105, 9}, {0x00010, 9}, {0x00010, 9},  
         {0x00402, 9}, {0x00402, 9}, {0x0000f, 9}, {0x0000f, 9},  
         {0x0000e, 9}, {0x0000e, 9}, {0x0000d, 9}, {0x0000d, 9},  
         {0x10801, 8}, {0x10801, 8}, {0x10801, 8}, {0x10801, 8},  
         {0x10701, 8}, {0x10701, 8}, {0x10701, 8}, {0x10701, 8},  
         {0x10601, 8}, {0x10601, 8}, {0x10601, 8}, {0x10601, 8},  
         {0x10003, 8}, {0x10003, 8}, {0x10003, 8}, {0x10003, 8},  
         {0x00a01, 8}, {0x00a01, 8}, {0x00a01, 8}, {0x00a01, 8},  
         {0x00901, 8}, {0x00901, 8}, {0x00901, 8}, {0x00901, 8},  
         {0x00801, 8}, {0x00801, 8}, {0x00801, 8}, {0x00801, 8},  
         {0x10901, 8}, {0x10901, 8}, {0x10901, 8}, {0x10901, 8},  
         {0x00302, 8}, {0x00302, 8}, {0x00302, 8}, {0x00302, 8},  
         {0x00104, 8}, {0x00104, 8}, {0x00104, 8}, {0x00104, 8},  
         {0x0000c, 8}, {0x0000c, 8}, {0x0000c, 8}, {0x0000c, 8},  
         {0x0000b, 8}, {0x0000b, 8}, {0x0000b, 8}, {0x0000b, 8},  
         {0x0000a, 8}, {0x0000a, 8}, {0x0000a, 8}, {0x0000a, 8}  
 };  
   
 VLC DCT3Dtab5[] = {  
         {0x10007,11}, {0x10007,11}, {0x10006,11}, {0x10006,11},  
         {0x00016,11}, {0x00016,11}, {0x00015,11}, {0x00015,11},  
         {0x10202,10}, {0x10202,10}, {0x10202,10}, {0x10202,10},  
         {0x10103,10}, {0x10103,10}, {0x10103,10}, {0x10103,10},  
         {0x10005,10}, {0x10005,10}, {0x10005,10}, {0x10005,10},  
         {0x00d01,10}, {0x00d01,10}, {0x00d01,10}, {0x00d01,10},  
         {0x00503,10}, {0x00503,10}, {0x00503,10}, {0x00503,10},  
         {0x00802,10}, {0x00802,10}, {0x00802,10}, {0x00802,10},  
         {0x00403,10}, {0x00403,10}, {0x00403,10}, {0x00403,10},  
         {0x00304,10}, {0x00304,10}, {0x00304,10}, {0x00304,10},  
         {0x00204,10}, {0x00204,10}, {0x00204,10}, {0x00204,10},  
         {0x00107,10}, {0x00107,10}, {0x00107,10}, {0x00107,10},  
         {0x00014,10}, {0x00014,10}, {0x00014,10}, {0x00014,10},  
         {0x00013,10}, {0x00013,10}, {0x00013,10}, {0x00013,10},  
         {0x00017,11}, {0x00017,11}, {0x00018,11}, {0x00018,11},  
         {0x00108,11}, {0x00108,11}, {0x00902,11}, {0x00902,11},  
         {0x10302,11}, {0x10302,11}, {0x10402,11}, {0x10402,11},  
         {0x10f01,11}, {0x10f01,11}, {0x11001,11}, {0x11001,11},  
         {0x00019,12}, {0x0001a,12}, {0x0001b,12}, {0x00109,12},  
         {0x00603,12}, {0x0010a,12}, {0x00205,12}, {0x00703,12},  
         {0x00e01,12}, {0x10008,12}, {0x10502,12}, {0x10602,12},  
         {0x11101,12}, {0x11201,12}, {0x11301,12}, {0x11401,12},  
         {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},  
         {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},  
         {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},  
         {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},  
         {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},  
         {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},  
         {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},  
         {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}  
 };  
   
 VLC ERRtab[] = {  
         {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},  
         {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},  
         {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},  
         {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0},  
         {VLC_ERROR, 0}, {VLC_ERROR, 0}, {VLC_ERROR, 0}  
881  };  };
882    
883  static const VLC dc_lum_tab[] = {  static VLC const dc_lum_tab[] = {
884          {0, 0},          {0, 0}, {4, 3}, {3, 3}, {0, 3},
         {4, 3}, {3, 3}, {0, 3},  
885          {2, 2}, {2, 2}, {1, 2}, {1, 2},          {2, 2}, {2, 2}, {1, 2}, {1, 2},
886  };  };
887    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.13

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