static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb,

                           void *logctx)

{

    H264PredWeightTable pwt;

    int slice_type_nos = s->pict_type & 3;

    H264ParseContext *p = s->priv_data;

    int list_count, ref_count[2];





    if (p->ps.pps->redundant_pic_cnt_present)

        get_ue_golomb(gb); // redundant_pic_count



    if (slice_type_nos == AV_PICTURE_TYPE_B)

        get_bits1(gb); // direct_spatial_mv_pred



    if (ff_h264_parse_ref_count(&list_count, ref_count, gb, p->ps.pps,

                                slice_type_nos, p->picture_structure, logctx) < 0)

        return AVERROR_INVALIDDATA;



    if (slice_type_nos != AV_PICTURE_TYPE_I) {

        int list;

        for (list = 0; list < list_count; list++) {

            if (get_bits1(gb)) {

                int index;

                for (index = 0; ; index++) {

                    unsigned int reordering_of_pic_nums_idc = get_ue_golomb_31(gb);



                    if (reordering_of_pic_nums_idc < 3)

                        get_ue_golomb_long(gb);

                    else if (reordering_of_pic_nums_idc > 3) {

                        av_log(logctx, AV_LOG_ERROR,

                               "illegal reordering_of_pic_nums_idc %d\n",

                               reordering_of_pic_nums_idc);

                        return AVERROR_INVALIDDATA;

                    } else

                        break;



                    if (index >= ref_count[list]) {

                        av_log(logctx, AV_LOG_ERROR,

                               "reference count %d overflow\n", index);

                        return AVERROR_INVALIDDATA;

                    }

                }

            }

        }

    }



    if ((p->ps.pps->weighted_pred && slice_type_nos == AV_PICTURE_TYPE_P) ||

        (p->ps.pps->weighted_bipred_idc == 1 && slice_type_nos == AV_PICTURE_TYPE_B))

        ff_h264_pred_weight_table(gb, p->ps.sps, ref_count, slice_type_nos,

                                  &pwt, logctx);



    if (get_bits1(gb)) { // adaptive_ref_pic_marking_mode_flag

        int i;

        for (i = 0; i < MAX_MMCO_COUNT; i++) {

            MMCOOpcode opcode = get_ue_golomb_31(gb);

            if (opcode > (unsigned) MMCO_LONG) {

                av_log(logctx, AV_LOG_ERROR,

                       "illegal memory management control operation %d\n",

                       opcode);

                return AVERROR_INVALIDDATA;

            }

            if (opcode == MMCO_END)

               return 0;

            else if (opcode == MMCO_RESET)

                return 1;



            if (opcode == MMCO_SHORT2UNUSED || opcode == MMCO_SHORT2LONG)

                get_ue_golomb_long(gb); // difference_of_pic_nums_minus1

            if (opcode == MMCO_SHORT2LONG || opcode == MMCO_LONG2UNUSED ||

                opcode == MMCO_LONG || opcode == MMCO_SET_MAX_LONG)

                get_ue_golomb_31(gb);

        }

    }



    return 0;

}

static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb,

                           void *logctx)

{

    H264PredWeightTable pwt;

    int slice_type_nos = s->pict_type & 3;

    H264ParseContext *p = s->priv_data;

    int list_count, ref_count[2];





    if (p->ps.pps->redundant_pic_cnt_present)

        get_ue_golomb(gb); 



    if (slice_type_nos == AV_PICTURE_TYPE_B)

        get_bits1(gb); 



    if (ff_h264_parse_ref_count(&list_count, ref_count, gb, p->ps.pps,

                                slice_type_nos, p->picture_structure, logctx) < 0)

        return AVERROR_INVALIDDATA;



    if (slice_type_nos != AV_PICTURE_TYPE_I) {

        int list;

        for (list = 0; list < list_count; list++) {

            if (get_bits1(gb)) {

                int index;

                for (index = 0; ; index++) {

                    unsigned int reordering_of_pic_nums_idc = get_ue_golomb_31(gb);



                    if (reordering_of_pic_nums_idc < 3)

                        get_ue_golomb_long(gb);

                    else if (reordering_of_pic_nums_idc > 3) {

                        av_log(logctx, AV_LOG_ERROR,

                               "illegal reordering_of_pic_nums_idc %d\n",

                               reordering_of_pic_nums_idc);

                        return AVERROR_INVALIDDATA;

                    } else

                        break;



                    if (index >= ref_count[list]) {

                        av_log(logctx, AV_LOG_ERROR,

                               "reference count %d overflow\n", index);

                        return AVERROR_INVALIDDATA;

                    }

                }

            }

        }

    }



    if ((p->ps.pps->weighted_pred && slice_type_nos == AV_PICTURE_TYPE_P) ||

        (p->ps.pps->weighted_bipred_idc == 1 && slice_type_nos == AV_PICTURE_TYPE_B))

        ff_h264_pred_weight_table(gb, p->ps.sps, ref_count, slice_type_nos,

                                  &pwt, logctx);



    if (get_bits1(gb)) { 

        int i;

        for (i = 0; i < MAX_MMCO_COUNT; i++) {

            MMCOOpcode opcode = get_ue_golomb_31(gb);

            if (opcode > (unsigned) MMCO_LONG) {

                av_log(logctx, AV_LOG_ERROR,

                       "illegal memory management control operation %d\n",

                       opcode);

                return AVERROR_INVALIDDATA;

            }

            if (opcode == MMCO_END)

               return 0;

            else if (opcode == MMCO_RESET)

                return 1;



            if (opcode == MMCO_SHORT2UNUSED || opcode == MMCO_SHORT2LONG)

                get_ue_golomb_long(gb); 

            if (opcode == MMCO_SHORT2LONG || opcode == MMCO_LONG2UNUSED ||

                opcode == MMCO_LONG || opcode == MMCO_SET_MAX_LONG)

                get_ue_golomb_31(gb);

        }

    }



    return 0;

}

                                  &pwt, logctx);
static int FUNC_0(AVCodecParserContext *VAR_0, GetBitContext *VAR_1,

                           void *VAR_2)

{

    H264PredWeightTable pwt;

    int VAR_3 = VAR_0->pict_type & 3;

    H264ParseContext *p = VAR_0->priv_data;

    int VAR_4, VAR_5[2];





    if (p->ps.pps->redundant_pic_cnt_present)

        get_ue_golomb(VAR_1); 



    if (VAR_3 == AV_PICTURE_TYPE_B)

        get_bits1(VAR_1); 



    if (ff_h264_parse_ref_count(&VAR_4, VAR_5, VAR_1, p->ps.pps,

                                VAR_3, p->picture_structure, VAR_2) < 0)

        return AVERROR_INVALIDDATA;



    if (VAR_3 != AV_PICTURE_TYPE_I) {

        int VAR_6;

        for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6++) {

            if (get_bits1(VAR_1)) {

                int VAR_7;

                for (VAR_7 = 0; ; VAR_7++) {

                    unsigned int VAR_8 = get_ue_golomb_31(VAR_1);



                    if (VAR_8 < 3)

                        get_ue_golomb_long(VAR_1);

                    else if (VAR_8 > 3) {

                        av_log(VAR_2, AV_LOG_ERROR,

                               "illegal VAR_8 %d\n",

                               VAR_8);

                        return AVERROR_INVALIDDATA;

                    } else

                        break;



                    if (VAR_7 >= VAR_5[VAR_6]) {

                        av_log(VAR_2, AV_LOG_ERROR,

                               "reference count %d overflow\n", VAR_7);

                        return AVERROR_INVALIDDATA;

                    }

                }

            }

        }

    }



    if ((p->ps.pps->weighted_pred && VAR_3 == AV_PICTURE_TYPE_P) ||

        (p->ps.pps->weighted_bipred_idc == 1 && VAR_3 == AV_PICTURE_TYPE_B))

        ff_h264_pred_weight_table(VAR_1, p->ps.sps, VAR_5, VAR_3,

                                  &pwt, VAR_2);



    if (get_bits1(VAR_1)) { 

        int VAR_9;

        for (VAR_9 = 0; VAR_9 < MAX_MMCO_COUNT; VAR_9++) {

            MMCOOpcode opcode = get_ue_golomb_31(VAR_1);

            if (opcode > (unsigned) MMCO_LONG) {

                av_log(VAR_2, AV_LOG_ERROR,

                       "illegal memory management control operation %d\n",

                       opcode);

                return AVERROR_INVALIDDATA;

            }

            if (opcode == MMCO_END)

               return 0;

            else if (opcode == MMCO_RESET)

                return 1;



            if (opcode == MMCO_SHORT2UNUSED || opcode == MMCO_SHORT2LONG)

                get_ue_golomb_long(VAR_1); 

            if (opcode == MMCO_SHORT2LONG || opcode == MMCO_LONG2UNUSED ||

                opcode == MMCO_LONG || opcode == MMCO_SET_MAX_LONG)

                get_ue_golomb_31(VAR_1);

        }

    }



    return 0;

}

static int FUNC_0(AVCodecParserContext *VAR_0, GetBitContext *VAR_1,
void *VAR_2)
{ H264PredWeightTable pwt; int VAR_3 = VAR_0->pict_type & 3; H264ParseContext *p = VAR_0->priv_data; int VAR_4, VAR_5[2]; if (p->ps.pps->redundant_pic_cnt_present)
get_ue_golomb(VAR_1); if (VAR_3 == AV_PICTURE_TYPE_B)
get_bits1(VAR_1); if (ff_h264_parse_ref_count(&VAR_4, VAR_5, VAR_1, p->ps.pps,
VAR_3, p->picture_structure, VAR_2) < 0)
return AVERROR_INVALIDDATA; if (VAR_3 != AV_PICTURE_TYPE_I) { int VAR_6; for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6++) { if (get_bits1(VAR_1)) { int VAR_7; for (VAR_7 = 0; ; VAR_7++) { unsigned int VAR_8 = get_ue_golomb_31(VAR_1); if (VAR_8 < 3)
get_ue_golomb_long(VAR_1); else if (VAR_8 > 3) { av_log(VAR_2, AV_LOG_ERROR,
"illegal VAR_8 %d\n",
VAR_8); return AVERROR_INVALIDDATA; } else break; if (VAR_7 >= VAR_5[VAR_6]) { av_log(VAR_2, AV_LOG_ERROR,
"reference count %d overflow\n", VAR_7); return AVERROR_INVALIDDATA; } } } } } if ((p->ps.pps->weighted_pred && VAR_3 == AV_PICTURE_TYPE_P) ||
(p->ps.pps->weighted_bipred_idc == 1 && VAR_3 == AV_PICTURE_TYPE_B))
ff_h264_pred_weight_table(VAR_1, p->ps.sps, VAR_5, VAR_3,
&pwt, VAR_2); if (get_bits1(VAR_1)) { int VAR_9; for (VAR_9 = 0; VAR_9 < MAX_MMCO_COUNT; VAR_9++) { MMCOOpcode opcode = get_ue_golomb_31(VAR_1); if (opcode > (unsigned) MMCO_LONG) { av_log(VAR_2, AV_LOG_ERROR,
"illegal memory management control operation %d\n",
opcode); return AVERROR_INVALIDDATA; } if (opcode == MMCO_END)
return 0; else if (opcode == MMCO_RESET)
return 1; if (opcode == MMCO_SHORT2UNUSED || opcode == MMCO_SHORT2LONG)
get_ue_golomb_long(VAR_1); if (opcode == MMCO_SHORT2LONG || opcode == MMCO_LONG2UNUSED ||
opcode == MMCO_LONG || opcode == MMCO_SET_MAX_LONG)
get_ue_golomb_31(VAR_1); } } return 0; }