Statistics
| Branch: | Revision:

ffmpeg / libavcodec / h263dec.c @ a61f8265

History | View | Annotate | Download (20.4 KB)

1
/*
2
 * H263 decoder
3
 * Copyright (c) 2001 Fabrice Bellard.
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Lesser General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Lesser General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Lesser General Public
16
 * License along with this library; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 */
19
#include "avcodec.h"
20
#include "dsputil.h"
21
#include "mpegvideo.h"
22

    
23
#if 1
24
#define PRINT_QP(a, b) {}
25
#else
26
#define PRINT_QP(a, b) printf(a, b)
27
#endif
28

    
29
//#define DEBUG
30
//#define PRINT_FRAME_TIME
31
#ifdef PRINT_FRAME_TIME
32
static inline long long rdtsc()
33
{
34
        long long l;
35
        asm volatile(        "rdtsc\n\t"
36
                : "=A" (l)
37
        );
38
//        printf("%d\n", int(l/1000));
39
        return l;
40
}
41
#endif
42

    
43
static int h263_decode_init(AVCodecContext *avctx)
44
{
45
    MpegEncContext *s = avctx->priv_data;
46

    
47
    s->avctx = avctx;
48
    s->out_format = FMT_H263;
49

    
50
    s->width = avctx->width;
51
    s->height = avctx->height;
52
    s->workaround_bugs= avctx->workaround_bugs;
53

    
54
    // set defaults
55
    s->quant_precision=5;
56
    s->progressive_sequence=1;
57
    s->decode_mb= ff_h263_decode_mb;
58

    
59
    /* select sub codec */
60
    switch(avctx->codec->id) {
61
    case CODEC_ID_H263:
62
        s->gob_number = 0;
63
        s->first_slice_line = 0;
64
        break;
65
    case CODEC_ID_MPEG4:
66
        s->time_increment_bits = 4; /* default value for broken headers */
67
        s->h263_pred = 1;
68
        s->has_b_frames = 1; //default, might be overriden in the vol header during header parsing
69
        break;
70
    case CODEC_ID_MSMPEG4V1:
71
        s->h263_msmpeg4 = 1;
72
        s->h263_pred = 1;
73
        s->msmpeg4_version=1;
74
        break;
75
    case CODEC_ID_MSMPEG4V2:
76
        s->h263_msmpeg4 = 1;
77
        s->h263_pred = 1;
78
        s->msmpeg4_version=2;
79
        break;
80
    case CODEC_ID_MSMPEG4V3:
81
        s->h263_msmpeg4 = 1;
82
        s->h263_pred = 1;
83
        s->msmpeg4_version=3;
84
        break;
85
    case CODEC_ID_WMV1:
86
        s->h263_msmpeg4 = 1;
87
        s->h263_pred = 1;
88
        s->msmpeg4_version=4;
89
        break;
90
    case CODEC_ID_WMV2:
91
        s->h263_msmpeg4 = 1;
92
        s->h263_pred = 1;
93
        s->msmpeg4_version=5;
94
        break;
95
    case CODEC_ID_H263I:
96
        s->h263_intel = 1;
97
        break;
98
    default:
99
        return -1;
100
    }
101
    s->codec_id= avctx->codec->id;
102

    
103
    /* for h263, we allocate the images after having read the header */
104
    if (avctx->codec->id != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4)
105
        if (MPV_common_init(s) < 0)
106
            return -1;
107

    
108
    if (s->h263_msmpeg4)
109
        ff_msmpeg4_decode_init(s);
110
    else
111
        h263_decode_init_vlc(s);
112
    
113
    return 0;
114
}
115

    
116
static int h263_decode_end(AVCodecContext *avctx)
117
{
118
    MpegEncContext *s = avctx->priv_data;
119

    
120
    MPV_common_end(s);
121
    return 0;
122
}
123

    
124
/**
125
 * retunrs the number of bytes consumed for building the current frame
126
 */
127
static int get_consumed_bytes(MpegEncContext *s, int buf_size){
128
    int pos= (get_bits_count(&s->gb)+7)>>3;
129
    if(s->divx_version>=500){
130
        //we would have to scan through the whole buf to handle the weird reordering ...
131
        return buf_size; 
132
    }else{
133
        if(pos==0) pos=1; //avoid infinite loops (i doubt thats needed but ...)
134
        if(pos+10>buf_size) pos=buf_size; // oops ;)
135

    
136
        return pos;
137
    }
138
}
139

    
140
static int decode_slice(MpegEncContext *s){
141
    s->last_resync_gb= s->gb;
142
    s->first_slice_line= 1;
143
        
144
    s->resync_mb_x= s->mb_x;
145
    s->resync_mb_y= s->mb_y;
146

    
147
    s->y_dc_scale= s->y_dc_scale_table[ s->qscale ];
148
    s->c_dc_scale= s->c_dc_scale_table[ s->qscale ];
149
    
150
    if(s->partitioned_frame){
151
        const int qscale= s->qscale;
152

    
153
        if(s->codec_id==CODEC_ID_MPEG4){
154
            if(ff_mpeg4_decode_partitions(s) < 0)
155
                return -1; 
156
        }
157
        
158
        /* restore variables which where modified */
159
        s->first_slice_line=1;
160
        s->mb_x= s->resync_mb_x;
161
        s->mb_y= s->resync_mb_y;
162
        s->qscale= qscale;
163
        s->y_dc_scale= s->y_dc_scale_table[ s->qscale ];
164
        s->c_dc_scale= s->c_dc_scale_table[ s->qscale ];
165
    }
166

    
167
    for(; s->mb_y < s->mb_height; s->mb_y++) {
168
        /* per-row end of slice checks */
169
        if(s->msmpeg4_version){
170
            if(s->resync_mb_y + s->slice_height == s->mb_y){
171
                const int xy= s->mb_x + s->mb_y*s->mb_width;
172
                s->error_status_table[xy-1]|= AC_END|DC_END|MV_END;
173
                return 0;
174
            }
175
        }
176
        
177
        if(s->msmpeg4_version==1){
178
            s->last_dc[0]=
179
            s->last_dc[1]=
180
            s->last_dc[2]= 128;
181
        }
182
    
183
        ff_init_block_index(s);
184
        for(; s->mb_x < s->mb_width; s->mb_x++) {
185
            int ret;
186

    
187
            ff_update_block_index(s);
188

    
189
            if(s->resync_mb_x == s->mb_x && s->resync_mb_y+1 == s->mb_y){
190
                s->first_slice_line=0; 
191
            }
192

    
193
            /* DCT & quantize */
194
            clear_blocks(s->block[0]);
195
            
196
            s->mv_dir = MV_DIR_FORWARD;
197
            s->mv_type = MV_TYPE_16X16;
198
//printf("%d %d %06X\n", ret, get_bits_count(&s->gb), show_bits(&s->gb, 24));
199
            ret= s->decode_mb(s, s->block);
200
            
201
            PRINT_QP("%2d", s->qscale);
202
            MPV_decode_mb(s, s->block);
203

    
204
            if(ret<0){
205
                const int xy= s->mb_x + s->mb_y*s->mb_width;
206
                if(ret==SLICE_END){
207
//printf("%d %d %06X\n", s->mb_x, s->gb.size*8 - get_bits_count(&s->gb), show_bits(&s->gb, 24));
208
                    s->error_status_table[xy]|= AC_END;
209
                    if(!s->partitioned_frame)
210
                        s->error_status_table[xy]|= MV_END|DC_END;
211

    
212
                    s->padding_bug_score--;
213
                        
214
                    if(++s->mb_x >= s->mb_width){
215
                        s->mb_x=0;
216
                        ff_draw_horiz_band(s);
217
                        s->mb_y++;
218
                    }
219
                    return 0; 
220
                }else if(ret==SLICE_NOEND){
221
                    fprintf(stderr,"Slice mismatch at MB: %d\n", xy);
222
                    return -1;
223
                }
224
                fprintf(stderr,"Error at MB: %d\n", xy);
225
                s->error_status_table[xy]|= AC_ERROR;
226
                if(!s->partitioned_frame)
227
                    s->error_status_table[xy]|= DC_ERROR|MV_ERROR;
228
    
229
                return -1;
230
            }
231
        }
232
        
233
        ff_draw_horiz_band(s);
234
        
235
        PRINT_QP("%s", "\n");
236
        
237
        s->mb_x= 0;
238
    }
239
    
240
    assert(s->mb_x==0 && s->mb_y==s->mb_height);
241

    
242
    /* try to detect the padding bug */
243
    if(      s->codec_id==CODEC_ID_MPEG4
244
       &&   (s->workaround_bugs&FF_BUG_AUTODETECT) 
245
       &&    s->gb.size*8 - get_bits_count(&s->gb) >=0
246
       &&    s->gb.size*8 - get_bits_count(&s->gb) < 48
247
       &&   !s->resync_marker
248
       &&   !s->data_partitioning){
249
        
250
        const int bits_count= get_bits_count(&s->gb);
251
        const int bits_left = s->gb.size*8 - bits_count;
252
        
253
        if(bits_left==0 || bits_left>8){
254
            s->padding_bug_score++;
255
        } else {
256
            int v= show_bits(&s->gb, 8);
257
            v|= 0x7F >> (7-(bits_count&7));
258
                
259
            if(v==0x7F)
260
                s->padding_bug_score--;
261
            else
262
                s->padding_bug_score++;            
263
        }
264
        
265
        if(s->padding_bug_score > -2)
266
            s->workaround_bugs |=  FF_BUG_NO_PADDING;
267
        else
268
            s->workaround_bugs &= ~FF_BUG_NO_PADDING;
269
    }
270

    
271
    // handle formats which dont have unique end markers
272
    if(s->msmpeg4_version || (s->workaround_bugs&FF_BUG_NO_PADDING)){ //FIXME perhaps solve this more cleanly
273
        int left= s->gb.size*8 - get_bits_count(&s->gb);
274
        int max_extra=7;
275
        
276
        /* no markers in M$ crap */
277
        if(s->msmpeg4_version && s->pict_type==I_TYPE)
278
            max_extra+= 17;
279
        
280
        /* buggy padding but the frame should still end approximately at the bitstream end */
281
        if((s->workaround_bugs&FF_BUG_NO_PADDING) && s->error_resilience>=3)
282
            max_extra+= 48;
283
        else if((s->workaround_bugs&FF_BUG_NO_PADDING))
284
            max_extra+= 256*256*256*64;
285
        
286
        if(left>max_extra){
287
            fprintf(stderr, "discarding %d junk bits at end, next would be %X\n", left, show_bits(&s->gb, 24));
288
        }
289
        else if(left<0){
290
            fprintf(stderr, "overreading %d bits\n", -left);
291
        }else
292
            s->error_status_table[s->mb_num-1]|= AC_END|MV_END|DC_END;
293
        
294
        return 0;
295
    }
296

    
297
    fprintf(stderr, "slice end not reached but screenspace end (%d left %06X)\n", 
298
            s->gb.size*8 - get_bits_count(&s->gb),
299
            show_bits(&s->gb, 24));
300
    return -1;
301
}
302

    
303
static int h263_decode_frame(AVCodecContext *avctx, 
304
                             void *data, int *data_size,
305
                             UINT8 *buf, int buf_size)
306
{
307
    MpegEncContext *s = avctx->priv_data;
308
    int ret,i;
309
    AVPicture *pict = data; 
310
#ifdef PRINT_FRAME_TIME
311
uint64_t time= rdtsc();
312
#endif
313
#ifdef DEBUG
314
    printf("*****frame %d size=%d\n", avctx->frame_number, buf_size);
315
    printf("bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
316
#endif
317

    
318
    s->hurry_up= avctx->hurry_up;
319
    s->error_resilience= avctx->error_resilience;
320

    
321
    s->flags= avctx->flags;
322

    
323
    *data_size = 0;
324
   
325
   /* no supplementary picture */
326
    if (buf_size == 0) {
327
        return 0;
328
    }
329

    
330
    if(s->bitstream_buffer_size && buf_size<20){ //divx 5.01+ frame reorder
331
        init_get_bits(&s->gb, s->bitstream_buffer, s->bitstream_buffer_size);
332
    }else
333
        init_get_bits(&s->gb, buf, buf_size);
334
    s->bitstream_buffer_size=0;
335

    
336
    if (!s->context_initialized) {
337
        if (DCT_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix
338
            return -1;
339
    }
340
        
341
    /* let's go :-) */
342
    if (s->h263_msmpeg4) {
343
        ret = msmpeg4_decode_picture_header(s);
344
    } else if (s->h263_pred) {
345
        if(s->avctx->extradata_size && s->picture_number==0){
346
            GetBitContext gb;
347
            
348
            init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size);
349
            ret = ff_mpeg4_decode_picture_header(s, &gb);
350
        }
351
        ret = ff_mpeg4_decode_picture_header(s, &s->gb);
352

    
353
        s->has_b_frames= !s->low_delay;
354
    } else if (s->h263_intel) {
355
        ret = intel_h263_decode_picture_header(s);
356
    } else {
357
        ret = h263_decode_picture_header(s);
358
    }
359
    avctx->has_b_frames= s->has_b_frames;
360

    
361
    if(s->workaround_bugs&FF_BUG_AUTODETECT){
362
        if(s->avctx->fourcc == ff_get_fourcc("XVIX")) 
363
            s->workaround_bugs|= FF_BUG_XVID_ILACE;
364

    
365
        if(s->avctx->fourcc == ff_get_fourcc("MP4S")) 
366
            s->workaround_bugs|= FF_BUG_AC_VLC;
367
        
368
        if(s->avctx->fourcc == ff_get_fourcc("M4S2")) 
369
            s->workaround_bugs|= FF_BUG_AC_VLC;
370
                
371
        if(s->avctx->fourcc == ff_get_fourcc("UMP4")){
372
            s->workaround_bugs|= FF_BUG_UMP4;
373
            s->workaround_bugs|= FF_BUG_AC_VLC;
374
        }
375
//printf("padding_bug_score: %d\n", s->padding_bug_score);
376
#if 0
377
        if(s->divx_version==500)
378
            s->workaround_bugs|= FF_BUG_NO_PADDING;
379

380
        /* very ugly XVID padding bug detection FIXME/XXX solve this differently
381
         * lets hope this at least works
382
         */
383
        if(   s->resync_marker==0 && s->data_partitioning==0 && s->divx_version==0
384
           && s->codec_id==CODEC_ID_MPEG4 && s->vo_type==0)
385
            s->workaround_bugs|= FF_BUG_NO_PADDING;
386
        
387
        if(s->lavc_build && s->lavc_build<4609) //FIXME not sure about the version num but a 4609 file seems ok
388
            s->workaround_bugs|= FF_BUG_NO_PADDING;
389
#endif
390
    }
391
    
392

    
393
#if 0 // dump bits per frame / qp / complexity
394
{
395
    static FILE *f=NULL;
396
    if(!f) f=fopen("rate_qp_cplx.txt", "w");
397
    fprintf(f, "%d %d %f\n", buf_size, s->qscale, buf_size*(double)s->qscale);
398
}
399
#endif
400
       
401
        /* After H263 & mpeg4 header decode we have the height, width,*/
402
        /* and other parameters. So then we could init the picture   */
403
        /* FIXME: By the way H263 decoder is evolving it should have */
404
        /* an H263EncContext                                         */
405
    if (   s->width != avctx->width || s->height != avctx->height 
406
        || avctx->aspect_ratio_info != s->aspect_ratio_info
407
        || avctx->aspected_width != s->aspected_width
408
        || avctx->aspected_height != s->aspected_height) {
409
        /* H.263 could change picture size any time */
410
        MPV_common_end(s);
411
        s->context_initialized=0;
412
    }
413
    if (!s->context_initialized) {
414
        avctx->width = s->width;
415
        avctx->height = s->height;
416
        avctx->aspect_ratio_info= s->aspect_ratio_info;
417
        if (s->aspect_ratio_info == FF_ASPECT_EXTENDED)
418
        {
419
            avctx->aspected_width = s->aspected_width;
420
            avctx->aspected_height = s->aspected_height;
421
        }
422

    
423
        if (s->codec_id==CODEC_ID_H263 && s->codec_id==CODEC_ID_H263)
424
            s->gob_index = ff_h263_get_gob_height(s);
425

    
426
        if (MPV_common_init(s) < 0)
427
            return -1;
428
    }
429
    
430
    if(ret==FRAME_SKIPED) return get_consumed_bytes(s, buf_size);
431
    /* skip if the header was thrashed */
432
    if (ret < 0){
433
        fprintf(stderr, "header damaged\n");
434
        return -1;
435
    }
436
    /* skip b frames if we dont have reference frames */
437
    if(s->num_available_buffers<2 && s->pict_type==B_TYPE) return get_consumed_bytes(s, buf_size);
438
    /* skip b frames if we are in a hurry */
439
    if(s->hurry_up && s->pict_type==B_TYPE) return get_consumed_bytes(s, buf_size);
440
    
441
    if(s->next_p_frame_damaged){
442
        if(s->pict_type==B_TYPE)
443
            return get_consumed_bytes(s, buf_size);
444
        else
445
            s->next_p_frame_damaged=0;
446
    }
447

    
448
    MPV_frame_start(s, avctx);
449

    
450
#ifdef DEBUG
451
    printf("qscale=%d\n", s->qscale);
452
#endif
453

    
454
    if(s->error_resilience)
455
        memset(s->error_status_table, MV_ERROR|AC_ERROR|DC_ERROR|VP_START|AC_END|DC_END|MV_END, s->mb_num*sizeof(UINT8));
456
    
457
    /* decode each macroblock */
458
    s->block_wrap[0]=
459
    s->block_wrap[1]=
460
    s->block_wrap[2]=
461
    s->block_wrap[3]= s->mb_width*2 + 2;
462
    s->block_wrap[4]=
463
    s->block_wrap[5]= s->mb_width + 2;
464
    s->mb_x=0; 
465
    s->mb_y=0;
466
    
467
    decode_slice(s);
468
    s->error_status_table[0]|= VP_START;
469
    while(s->mb_y<s->mb_height && s->gb.size*8 - get_bits_count(&s->gb)>32){
470
        if(s->msmpeg4_version){
471
            if(s->mb_x!=0 || (s->mb_y%s->slice_height)!=0)
472
                break;
473
        }else{
474
            if(ff_h263_resync(s)<0)
475
                break;
476
        }
477
        
478
        if(s->msmpeg4_version!=4)
479
            ff_mpeg4_clean_buffers(s);
480

    
481
        decode_slice(s);
482
        s->error_status_table[s->resync_mb_x + s->resync_mb_y*s->mb_width]|= VP_START;
483
    }
484
    
485
    if (s->h263_msmpeg4 && s->msmpeg4_version<4 && s->pict_type==I_TYPE)
486
        if(msmpeg4_decode_ext_header(s, buf_size) < 0) return -1;
487
    
488
    /* divx 5.01+ bistream reorder stuff */
489
    if(s->codec_id==CODEC_ID_MPEG4 && s->bitstream_buffer_size==0 && s->divx_version>=500){
490
        int current_pos= get_bits_count(&s->gb)>>3;
491

    
492
        if(   buf_size - current_pos > 5 
493
           && buf_size - current_pos < BITSTREAM_BUFFER_SIZE){
494
            int i;
495
            int startcode_found=0;
496
            for(i=current_pos; i<buf_size-3; i++){
497
                if(buf[i]==0 && buf[i+1]==0 && buf[i+2]==1 && buf[i+3]==0xB6){
498
                    startcode_found=1;
499
                    break;
500
                }
501
            }
502
            if(startcode_found){
503
                memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos);
504
                s->bitstream_buffer_size= buf_size - current_pos;
505
            }
506
        }
507
    }
508

    
509
    if(s->error_resilience){
510
        int error=0, num_end_markers=0;
511
        for(i=0; i<s->mb_num; i++){
512
            int status= s->error_status_table[i];
513
#if 0
514
            if(i%s->mb_width == 0) printf("\n");
515
            printf("%2X ", status); 
516
#endif
517
            if(status==0) continue;
518

    
519
            if(status&(DC_ERROR|AC_ERROR|MV_ERROR))
520
                error=1;
521
            if(status&VP_START){
522
                if(num_end_markers) 
523
                    error=1;
524
                num_end_markers=3;
525
            }
526
            if(status&AC_END)
527
                num_end_markers--;
528
            if(status&DC_END)
529
                num_end_markers--;
530
            if(status&MV_END)
531
                num_end_markers--;
532
        }
533
        if(num_end_markers || error){
534
            fprintf(stderr, "concealing errors\n");
535
//printf("type:%d\n", s->pict_type);
536
            ff_error_resilience(s);
537
        }
538
    }
539

    
540
    MPV_frame_end(s);
541
#if 0 //dirty show MVs, we should export the MV tables and write a filter to show them
542
{
543
  int mb_y;
544
  s->has_b_frames=1;
545
  for(mb_y=0; mb_y<s->mb_height; mb_y++){
546
    int mb_x;
547
    int y= mb_y*16 + 8;
548
    for(mb_x=0; mb_x<s->mb_width; mb_x++){
549
      int x= mb_x*16 + 8;
550
      uint8_t *ptr= s->last_picture[0];
551
      int xy= 1 + mb_x*2 + (mb_y*2 + 1)*(s->mb_width*2 + 2);
552
      int mx= (s->motion_val[xy][0]>>1) + x;
553
      int my= (s->motion_val[xy][1]>>1) + y;
554
      int i;
555
      int max;
556

557
      if(mx<0) mx=0;
558
      if(my<0) my=0;
559
      if(mx>=s->width)  mx= s->width -1;
560
      if(my>=s->height) my= s->height-1;
561
      max= ABS(mx-x);
562
      if(ABS(my-y) > max) max= ABS(my-y);
563
      /* the ugliest linedrawing routine ... */
564
      for(i=0; i<max; i++){
565
        int x1= x + (mx-x)*i/max;
566
        int y1= y + (my-y)*i/max;
567
        ptr[y1*s->linesize + x1]+=100;
568
      }
569
      ptr[y*s->linesize + x]+=100;
570
      s->mbskip_table[mb_x + mb_y*s->mb_width]=0;
571
    }
572
  }
573

574
}
575
#endif    
576
    if(s->pict_type==B_TYPE || (!s->has_b_frames)){
577
        pict->data[0] = s->current_picture[0];
578
        pict->data[1] = s->current_picture[1];
579
        pict->data[2] = s->current_picture[2];
580
    } else {
581
        pict->data[0] = s->last_picture[0];
582
        pict->data[1] = s->last_picture[1];
583
        pict->data[2] = s->last_picture[2];
584
    }
585
    pict->linesize[0] = s->linesize;
586
    pict->linesize[1] = s->uvlinesize;
587
    pict->linesize[2] = s->uvlinesize;
588

    
589
    avctx->quality = s->qscale;
590

    
591
    /* Return the Picture timestamp as the frame number */
592
    /* we substract 1 because it is added on utils.c    */
593
    avctx->frame_number = s->picture_number - 1;
594

    
595
    /* dont output the last pic after seeking 
596
       note we allready added +1 for the current pix in MPV_frame_end(s) */
597
    if(s->num_available_buffers>=2 || (!s->has_b_frames))
598
        *data_size = sizeof(AVPicture);
599
#ifdef PRINT_FRAME_TIME
600
printf("%Ld\n", rdtsc()-time);
601
#endif
602
    return get_consumed_bytes(s, buf_size);
603
}
604

    
605
AVCodec mpeg4_decoder = {
606
    "mpeg4",
607
    CODEC_TYPE_VIDEO,
608
    CODEC_ID_MPEG4,
609
    sizeof(MpegEncContext),
610
    h263_decode_init,
611
    NULL,
612
    h263_decode_end,
613
    h263_decode_frame,
614
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
615
};
616

    
617
AVCodec h263_decoder = {
618
    "h263",
619
    CODEC_TYPE_VIDEO,
620
    CODEC_ID_H263,
621
    sizeof(MpegEncContext),
622
    h263_decode_init,
623
    NULL,
624
    h263_decode_end,
625
    h263_decode_frame,
626
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
627
};
628

    
629
AVCodec msmpeg4v1_decoder = {
630
    "msmpeg4v1",
631
    CODEC_TYPE_VIDEO,
632
    CODEC_ID_MSMPEG4V1,
633
    sizeof(MpegEncContext),
634
    h263_decode_init,
635
    NULL,
636
    h263_decode_end,
637
    h263_decode_frame,
638
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
639
};
640

    
641
AVCodec msmpeg4v2_decoder = {
642
    "msmpeg4v2",
643
    CODEC_TYPE_VIDEO,
644
    CODEC_ID_MSMPEG4V2,
645
    sizeof(MpegEncContext),
646
    h263_decode_init,
647
    NULL,
648
    h263_decode_end,
649
    h263_decode_frame,
650
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
651
};
652

    
653
AVCodec msmpeg4v3_decoder = {
654
    "msmpeg4",
655
    CODEC_TYPE_VIDEO,
656
    CODEC_ID_MSMPEG4V3,
657
    sizeof(MpegEncContext),
658
    h263_decode_init,
659
    NULL,
660
    h263_decode_end,
661
    h263_decode_frame,
662
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
663
};
664

    
665
AVCodec wmv1_decoder = {
666
    "wmv1",
667
    CODEC_TYPE_VIDEO,
668
    CODEC_ID_WMV1,
669
    sizeof(MpegEncContext),
670
    h263_decode_init,
671
    NULL,
672
    h263_decode_end,
673
    h263_decode_frame,
674
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
675
};
676

    
677
AVCodec wmv2_decoder = {
678
    "wmv2",
679
    CODEC_TYPE_VIDEO,
680
    CODEC_ID_WMV2,
681
    sizeof(MpegEncContext),
682
    h263_decode_init,
683
    NULL,
684
    h263_decode_end,
685
    h263_decode_frame,
686
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
687
};
688

    
689
AVCodec h263i_decoder = {
690
    "h263i",
691
    CODEC_TYPE_VIDEO,
692
    CODEC_ID_H263I,
693
    sizeof(MpegEncContext),
694
    h263_decode_init,
695
    NULL,
696
    h263_decode_end,
697
    h263_decode_frame,
698
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
699
};
700