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
34
36 #define ASV2_LEVEL_VLC_BITS 10
37
43
45 {
46 static int done = 0;
47
48 if (!done) {
49 done = 1;
50
66 }
67 }
68
69 //FIXME write a reversed bitstream reader to avoid the double reverse
71 {
73 }
74
76 {
78
79 if (code == 3)
81 else
82 return code - 3;
83 }
84
86 {
88
89 if (code == 31)
91 else
92 return code - 31;
93 }
94
96 {
97 int i;
98
100
101 for (i = 0; i < 11; i++) {
103
104 if (ccp) {
105 if (ccp == 16)
106 break;
107 if (ccp < 0 || i >= 10) {
110 }
111
112 if (ccp & 8)
114 if (ccp & 4)
116 if (ccp & 2)
118 if (ccp & 1)
120 }
121 }
122
123 return 0;
124 }
125
127 {
129
131
133
135 if (ccp) {
136 if (ccp & 4)
138 if (ccp & 2)
140 if (ccp & 1)
142 }
143
144 for (i = 1; i < count + 1; i++) {
146
147 if (ccp) {
148 if (ccp & 8)
150 if (ccp & 4)
152 if (ccp & 2)
154 if (ccp & 1)
156 }
157 }
158
159 return 0;
160 }
161
163 {
164 int i;
165
167
169 for (i = 0; i < 6; i++) {
171 return -1;
172 }
173 } else {
174 for (i = 0; i < 6; i++) {
176 return -1;
177 }
178 }
179 return 0;
180 }
181
183 {
186
187 uint8_t *dest_y = frame->
data[0] + (mb_y * 16* linesize ) + mb_x * 16;
190
195
199 }
200 }
201
203 void *
data,
int *got_frame,
205 {
208 int buf_size = avpkt->
size;
211
216
218 buf_size);
221
224 else {
225 int i;
226 for (i = 0; i < buf_size; i++)
228 }
229
231
232 for (mb_y = 0; mb_y < a->
mb_height2; mb_y++) {
233 for (mb_x = 0; mb_x < a->
mb_width2; mb_x++) {
236
238 }
239 }
240
243 for (mb_y = 0; mb_y < a->
mb_height2; mb_y++) {
246
248 }
249 }
250
253 for (mb_x = 0; mb_x < a->
mb_width; mb_x++) {
256
258 }
259 }
260
261 *got_frame = 1;
262
264
266 }
267
269 {
272 int i;
273
276 }
277
282
287 else
289 }
290
291 for (i = 0; i < 64; i++) {
293
295 }
296
297 return 0;
298 }
299
301 {
303
306
307 return 0;
308 }
309
310 #if CONFIG_ASV1_DECODER
321 };
322 #endif
323
324 #if CONFIG_ASV2_DECODER
335 };
336 #endif
337