1 /*
2 * Copyright (c) 2002 The FFmpeg Project
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
29
30
32 int mb_x, mb_y;
35
40 for(mb_x=0; mb_x<s->
mb_width; mb_x++){
42 }
43 }
44 break;
47 for(mb_x=0; mb_x<s->
mb_width; mb_x++){
49 }
50 }
51 break;
55 for(mb_x=0; mb_x<s->
mb_width; mb_x++){
57 }
58 }else{
59 for(mb_x=0; mb_x<s->
mb_width; mb_x++){
61 }
62 }
63 }
64 break;
66 for(mb_x=0; mb_x<s->
mb_width; mb_x++){
70 }
71 }else{
74 }
75 }
76 }
77 break;
78 }
79 }
80
84 int fps;
85 int code;
86
88
90
100
101 if(code==0) return -1;
102
104
106 av_log(s->
avctx,
AV_LOG_DEBUG,
"fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, slices:%d\n",
108 code);
109 }
110 return 0;
111 }
112
114 {
116 int code;
117
120
125 }
128 return -1;
129
130 return 0;
131 }
132
134 {
136
139 else w->
j_type= 0;
//FIXME check
140
144
148 }
149
151 }
162 }
163 }else{
164 int cbp_index;
166
170 int map[3]= {0,2,1};
172 }
else if(s->
qscale <= 20){
173 int map[3]= {1,0,2};
175 }else{
176 int map[3]= {2,1,0};
178 }
179
181 else s->
mspel= 0;
//FIXME check
182
187 }
188 }
189
192
196 }
197
200
201 s->
inter_intra_pred= 0;
//(s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE);
203
205 av_log(s->
avctx,
AV_LOG_DEBUG,
"rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
217 }
218 }
221
223
224
227 return 1;
228 }
229
230 return 0;
231 }
232
236
238
239 if(ret<0) return -1;
240
241 if((((*mx_ptr)|(*my_ptr)) & 1) && s->
mspel)
243 else
245
246 return 0;
247 }
248
252 int16_t *
A, *
B, *
C, *mot_val;
253
256
258
262
265 else
266 diff=0;
267
268 if(diff >= 8)
270 else
271 type= 2;
272
273 if(type == 0){
274 *px= A[0];
275 *py= A[1];
276 }else if(type == 1){
277 *px= B[0];
278 *py= B[1];
279 }else{
280 /* special case for first (slice) line */
282 *px = A[0];
283 *py = A[1];
284 } else {
287 }
288 }
289
290 return mot_val;
291 }
292
295 static const int sub_cbp_table[3]= {2,3,1};
296 int sub_cbp;
297
298 if(!cbp){
300
301 return 0;
302 }
303
307
309 // const uint8_t *scantable= w->abt_scantable[w->abt_type-1].permutated;
311 // const uint8_t *scantable= w->abt_type-1 ? w->abt_scantable[1].permutated : w->abt_scantable[0].scantable;
312
314
315 if(sub_cbp&1){
317 return -1;
318 }
319
320 if(sub_cbp&2){
322 return -1;
323 }
325
326 return 0;
327 }else{
329 }
330 }
331
332
334 {
336 int cbp, code, i;
338
340
343 /* skip mb */
345 for(i=0;i<6;i++)
353 return 0;
354 }
355
357 if (code < 0)
358 return -1;
360
361 cbp = code & 0x3f;
362 } else {
365 if (code < 0){
367 return -1;
368 }
369 /* predict coded block pattern */
370 cbp = 0;
371 for(i=0;i<6;i++) {
372 int val = ((code >> (5 - i)) & 1);
373 if (i < 4) {
377 }
378 cbp |= val << (5 - i);
379 }
380 }
381
383 int mx, my;
385
386 if(cbp){
391 }
392
397 }else
399 }
400
402 return -1;
403
408
409 for (i = 0; i < 6; i++) {
411 {
413 return -1;
414 }
415 }
416 } else {
420 ((cbp & 3) ? 1 : 0) +((cbp & 0x3C)? 2 : 0),
427 }
431 }
432
434 for (i = 0; i < 6; i++) {
436 {
438 return -1;
439 }
440 }
441 }
442
443 return 0;
444 }
445
448
450
452 return -1;
453
455
457
458 return 0;
459 }
460
462 {
464
467 }
468
480 };