Revision d268bed2 libavcodec/h264_cavlc.c

View differences:

libavcodec/h264_cavlc.c
921 921
        int dquant;
922 922
        GetBitContext *gb= IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr;
923 923
        const uint8_t *scan, *scan8x8;
924
        const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8);
924 925

  
925 926
        if(IS_INTERLACED(mb_type)){
926 927
            scan8x8= s->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0;
......
934 935

  
935 936
        s->qscale += dquant;
936 937

  
937
        if(((unsigned)s->qscale) > 51){
938
            if(s->qscale<0) s->qscale+= 52;
939
            else            s->qscale-= 52;
940
            if(((unsigned)s->qscale) > 51){
938
        if(((unsigned)s->qscale) > max_qp){
939
            if(s->qscale<0) s->qscale+= max_qp+1;
940
            else            s->qscale-= max_qp+1;
941
            if(((unsigned)s->qscale) > max_qp){
941 942
                av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y);
942 943
                return -1;
943 944
            }

Also available in: Unified diff