[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.11, Sat Oct 19 11:41:11 2002 UTC revision 1.15, Sat Feb 15 15:22:18 2003 UTC
# Line 1  Line 1 
 /*****************************************************************************  
  *  
  *  XVID MPEG-4 VIDEO CODEC  
  *  - Vector Length Coding tables -  
  *  
  *  Copyright(C) 2002 Michael Militzer <isibaar@xvid.org>  
  *  
  *  
  *  This program is an implementation of a part of one or more MPEG-4  
  *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending  
  *  to use this software module in hardware or software products are  
  *  advised that its use may infringe existing patents or copyrights, and  
  *  any such use would be at such party's own risk.  The original  
  *  developer of this software module and his/her company, and subsequent  
  *  editors and their companies, will have no liability for use of this  
  *  software or modifications or derivatives thereof.  
  *  
  *  This program is free software; you can redistribute it and/or modify  
  *  it under the terms of the GNU General Public License as published by  
  *  the Free Software Foundation; either version 2 of the License, or  
  *  (at your option) any later version.  
  *  
  *  This program is distributed in the hope that it will be useful,  
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of  
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  *  GNU General Public License for more details.  
  *  
  *  You should have received a copy of the GNU General Public License  
  *  along with this program; if not, write to the Free Software  
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  
  *  
  * $Id$  
  *  
  ****************************************************************************/  
   
1  #ifndef _VLC_CODES_H_  #ifndef _VLC_CODES_H_
2  #define _VLC_CODES_H_  #define _VLC_CODES_H_
3    
4  #include "../portab.h"  #include "../portab.h"
 #include "mbcoding.h"  
5    
6  #define VLC_ERROR       (-1)  #define VLC_ERROR       (-1)
 #define ESCAPE 7167  
7    
8  /*****************************************************************************  #define ESCAPE  3
9   * The Vector Length Coding structure  #define ESCAPE1 6
10   ****************************************************************************/  #define ESCAPE2 14
11    #define ESCAPE3 15
12    
13  typedef struct  typedef struct
14  {  {
15          uint32_t code;          uint32_t code;
16          int8_t len;          uint8_t len;
17  }  }
18  VLC;  VLC;
19    
20  static VLC *DCT3D[2];  typedef struct
21    {
22            uint8_t last;
23            uint8_t run;
24            int8_t level;
25    }
26    EVENT;
27    
28  /*****************************************************************************  typedef struct
29   * common tables between encoder/decoder  {
30   ****************************************************************************/          uint8_t len;
31            EVENT event;
32    }
33    REVERSE_EVENT;
34    
35  /* constants taken from momusys/vm_common/inlcude/max_level.h */  typedef struct
 static char const max_level[4][64] = {  
         /* intra, last = 0 */  
36          {          {
37           27, 10, 5, 4, 3, 3, 3, 3,          VLC vlc;
38           2, 2, 1, 1, 1, 1, 1, 0,          EVENT event;
39           0, 0, 0, 0, 0, 0, 0, 0,  }
40           0, 0, 0, 0, 0, 0, 0, 0,  VLC_TABLE;
41           0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0  
          },  
42    
43          /* intra, last = 1 */  /******************************************************************
44     * common tables between encoder/decoder                          *
45     ******************************************************************/
46    
47    static VLC_TABLE const coeff_tab[2][102] =
48          {          {
49           8, 3, 2, 2, 2, 2, 2, 1,          /* intra = 0 */
50           1, 1, 1, 1, 1, 1, 1, 1,          {
51           1, 1, 1, 1, 1, 0, 0, 0,                  {{ 2,  2}, {0, 0, 1}},
52           0, 0, 0, 0, 0, 0, 0, 0,                  {{15,  4}, {0, 0, 2}},
53           0, 0, 0, 0, 0, 0, 0, 0,                  {{21,  6}, {0, 0, 3}},
54           0, 0, 0, 0, 0, 0, 0, 0,                  {{23,  7}, {0, 0, 4}},
55           0, 0, 0, 0, 0, 0, 0, 0,                  {{31,  8}, {0, 0, 5}},
56           0, 0, 0, 0, 0, 0, 0, 0                  {{37,  9}, {0, 0, 6}},
57                    {{36,  9}, {0, 0, 7}},
58                    {{33, 10}, {0, 0, 8}},
59                    {{32, 10}, {0, 0, 9}},
60                    {{ 7, 11}, {0, 0, 10}},
61                    {{ 6, 11}, {0, 0, 11}},
62                    {{32, 11}, {0, 0, 12}},
63                    {{ 6,  3}, {0, 1, 1}},
64                    {{20,  6}, {0, 1, 2}},
65                    {{30,  8}, {0, 1, 3}},
66                    {{15, 10}, {0, 1, 4}},
67                    {{33, 11}, {0, 1, 5}},
68                    {{80, 12}, {0, 1, 6}},
69                    {{14,  4}, {0, 2, 1}},
70                    {{29,  8}, {0, 2, 2}},
71                    {{14, 10}, {0, 2, 3}},
72                    {{81, 12}, {0, 2, 4}},
73                    {{13,  5}, {0, 3, 1}},
74                    {{35,  9}, {0, 3, 2}},
75                    {{13, 10}, {0, 3, 3}},
76                    {{12,  5}, {0, 4, 1}},
77                    {{34,  9}, {0, 4, 2}},
78                    {{82, 12}, {0, 4, 3}},
79                    {{11,  5}, {0, 5, 1}},
80                    {{12, 10}, {0, 5, 2}},
81                    {{83, 12}, {0, 5, 3}},
82                    {{19,  6}, {0, 6, 1}},
83                    {{11, 10}, {0, 6, 2}},
84                    {{84, 12}, {0, 6, 3}},
85                    {{18,  6}, {0, 7, 1}},
86                    {{10, 10}, {0, 7, 2}},
87                    {{17,  6}, {0, 8, 1}},
88                    {{ 9, 10}, {0, 8, 2}},
89                    {{16,  6}, {0, 9, 1}},
90                    {{ 8, 10}, {0, 9, 2}},
91                    {{22,  7}, {0, 10, 1}},
92                    {{85, 12}, {0, 10, 2}},
93                    {{21,  7}, {0, 11, 1}},
94                    {{20,  7}, {0, 12, 1}},
95                    {{28,  8}, {0, 13, 1}},
96                    {{27,  8}, {0, 14, 1}},
97                    {{33,  9}, {0, 15, 1}},
98                    {{32,  9}, {0, 16, 1}},
99                    {{31,  9}, {0, 17, 1}},
100                    {{30,  9}, {0, 18, 1}},
101                    {{29,  9}, {0, 19, 1}},
102                    {{28,  9}, {0, 20, 1}},
103                    {{27,  9}, {0, 21, 1}},
104                    {{26,  9}, {0, 22, 1}},
105                    {{34, 11}, {0, 23, 1}},
106                    {{35, 11}, {0, 24, 1}},
107                    {{86, 12}, {0, 25, 1}},
108                    {{87, 12}, {0, 26, 1}},
109                    {{ 7,  4}, {1, 0, 1}},
110                    {{25,  9}, {1, 0, 2}},
111                    {{ 5, 11}, {1, 0, 3}},
112                    {{15,  6}, {1, 1, 1}},
113                    {{ 4, 11}, {1, 1, 2}},
114                    {{14,  6}, {1, 2, 1}},
115                    {{13,  6}, {1, 3, 1}},
116                    {{12,  6}, {1, 4, 1}},
117                    {{19,  7}, {1, 5, 1}},
118                    {{18,  7}, {1, 6, 1}},
119                    {{17,  7}, {1, 7, 1}},
120                    {{16,  7}, {1, 8, 1}},
121                    {{26,  8}, {1, 9, 1}},
122                    {{25,  8}, {1, 10, 1}},
123                    {{24,  8}, {1, 11, 1}},
124                    {{23,  8}, {1, 12, 1}},
125                    {{22,  8}, {1, 13, 1}},
126                    {{21,  8}, {1, 14, 1}},
127                    {{20,  8}, {1, 15, 1}},
128                    {{19,  8}, {1, 16, 1}},
129                    {{24,  9}, {1, 17, 1}},
130                    {{23,  9}, {1, 18, 1}},
131                    {{22,  9}, {1, 19, 1}},
132                    {{21,  9}, {1, 20, 1}},
133                    {{20,  9}, {1, 21, 1}},
134                    {{19,  9}, {1, 22, 1}},
135                    {{18,  9}, {1, 23, 1}},
136                    {{17,  9}, {1, 24, 1}},
137                    {{ 7, 10}, {1, 25, 1}},
138                    {{ 6, 10}, {1, 26, 1}},
139                    {{ 5, 10}, {1, 27, 1}},
140                    {{ 4, 10}, {1, 28, 1}},
141                    {{36, 11}, {1, 29, 1}},
142                    {{37, 11}, {1, 30, 1}},
143                    {{38, 11}, {1, 31, 1}},
144                    {{39, 11}, {1, 32, 1}},
145                    {{88, 12}, {1, 33, 1}},
146                    {{89, 12}, {1, 34, 1}},
147                    {{90, 12}, {1, 35, 1}},
148                    {{91, 12}, {1, 36, 1}},
149                    {{92, 12}, {1, 37, 1}},
150                    {{93, 12}, {1, 38, 1}},
151                    {{94, 12}, {1, 39, 1}},
152                    {{95, 12}, {1, 40, 1}}
153           },           },
154            /* intra = 1 */
155            {
156                    {{ 2,  2}, {0, 0, 1}},
157                    {{15,  4}, {0, 0, 3}},
158                    {{21,  6}, {0, 0, 6}},
159                    {{23,  7}, {0, 0, 9}},
160                    {{31,  8}, {0, 0, 10}},
161                    {{37,  9}, {0, 0, 13}},
162                    {{36,  9}, {0, 0, 14}},
163                    {{33, 10}, {0, 0, 17}},
164                    {{32, 10}, {0, 0, 18}},
165                    {{ 7, 11}, {0, 0, 21}},
166                    {{ 6, 11}, {0, 0, 22}},
167                    {{32, 11}, {0, 0, 23}},
168                    {{ 6,  3}, {0, 0, 2}},
169                    {{20,  6}, {0, 1, 2}},
170                    {{30,  8}, {0, 0, 11}},
171                    {{15, 10}, {0, 0, 19}},
172                    {{33, 11}, {0, 0, 24}},
173                    {{80, 12}, {0, 0, 25}},
174                    {{14,  4}, {0, 1, 1}},
175                    {{29,  8}, {0, 0, 12}},
176                    {{14, 10}, {0, 0, 20}},
177                    {{81, 12}, {0, 0, 26}},
178                    {{13,  5}, {0, 0, 4}},
179                    {{35,  9}, {0, 0, 15}},
180                    {{13, 10}, {0, 1, 7}},
181                    {{12,  5}, {0, 0, 5}},
182                    {{34,  9}, {0, 4, 2}},
183                    {{82, 12}, {0, 0, 27}},
184                    {{11,  5}, {0, 2, 1}},
185                    {{12, 10}, {0, 2, 4}},
186                    {{83, 12}, {0, 1, 9}},
187                    {{19,  6}, {0, 0, 7}},
188                    {{11, 10}, {0, 3, 4}},
189                    {{84, 12}, {0, 6, 3}},
190                    {{18,  6}, {0, 0, 8}},
191                    {{10, 10}, {0, 4, 3}},
192                    {{17,  6}, {0, 3, 1}},
193                    {{ 9, 10}, {0, 8, 2}},
194                    {{16,  6}, {0, 4, 1}},
195                    {{ 8, 10}, {0, 5, 3}},
196                    {{22,  7}, {0, 1, 3}},
197                    {{85, 12}, {0, 1, 10}},
198                    {{21,  7}, {0, 2, 2}},
199                    {{20,  7}, {0, 7, 1}},
200                    {{28,  8}, {0, 1, 4}},
201                    {{27,  8}, {0, 3, 2}},
202                    {{33,  9}, {0, 0, 16}},
203                    {{32,  9}, {0, 1, 5}},
204                    {{31,  9}, {0, 1, 6}},
205                    {{30,  9}, {0, 2, 3}},
206                    {{29,  9}, {0, 3, 3}},
207                    {{28,  9}, {0, 5, 2}},
208                    {{27,  9}, {0, 6, 2}},
209                    {{26,  9}, {0, 7, 2}},
210                    {{34, 11}, {0, 1, 8}},
211                    {{35, 11}, {0, 9, 2}},
212                    {{86, 12}, {0, 2, 5}},
213                    {{87, 12}, {0, 7, 3}},
214                    {{ 7,  4}, {1, 0, 1}},
215                    {{25,  9}, {0, 11, 1}},
216                    {{ 5, 11}, {1, 0, 6}},
217                    {{15,  6}, {1, 1, 1}},
218                    {{ 4, 11}, {1, 0, 7}},
219                    {{14,  6}, {1, 2, 1}},
220                    {{13,  6}, {0, 5, 1}},
221                    {{12,  6}, {1, 0, 2}},
222                    {{19,  7}, {1, 5, 1}},
223                    {{18,  7}, {0, 6, 1}},
224                    {{17,  7}, {1, 3, 1}},
225                    {{16,  7}, {1, 4, 1}},
226                    {{26,  8}, {1, 9, 1}},
227                    {{25,  8}, {0, 8, 1}},
228                    {{24,  8}, {0, 9, 1}},
229                    {{23,  8}, {0, 10, 1}},
230                    {{22,  8}, {1, 0, 3}},
231                    {{21,  8}, {1, 6, 1}},
232                    {{20,  8}, {1, 7, 1}},
233                    {{19,  8}, {1, 8, 1}},
234                    {{24,  9}, {0, 12, 1}},
235                    {{23,  9}, {1, 0, 4}},
236                    {{22,  9}, {1, 1, 2}},
237                    {{21,  9}, {1, 10, 1}},
238                    {{20,  9}, {1, 11, 1}},
239                    {{19,  9}, {1, 12, 1}},
240                    {{18,  9}, {1, 13, 1}},
241                    {{17,  9}, {1, 14, 1}},
242                    {{ 7, 10}, {0, 13, 1}},
243                    {{ 6, 10}, {1, 0, 5}},
244                    {{ 5, 10}, {1, 1, 3}},
245                    {{ 4, 10}, {1, 2, 2}},
246                    {{36, 11}, {1, 3, 2}},
247                    {{37, 11}, {1, 4, 2}},
248                    {{38, 11}, {1, 15, 1}},
249                    {{39, 11}, {1, 16, 1}},
250                    {{88, 12}, {0, 14, 1}},
251                    {{89, 12}, {1, 0, 8}},
252                    {{90, 12}, {1, 5, 2}},
253                    {{91, 12}, {1, 6, 2}},
254                    {{92, 12}, {1, 17, 1}},
255                    {{93, 12}, {1, 18, 1}},
256                    {{94, 12}, {1, 19, 1}},
257                    {{95, 12}, {1, 20, 1}}
258            }
259    };
260    
261          /* inter, last = 0 */  /* constants taken from momusys/vm_common/inlcude/max_level.h */
262    static uint8_t const max_level[2][2][64] = {
263            {
264                    /* intra = 0, last = 0 */
265          {          {
266           12, 6, 4, 3, 3, 3, 3, 2,           12, 6, 4, 3, 3, 3, 3, 2,
267           2, 2, 2, 1, 1, 1, 1, 1,           2, 2, 2, 1, 1, 1, 1, 1,
# Line 97  Line 272 
272           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
273           0, 0, 0, 0, 0, 0, 0, 0           0, 0, 0, 0, 0, 0, 0, 0
274           },           },
275                    /* intra = 0, last = 1 */
         /* inter, last = 1 */  
276          {          {
277           3, 2, 1, 1, 1, 1, 1, 1,           3, 2, 1, 1, 1, 1, 1, 1,
278           1, 1, 1, 1, 1, 1, 1, 1,           1, 1, 1, 1, 1, 1, 1, 1,
# Line 109  Line 283 
283           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
284           0, 0, 0, 0, 0, 0, 0, 0           0, 0, 0, 0, 0, 0, 0, 0
285           }           }
286  };          },
   
 static char const max_run[4][256] = {  
         /* intra, last = 0 */  
287          {          {
288           0, 14, 9, 7, 3, 2, 1, 1,                  /* intra = 1, last = 0 */
289           1, 1, 1, 0, 0, 0, 0, 0,                  {
290           0, 0, 0, 0, 0, 0, 0, 0,                          27, 10, 5, 4, 3, 3, 3, 3,
291           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,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
292           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
293           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
294           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
# Line 147  Line 296 
296           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
297           0, 0, 0, 0, 0, 0, 0, 0           0, 0, 0, 0, 0, 0, 0, 0
298           },           },
299                    /* intra = 1, last = 1 */
         /* intra, last = 1 */  
300          {          {
301           0, 20, 6, 1, 0, 0, 0, 0,                          8, 3, 2, 2, 2, 2, 2, 1,
302           0, 0, 0, 0, 0, 0, 0, 0,                          1, 1, 1, 1, 1, 1, 1, 1,
303           0, 0, 0, 0, 0, 0, 0, 0,                          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,  
304           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
305           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
306           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
307           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
308           0, 0, 0, 0, 0, 0, 0, 0           0, 0, 0, 0, 0, 0, 0, 0
309           },                  }
310            }
311    };
312    
313          /* inter, last = 0 */  static uint8_t const max_run[2][2][64] = {
314            {
315                    /* intra = 0, last = 0 */
316          {          {
317           0, 26, 10, 6, 2, 1, 1, 0,           0, 26, 10, 6, 2, 1, 1, 0,
318           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
# Line 194  Line 322 
322           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
323           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
324           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0  
325           },           },
326                    /* intra = 0, last = 1 */
         /* inter, last = 1 */  
327          {          {
328           0, 40, 1, 0, 0, 0, 0, 0,           0, 40, 1, 0, 0, 0, 0, 0,
329           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
# Line 230  Line 333 
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           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
336                    }
337            },
338            {
339                    /* intra = 1, last = 0 */
340                    {
341                            0, 14, 9, 7, 3, 2, 1, 1,
342                            1, 1, 1, 0, 0, 0, 0, 0,
343           0, 0, 0, 0, 0, 0, 0, 0,           0, 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           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
347           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
348           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
349                    },
350                    /* intra = 1, last = 1 */
351                    {
352                            0, 20, 6, 1, 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,
# Line 243  Line 357 
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,           0, 0, 0, 0, 0, 0, 0, 0,
359           0, 0, 0, 0, 0, 0, 0, 0,           0, 0, 0, 0, 0, 0, 0, 0,
360           0, 0, 0, 0, 0, 0, 0, 0,                  }
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0,  
          0, 0, 0, 0, 0, 0, 0, 0  
361           }           }
362  };  };
363    
   
364  /******************************************************************  /******************************************************************
365   * encoder tables                                                 *   * encoder tables                                                 *
366   ******************************************************************/   ******************************************************************/
367    
368  /* DCT coefficients. Four tables, two for last = 0, two for last = 1.  static VLC sprite_trajectory_code[32768];
    the sign bit must be added afterwards. */  
   
 /* first part of coeffs for last = 0. Indexed by [run][level-1] */  
   
 static VLC const coeff_tab0[2][12] = {  
         /* run = 0  */  
         {  
                 {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] */  
   
 static VLC const coeff_tab1[25][4] = {  
         /* First row is run=2, then each row is run 2 + index */  
         {{0x0e, 4}, {0x1d, 8}, {0x0e, 10}, {0x51, 12}},  
         {{0x0d, 5}, {0x23, 9},  {0x0d, 10}, {0x00, 0}},  
         {{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 const 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 const 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 const 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 const coeff_tab5[10] = {  
         {0x0e, 4}, {0x14, 6},  {0x16, 7},  {0x1c, 8},  {0x20, 9},  
         {0x1f, 9}, {0x0d, 10}, {0x22, 11}, {0x53, 12}, {0x55, 12}  
 };  
369    
370  /* Coeffs for last = 0, run = 2 -> 9. Indexed by [run-2][level-1] */  static VLC sprite_trajectory_len[15] = {
371            { 0x00 , 2},
372            { 0x02 , 3}, { 0x03, 3}, { 0x04, 3}, { 0x05, 3}, { 0x06, 3},
373            { 0x0E , 4}, { 0x1E, 5}, { 0x3E, 6}, { 0x7F, 7}, { 0xFE, 8},
374            { 0x1FE, 9}, {0x3FE,10}, {0x7FE,11}, {0xFFE,12} };
375    
 static VLC coeff_tab6[8][5] = {  
         /* run = 2 */  
         {{0x0b, 5}, {0x15, 7}, {0x1e, 9}, {0x0c, 10}, {0x56, 12}},  
376    
377          /* run = 3 */  /* DCT coefficients. Four tables, two for last = 0, two for last = 1.
378          {{0x11, 6}, {0x1b, 8}, {0x1d, 9}, {0x0b, 10}, {0x00, 0}},     the sign bit must be added afterwards. */
   
         /* 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 const 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 const 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 const 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 const 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 const *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 const *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],  
 };  
   
 static VLC const *coeff_inter_last0[27] = {  
         coeff_tab0[0],  
         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 const *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 const **coeff_vlc[4] = {  
         coeff_intra_last0,  
         coeff_intra_last1,  
         coeff_inter_last0,  
         coeff_inter_last1,  
 };  
379    
380  /*  /* MCBPC Indexing by cbpc in first two bits, mode in last two.
381   * MCBPC Indexing by cbpc in first two bits, mode in last two.   CBPC as in table 4/H.263, MB type (mode): 3 = 01, 4 = 10.
382   * CBPC as in table 4/H.263, MB type (mode): 3 = 01, 4 = 10.   Example: cbpc = 01 and mode = 4 gives index = 0110 = 6. */
  * Example: cbpc = 01 and mode = 4 gives index = 0110 = 6.  
  */  
383    
384  static VLC const mcbpc_intra_tab[15] = {  static VLC mcbpc_intra_tab[15] = {
385          {0x01, 9}, {0x01, 1}, {0x01, 4}, {0x00, 0},          {0x01, 9}, {0x01, 1}, {0x01, 4}, {0x00, 0},
386          {0x00, 0}, {0x01, 3}, {0x01, 6}, {0x00, 0},          {0x00, 0}, {0x01, 3}, {0x01, 6}, {0x00, 0},
387          {0x00, 0}, {0x02, 3}, {0x02, 6}, {0x00, 0},          {0x00, 0}, {0x02, 3}, {0x02, 6}, {0x00, 0},
# Line 593  Line 391 
391  /* MCBPC inter.  /* MCBPC inter.
392     Addressing: 5 bit ccmmm (cc = CBPC, mmm = mode (1-4 binary)) */     Addressing: 5 bit ccmmm (cc = CBPC, mmm = mode (1-4 binary)) */
393    
394  static VLC const mcbpc_inter_tab[29] = {  static VLC mcbpc_inter_tab[29] = {
395          {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},
396          {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},
397          {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},
398          {5, 6}, {5, 9}, {5, 8}, {3, 7}, {2, 9}          {5, 6}, {5, 9}, {5, 8}, {3, 7}, {2, 9}
399  };  };
400    
401  static VLC const cbpy_tab[16] = {  static const VLC cbpy_tab[16] = {
402          {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},
403          {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}
404  };  };
405    
406  static VLC const dcy_tab[511] = {  static const VLC dcy_tab[511] = {
407          {0x100, 15}, {0x101, 15}, {0x102, 15}, {0x103, 15},          {0x100, 15}, {0x101, 15}, {0x102, 15}, {0x103, 15},
408          {0x104, 15}, {0x105, 15}, {0x106, 15}, {0x107, 15},          {0x104, 15}, {0x105, 15}, {0x106, 15}, {0x107, 15},
409          {0x108, 15}, {0x109, 15}, {0x10a, 15}, {0x10b, 15},          {0x108, 15}, {0x109, 15}, {0x10a, 15}, {0x10b, 15},
# Line 736  Line 534 
534          {0x1fd, 15}, {0x1fe, 15}, {0x1ff, 15},          {0x1fd, 15}, {0x1fe, 15}, {0x1ff, 15},
535  };  };
536    
537  static VLC const dcc_tab[511] = {  static const VLC dcc_tab[511] = {
538          {0x100, 16}, {0x101, 16}, {0x102, 16}, {0x103, 16},          {0x100, 16}, {0x101, 16}, {0x102, 16}, {0x103, 16},
539          {0x104, 16}, {0x105, 16}, {0x106, 16}, {0x107, 16},          {0x104, 16}, {0x105, 16}, {0x106, 16}, {0x107, 16},
540          {0x108, 16}, {0x109, 16}, {0x10a, 16}, {0x10b, 16},          {0x108, 16}, {0x109, 16}, {0x10a, 16}, {0x10b, 16},
# Line 868  Line 666 
666  };  };
667    
668    
669  static VLC const mb_motion_table[65] = {  static const VLC mb_motion_table[65] = {
670          {0x05, 13}, {0x07, 13}, {0x05, 12}, {0x07, 12},          {0x05, 13}, {0x07, 13}, {0x05, 12}, {0x07, 12},
671          {0x09, 12}, {0x0b, 12}, {0x0d, 12}, {0x0f, 12},          {0x09, 12}, {0x0b, 12}, {0x0d, 12}, {0x0f, 12},
672          {0x09, 11}, {0x0b, 11}, {0x0d, 11}, {0x0f, 11},          {0x09, 11}, {0x0b, 11}, {0x0d, 11}, {0x0f, 11},
# Line 904  Line 702 
702          {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}
703  };  };
704    
   
705  static VLC const mcbpc_inter_table[257] = {  static VLC const mcbpc_inter_table[257] = {
706          {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},
707          {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 952  Line 749 
749          {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}
750  };  };
751    
   
752  static VLC const TMNMVtab0[] = {  static VLC const TMNMVtab0[] = {
753          {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},
754          {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 1019  Line 815 
815          {-13, 10}, {-13, 10}, {-13, 10}, {-13, 10}          {-13, 10}, {-13, 10}, {-13, 10}, {-13, 10}
816  };  };
817    
   
 static VLC const DCT3Dtab0[] = {  
         {4225, 7}, {4209, 7}, {4193, 7}, {4177, 7}, {193, 7}, {177, 7},  
         {161, 7}, {4, 7}, {4161, 6}, {4161, 6}, {4145, 6}, {4145, 6},  
         {4129, 6}, {4129, 6}, {4113, 6}, {4113, 6}, {145, 6}, {145, 6},  
         {129, 6}, {129, 6}, {113, 6}, {113, 6}, {97, 6}, {97, 6},  
         {18, 6}, {18, 6}, {3, 6}, {3, 6}, {81, 5}, {81, 5},  
         {81, 5}, {81, 5}, {65, 5}, {65, 5}, {65, 5}, {65, 5},  
         {49, 5}, {49, 5}, {49, 5}, {49, 5}, {4097, 4}, {4097, 4},  
         {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}  
 };  
   
   
 static VLC const 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}  
 };  
   
 static VLC const 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 */  
   
 static VLC const 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}  
 };  
   
   
 static VLC const 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}  
 };  
   
 static VLC const 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}  
 };  
   
818  static short const dc_threshold[] = {  static short const dc_threshold[] = {
819          26708,   29545,   25120,   28265,   29281,    8313,   29557,   29541,          21514, 26984,  8307, 28531, 29798, 24951, 25970, 26912,
820          18208,   21838,   18208,   19536,   29472,   26223,   30580,   29281,           8307, 25956, 26994, 25974,  8292, 29286, 28015, 29728,
821           8293,   25956,   26994,   25974,    8292,   29286,   28015,   22560,          25960, 18208, 21838, 18208, 19536, 22560, 26998,  8260,
822          18774,    8260,   20557,   18245,    8244,   26664,   29812,   14960,          28515, 25956,  8291, 25640, 30309, 27749, 11817, 22794,
823          12079,   30583,   11895,   30328,   25705,   28462,   26482,   29472,          30063,  8306, 28531, 29798, 24951, 25970, 25632, 29545,
824          30063,   25458,   29541,    8233,   29505,    8299,   28518,    8306,          29300, 25193, 29813, 29295, 26656, 29537, 29728,  8303,
825          26740,    8293,   28531,   29301,   25955,    8307,   28532,   31008,          26983, 25974, 24864, 25443, 29541,  8307, 28532, 26912,
826          30063,    8306,   26980,   29811,   26994,   30050,   28532,    2674          29556, 29472, 30063, 25458,  8293, 28515, 25956,  2606
 };  
   
   
 static VLC const 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}  
827  };  };
828    
829  static VLC const dc_lum_tab[] = {  static VLC const dc_lum_tab[] = {

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

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