1 /*
2 * Copyright (c) 2003 Michael Niedermayer
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 /**
22 * @file
23 * ASUS V1/V2 decoder.
24 */
25
28
36
38 #define ASV2_LEVEL_VLC_BITS 10
39
45
47 {
48 static int done = 0;
49
50 if (!done) {
51 done = 1;
52
68 }
69 }
70
71 // FIXME write a reversed bitstream reader to avoid the double reverse
73 {
75 }
76
78 {
80
81 if (code == 3)
83 else
84 return code - 3;
85 }
86
88 {
90
91 if (code == 31)
93 else
94 return code - 31;
95 }
96
98 {
99 int i;
100
102
103 for (i = 0; i < 11; i++) {
105
106 if (ccp) {
107 if (ccp == 16)
108 break;
109 if (ccp < 0 || i >= 10) {
112 }
113
114 if (ccp & 8)
116 if (ccp & 4)
118 if (ccp & 2)
120 if (ccp & 1)
122 }
123 }
124
125 return 0;
126 }
127
129 {
131
133
135
137 if (ccp) {
138 if (ccp & 4)
140 if (ccp & 2)
142 if (ccp & 1)
144 }
145
146 for (i = 1; i < count + 1; i++) {
148
149 if (ccp) {
150 if (ccp & 8)
152 if (ccp & 4)
154 if (ccp & 2)
156 if (ccp & 1)
158 }
159 }
160
161 return 0;
162 }
163
165 {
166 int i;
167
169
171 for (i = 0; i < 6; i++) {
173 return -1;
174 }
175 } else {
176 for (i = 0; i < 6; i++) {
178 return -1;
179 }
180 }
181 return 0;
182 }
183
185 {
188
189 uint8_t *dest_y = frame->
data[0] + (mb_y * 16 * linesize) + mb_x * 16;
192
197
201 }
202 }
203
206 {
209 int buf_size = avpkt->
size;
212
217
219 buf_size);
222
225 (const uint32_t *) buf, buf_size / 4);
226 } else {
227 int i;
228 for (i = 0; i < buf_size; i++)
230 }
231
233
234 for (mb_y = 0; mb_y < a->
mb_height2; mb_y++) {
235 for (mb_x = 0; mb_x < a->
mb_width2; mb_x++) {
238
240 }
241 }
242
245 for (mb_y = 0; mb_y < a->
mb_height2; mb_y++) {
248
250 }
251 }
252
255 for (mb_x = 0; mb_x < a->
mb_width; mb_x++) {
258
260 }
261 }
262
263 *got_frame = 1;
264
265 emms_c();
266
268 }
269
271 {
274 int i;
275
278 }
279
286
291 else
293 }
294
295 for (i = 0; i < 64; i++) {
297
300 }
301
302 return 0;
303 }
304
306 {
308
311
312 return 0;
313 }
314
315 #if CONFIG_ASV1_DECODER
326 };
327 #endif
328
329 #if CONFIG_ASV2_DECODER
340 };
341 #endif