Revision 9963b332 libavcodec/h264.c

View differences:

libavcodec/h264.c
2848 2848
            int pred= h->curr_pic_num;
2849 2849

  
2850 2850
            for(index=0; ; index++){
2851
                unsigned int reordering_of_pic_nums_idc= get_ue_golomb(&s->gb);
2851
                unsigned int reordering_of_pic_nums_idc= get_ue_golomb_31(&s->gb);
2852 2852
                unsigned int pic_id;
2853 2853
                int i;
2854 2854
                Picture *ref = NULL;
......
3414 3414
    }else{
3415 3415
        if(get_bits1(gb)){ // adaptive_ref_pic_marking_mode_flag
3416 3416
            for(i= 0; i<MAX_MMCO_COUNT; i++) {
3417
                MMCOOpcode opcode= get_ue_golomb(gb);
3417
                MMCOOpcode opcode= get_ue_golomb_31(gb);
3418 3418

  
3419 3419
                h->mmco[i].opcode= opcode;
3420 3420
                if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){
......
3425 3425
                    }*/
3426 3426
                }
3427 3427
                if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){
3428
                    unsigned int long_arg= get_ue_golomb(gb);
3428
                    unsigned int long_arg= get_ue_golomb_31(gb);
3429 3429
                    if(long_arg >= 32 || (long_arg >= 16 && !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE))){
3430 3430
                        av_log(h->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode);
3431 3431
                        return -1;
......
3653 3653
            s->current_picture_ptr= NULL;
3654 3654
    }
3655 3655

  
3656
    slice_type= get_ue_golomb(&s->gb);
3656
    slice_type= get_ue_golomb_31(&s->gb);
3657 3657
    if(slice_type > 9){
3658 3658
        av_log(h->s.avctx, AV_LOG_ERROR, "slice type too large (%d) at %d %d\n", h->slice_type, s->mb_x, s->mb_y);
3659 3659
        return -1;
......
3947 3947
    direct_ref_list_init(h);
3948 3948

  
3949 3949
    if( h->slice_type_nos != FF_I_TYPE && h->pps.cabac ){
3950
        tmp = get_ue_golomb(&s->gb);
3950
        tmp = get_ue_golomb_31(&s->gb);
3951 3951
        if(tmp > 2){
3952 3952
            av_log(s->avctx, AV_LOG_ERROR, "cabac_init_idc overflow\n");
3953 3953
            return -1;
......
3976 3976
    h->slice_alpha_c0_offset = 0;
3977 3977
    h->slice_beta_offset = 0;
3978 3978
    if( h->pps.deblocking_filter_parameters_present ) {
3979
        tmp= get_ue_golomb(&s->gb);
3979
        tmp= get_ue_golomb_31(&s->gb);
3980 3980
        if(tmp > 2){
3981 3981
            av_log(s->avctx, AV_LOG_ERROR, "deblocking_filter_idc %u out of range\n", tmp);
3982 3982
            return -1;
......
4456 4456
                return -1;
4457 4457
        }
4458 4458
        if(CHROMA){
4459
            pred_mode= check_intra_pred_mode(h, get_ue_golomb(&s->gb));
4459
            pred_mode= check_intra_pred_mode(h, get_ue_golomb_31(&s->gb));
4460 4460
            if(pred_mode < 0)
4461 4461
                return -1;
4462 4462
            h->chroma_pred_mode= pred_mode;
......
4466 4466

  
4467 4467
        if(h->slice_type_nos == FF_B_TYPE){
4468 4468
            for(i=0; i<4; i++){
4469
                h->sub_mb_type[i]= get_ue_golomb(&s->gb);
4469
                h->sub_mb_type[i]= get_ue_golomb_31(&s->gb);
4470 4470
                if(h->sub_mb_type[i] >=13){
4471 4471
                    av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y);
4472 4472
                    return -1;
......
4485 4485
        }else{
4486 4486
            assert(h->slice_type_nos == FF_P_TYPE); //FIXME SP correct ?
4487 4487
            for(i=0; i<4; i++){
4488
                h->sub_mb_type[i]= get_ue_golomb(&s->gb);
4488
                h->sub_mb_type[i]= get_ue_golomb_31(&s->gb);
4489 4489
                if(h->sub_mb_type[i] >=4){
4490 4490
                    av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y);
4491 4491
                    return -1;
......
6843 6843
static inline int decode_hrd_parameters(H264Context *h, SPS *sps){
6844 6844
    MpegEncContext * const s = &h->s;
6845 6845
    int cpb_count, i;
6846
    cpb_count = get_ue_golomb(&s->gb) + 1;
6846
    cpb_count = get_ue_golomb_31(&s->gb) + 1;
6847 6847

  
6848 6848
    if(cpb_count > 32U){
6849 6849
        av_log(h->s.avctx, AV_LOG_ERROR, "cpb_count %d invalid\n", cpb_count);
......
7003 7003
    get_bits1(&s->gb);   //constraint_set3_flag
7004 7004
    get_bits(&s->gb, 4); // reserved
7005 7005
    level_idc= get_bits(&s->gb, 8);
7006
    sps_id= get_ue_golomb(&s->gb);
7006
    sps_id= get_ue_golomb_31(&s->gb);
7007 7007

  
7008 7008
    if(sps_id >= MAX_SPS_COUNT) {
7009 7009
        av_log(h->s.avctx, AV_LOG_ERROR, "sps_id (%d) out of range\n", sps_id);
......
7021 7021
    sps->scaling_matrix_present = 0;
7022 7022

  
7023 7023
    if(sps->profile_idc >= 100){ //high profile
7024
        sps->chroma_format_idc= get_ue_golomb(&s->gb);
7024
        sps->chroma_format_idc= get_ue_golomb_31(&s->gb);
7025 7025
        if(sps->chroma_format_idc == 3)
7026 7026
            get_bits1(&s->gb);  //residual_color_transform_flag
7027 7027
        get_ue_golomb(&s->gb);  //bit_depth_luma_minus8
......
7033 7033
    }
7034 7034

  
7035 7035
    sps->log2_max_frame_num= get_ue_golomb(&s->gb) + 4;
7036
    sps->poc_type= get_ue_golomb(&s->gb);
7036
    sps->poc_type= get_ue_golomb_31(&s->gb);
7037 7037

  
7038 7038
    if(sps->poc_type == 0){ //FIXME #define
7039 7039
        sps->log2_max_poc_lsb= get_ue_golomb(&s->gb) + 4;
......
7055 7055
        goto fail;
7056 7056
    }
7057 7057

  
7058
    sps->ref_frame_count= get_ue_golomb(&s->gb);
7058
    sps->ref_frame_count= get_ue_golomb_31(&s->gb);
7059 7059
    if(sps->ref_frame_count > MAX_PICTURE_COUNT-2 || sps->ref_frame_count >= 32U){
7060 7060
        av_log(h->s.avctx, AV_LOG_ERROR, "too many reference frames\n");
7061 7061
        goto fail;
......
7147 7147
    pps= av_mallocz(sizeof(PPS));
7148 7148
    if(pps == NULL)
7149 7149
        return -1;
7150
    pps->sps_id= get_ue_golomb(&s->gb);
7150
    pps->sps_id= get_ue_golomb_31(&s->gb);
7151 7151
    if((unsigned)pps->sps_id>=MAX_SPS_COUNT || h->sps_buffers[pps->sps_id] == NULL){
7152 7152
        av_log(h->s.avctx, AV_LOG_ERROR, "sps_id out of range\n");
7153 7153
        goto fail;

Also available in: Unified diff