Revision ce5e49b0 libavcodec/mpeg12.c

View differences:

libavcodec/mpeg12.c
214 214
    assert(s->mb_skipped==0);
215 215

  
216 216
    if (s->mb_skip_run-- != 0) {
217
        if (s->pict_type == FF_P_TYPE) {
217
        if (s->pict_type == AV_PICTURE_TYPE_P) {
218 218
            s->mb_skipped = 1;
219 219
            s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16;
220 220
        } else {
......
240 240

  
241 241
    switch(s->pict_type) {
242 242
    default:
243
    case FF_I_TYPE:
243
    case AV_PICTURE_TYPE_I:
244 244
        if (get_bits1(&s->gb) == 0) {
245 245
            if (get_bits1(&s->gb) == 0){
246 246
                av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in I Frame at %d %d\n", s->mb_x, s->mb_y);
......
251 251
            mb_type = MB_TYPE_INTRA;
252 252
        }
253 253
        break;
254
    case FF_P_TYPE:
254
    case AV_PICTURE_TYPE_P:
255 255
        mb_type = get_vlc2(&s->gb, mb_ptype_vlc.table, MB_PTYPE_VLC_BITS, 1);
256 256
        if (mb_type < 0){
257 257
            av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in P Frame at %d %d\n", s->mb_x, s->mb_y);
......
259 259
        }
260 260
        mb_type = ptype2mb_type[ mb_type ];
261 261
        break;
262
    case FF_B_TYPE:
262
    case AV_PICTURE_TYPE_B:
263 263
        mb_type = get_vlc2(&s->gb, mb_btype_vlc.table, MB_BTYPE_VLC_BITS, 1);
264 264
        if (mb_type < 0){
265 265
            av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in B Frame at %d %d\n", s->mb_x, s->mb_y);
......
1198 1198
    if(!ctx->mpeg_enc_ctx_allocated)
1199 1199
        memcpy(s + 1, s1 + 1, sizeof(Mpeg1Context) - sizeof(MpegEncContext));
1200 1200

  
1201
    if(!(s->pict_type == FF_B_TYPE || s->low_delay))
1201
    if(!(s->pict_type == AV_PICTURE_TYPE_B || s->low_delay))
1202 1202
        s->picture_number++;
1203 1203

  
1204 1204
    return 0;
......
1408 1408
        return -1;
1409 1409

  
1410 1410
    vbv_delay= get_bits(&s->gb, 16);
1411
    if (s->pict_type == FF_P_TYPE || s->pict_type == FF_B_TYPE) {
1411
    if (s->pict_type == AV_PICTURE_TYPE_P || s->pict_type == AV_PICTURE_TYPE_B) {
1412 1412
        s->full_pel[0] = get_bits1(&s->gb);
1413 1413
        f_code = get_bits(&s->gb, 3);
1414 1414
        if (f_code == 0 && avctx->error_recognition >= FF_ER_COMPLIANT)
......
1416 1416
        s->mpeg_f_code[0][0] = f_code;
1417 1417
        s->mpeg_f_code[0][1] = f_code;
1418 1418
    }
1419
    if (s->pict_type == FF_B_TYPE) {
1419
    if (s->pict_type == AV_PICTURE_TYPE_B) {
1420 1420
        s->full_pel[1] = get_bits1(&s->gb);
1421 1421
        f_code = get_bits(&s->gb, 3);
1422 1422
        if (f_code == 0 && avctx->error_recognition >= FF_ER_COMPLIANT)
......
1425 1425
        s->mpeg_f_code[1][1] = f_code;
1426 1426
    }
1427 1427
    s->current_picture.pict_type= s->pict_type;
1428
    s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
1428
    s->current_picture.key_frame= s->pict_type == AV_PICTURE_TYPE_I;
1429 1429

  
1430 1430
    if(avctx->debug & FF_DEBUG_PICT_INFO)
1431 1431
        av_log(avctx, AV_LOG_DEBUG, "vbv_delay %d, ref %d type:%d\n", vbv_delay, ref, s->pict_type);
......
1573 1573
        av_log(s->avctx, AV_LOG_ERROR, "Missing picture start code, guessing missing values\n");
1574 1574
        if(s->mpeg_f_code[1][0] == 15 && s->mpeg_f_code[1][1]==15){
1575 1575
            if(s->mpeg_f_code[0][0] == 15 && s->mpeg_f_code[0][1] == 15)
1576
                s->pict_type= FF_I_TYPE;
1576
                s->pict_type= AV_PICTURE_TYPE_I;
1577 1577
            else
1578
                s->pict_type= FF_P_TYPE;
1578
                s->pict_type= AV_PICTURE_TYPE_P;
1579 1579
        }else
1580
            s->pict_type= FF_B_TYPE;
1580
            s->pict_type= AV_PICTURE_TYPE_B;
1581 1581
        s->current_picture.pict_type= s->pict_type;
1582
        s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
1582
        s->current_picture.key_frame= s->pict_type == AV_PICTURE_TYPE_I;
1583 1583
    }
1584 1584
    s->intra_dc_precision = get_bits(&s->gb, 2);
1585 1585
    s->picture_structure = get_bits(&s->gb, 2);
......
1790 1790
        if(s->avctx->debug&FF_DEBUG_PICT_INFO){
1791 1791
             av_log(s->avctx, AV_LOG_DEBUG, "qp:%d fc:%2d%2d%2d%2d %s %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n",
1792 1792
                 s->qscale, s->mpeg_f_code[0][0],s->mpeg_f_code[0][1],s->mpeg_f_code[1][0],s->mpeg_f_code[1][1],
1793
                 s->pict_type == FF_I_TYPE ? "I" : (s->pict_type == FF_P_TYPE ? "P" : (s->pict_type == FF_B_TYPE ? "B" : "S")),
1793
                 s->pict_type == AV_PICTURE_TYPE_I ? "I" : (s->pict_type == AV_PICTURE_TYPE_P ? "P" : (s->pict_type == AV_PICTURE_TYPE_B ? "B" : "S")),
1794 1794
                 s->progressive_sequence ? "ps" :"", s->progressive_frame ? "pf" : "", s->alternate_scan ? "alt" :"", s->top_field_first ? "top" :"",
1795 1795
                 s->intra_dc_precision, s->picture_structure, s->frame_pred_frame_dct, s->concealment_motion_vectors,
1796 1796
                 s->q_scale_type, s->intra_vlc_format, s->repeat_first_field, s->chroma_420_type ? "420" :"");
......
1813 1813

  
1814 1814
            for(i=0; i<2; i++){
1815 1815
                for(dir=0; dir<2; dir++){
1816
                    if (s->mb_intra || (dir==1 && s->pict_type != FF_B_TYPE)) {
1816
                    if (s->mb_intra || (dir==1 && s->pict_type != AV_PICTURE_TYPE_B)) {
1817 1817
                        motion_x = motion_y = 0;
1818 1818
                    }else if (s->mv_type == MV_TYPE_16X16 || (s->mv_type == MV_TYPE_FIELD && field_pic)){
1819 1819
                        motion_x = s->mv[dir][0][0];
......
1853 1853

  
1854 1854
            if(s->mb_y >= s->mb_height){
1855 1855
                int left= get_bits_left(&s->gb);
1856
                int is_d10= s->chroma_format==2 && s->pict_type==FF_I_TYPE && avctx->profile==0 && avctx->level==5
1856
                int is_d10= s->chroma_format==2 && s->pict_type==AV_PICTURE_TYPE_I && avctx->profile==0 && avctx->level==5
1857 1857
                            && s->intra_dc_precision == 2 && s->q_scale_type == 1 && s->alternate_scan == 0
1858 1858
                            && s->progressive_frame == 0 /* vbv_delay == 0xBBB || 0xE10*/;
1859 1859

  
......
1896 1896
            }
1897 1897
            if(s->mb_skip_run){
1898 1898
                int i;
1899
                if(s->pict_type == FF_I_TYPE){
1899
                if(s->pict_type == AV_PICTURE_TYPE_I){
1900 1900
                    av_log(s->avctx, AV_LOG_ERROR, "skipped MB in I frame at %d %d\n", s->mb_x, s->mb_y);
1901 1901
                    return -1;
1902 1902
                }
......
1909 1909
                    s->mv_type = MV_TYPE_16X16;
1910 1910
                else
1911 1911
                    s->mv_type = MV_TYPE_FIELD;
1912
                if (s->pict_type == FF_P_TYPE) {
1912
                if (s->pict_type == AV_PICTURE_TYPE_P) {
1913 1913
                    /* if P type, zero motion vector is implied */
1914 1914
                    s->mv_dir = MV_DIR_FORWARD;
1915 1915
                    s->mv[0][0][0] = s->mv[0][0][1] = 0;
......
2000 2000

  
2001 2001
        MPV_frame_end(s);
2002 2002

  
2003
        if (s->pict_type == FF_B_TYPE || s->low_delay) {
2003
        if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
2004 2004
            *pict= *(AVFrame*)s->current_picture_ptr;
2005 2005
            ff_print_debug_info(s, pict);
2006 2006
        } else {
......
2339 2339
        uint32_t start_code = -1;
2340 2340
        buf_ptr = ff_find_start_code(buf_ptr,buf_end, &start_code);
2341 2341
        if (start_code > 0x1ff){
2342
            if(s2->pict_type != FF_B_TYPE || avctx->skip_frame <= AVDISCARD_DEFAULT){
2342
            if(s2->pict_type != AV_PICTURE_TYPE_B || avctx->skip_frame <= AVDISCARD_DEFAULT){
2343 2343
                if(HAVE_THREADS && avctx->active_thread_type&FF_THREAD_SLICE){
2344 2344
                    int i;
2345 2345

  
......
2465 2465

  
2466 2466
                if(s2->last_picture_ptr==NULL){
2467 2467
                /* Skip B-frames if we do not have reference frames and gop is not closed */
2468
                    if(s2->pict_type==FF_B_TYPE){
2468
                    if(s2->pict_type==AV_PICTURE_TYPE_B){
2469 2469
                        if(!s2->closed_gop)
2470 2470
                            break;
2471 2471
                    }
2472 2472
                }
2473
                if(s2->pict_type==FF_I_TYPE)
2473
                if(s2->pict_type==AV_PICTURE_TYPE_I)
2474 2474
                    s->sync=1;
2475 2475
                if(s2->next_picture_ptr==NULL){
2476 2476
                /* Skip P-frames if we do not have a reference frame or we have an invalid header. */
2477
                    if(s2->pict_type==FF_P_TYPE && !s->sync) break;
2477
                    if(s2->pict_type==AV_PICTURE_TYPE_P && !s->sync) break;
2478 2478
                }
2479
                if(  (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==FF_B_TYPE)
2480
                    ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=FF_I_TYPE)
2479
                if(  (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==AV_PICTURE_TYPE_B)
2480
                    ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=AV_PICTURE_TYPE_I)
2481 2481
                    || avctx->skip_frame >= AVDISCARD_ALL)
2482 2482
                    break;
2483 2483

  

Also available in: Unified diff