Revision 487bce53

View differences:

libavcodec/h263dec.c
643 643

  
644 644
    ff_er_frame_start(s);
645 645
    
646
    //the second part of the wmv2 header contains the MB skip bits which are stored in current_picture->mb_type
647
    //which isnt available before MPV_frame_start()
648
    if (s->msmpeg4_version==5){
649
        if(ff_wmv2_decode_secondary_picture_header(s) < 0)
650
            return -1;
651
    }
652

  
646 653
    /* decode each macroblock */
647 654
    s->mb_x=0; 
648 655
    s->mb_y=0;
649 656
    
650 657
    decode_slice(s);
651
    while(s->mb_y<s->mb_height && s->gb.size_in_bits - get_bits_count(&s->gb)>16){
658
    while(s->mb_y<s->mb_height){
652 659
        if(s->msmpeg4_version){
653
            if(s->mb_x!=0 || (s->mb_y%s->slice_height)!=0)
660
            if(s->mb_x!=0 || (s->mb_y%s->slice_height)!=0 || get_bits_count(&s->gb) > s->gb.size_in_bits)
654 661
                break;
655 662
        }else{
656 663
            if(ff_h263_resync(s)<0)
......
733 740
        *pict= *(AVFrame*)&s->last_picture;
734 741
        ff_print_debug_info(s, s->last_picture_ptr);
735 742
    }
736
    
737 743

  
738 744
    /* Return the Picture timestamp as the frame number */
739 745
    /* we substract 1 because it is added on utils.c    */
libavcodec/wmv2.c
349 349
int ff_wmv2_decode_picture_header(MpegEncContext * s)
350 350
{
351 351
    Wmv2Context * const w= (Wmv2Context*)s;
352
    int code, i;
352
    int code;
353 353

  
354 354
#if 0
355 355
{
......
370 370
        printf("I7:%X/\n", code);
371 371
    }
372 372
    s->qscale = get_bits(&s->gb, 5);
373
    if(s->qscale < 0)
374
       return -1;
375
       
376
    return 0;
377
}
378

  
379
int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s)
380
{
381
    Wmv2Context * const w= (Wmv2Context*)s;
373 382

  
374 383
    if (s->pict_type == I_TYPE) {
375 384
        if(w->j_type_bit) w->j_type= get_bits1(&s->gb);

Also available in: Unified diff