Revision d375c104 libavcodec/mpeg4videodec.c

View differences:

libavcodec/mpeg4videodec.c
23 23
#include "mpegvideo.h"
24 24
#include "mpeg4video.h"
25 25
#include "h263.h"
26
#include "thread.h"
26 27

  
27 28
// The defines below define the number of bits that are read at once for
28 29
// reading vlc values. Changing these may improve speed and data cache needs
......
373 374
        return -1;
374 375
    }
375 376
    if(s->pict_type == FF_B_TYPE){
376
        while(s->next_picture.mbskip_table[ s->mb_index2xy[ mb_num ] ]) mb_num++;
377
        int mb_x = 0, mb_y = 0;
378

  
379
        while(s->next_picture.mbskip_table[ s->mb_index2xy[ mb_num ] ]) {
380
            if (!mb_x) ff_thread_await_progress((AVFrame*)s->next_picture_ptr, mb_y++, 0);
381
            mb_num++;
382
            if (++mb_x == s->mb_width) mb_x = 0;
383
        }
377 384
        if(mb_num >= s->mb_num) return -1; // slice contains just skipped MBs which where already decoded
378 385
    }
379 386

  
......
1303 1310
                s->last_mv[i][1][0]=
1304 1311
                s->last_mv[i][1][1]= 0;
1305 1312
            }
1313

  
1314
            ff_thread_await_progress((AVFrame*)s->next_picture_ptr, s->mb_y, 0);
1306 1315
        }
1307 1316

  
1308 1317
        /* if we skipped it in the future P Frame than skip it now too */
......
1482 1491
    if(s->codec_id==CODEC_ID_MPEG4){
1483 1492
        if(mpeg4_is_resync(s)){
1484 1493
            const int delta= s->mb_x + 1 == s->mb_width ? 2 : 1;
1494

  
1495
            if(s->pict_type==FF_B_TYPE){
1496
                ff_thread_await_progress((AVFrame*)s->next_picture_ptr,
1497
                                        (s->mb_x + delta >= s->mb_width) ? FFMIN(s->mb_y+1, s->mb_height-1) : s->mb_y, 0);
1498
            }
1499

  
1485 1500
            if(s->pict_type==FF_B_TYPE && s->next_picture.mbskip_table[xy + delta])
1486 1501
                return SLICE_OK;
1487 1502
            return SLICE_END;
......
2239 2254
    NULL,
2240 2255
    ff_h263_decode_end,
2241 2256
    ff_h263_decode_frame,
2242
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
2257
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_FRAME_THREADS,
2243 2258
    .flush= ff_mpeg_flush,
2244 2259
    .max_lowres= 3,
2245 2260
    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
2246 2261
    .pix_fmts= ff_hwaccel_pixfmt_list_420,
2262
    .update_thread_context= ONLY_IF_THREADS_ENABLED(ff_mpeg_update_thread_context)
2247 2263
};
2248 2264

  
2249 2265

  

Also available in: Unified diff