static int parse_ptl(HEVCContext *s, PTL *ptl, int max_num_sub_layers)

{

    int i;

    HEVCLocalContext *lc = s->HEVClc;

    GetBitContext *gb = &lc->gb;

    decode_profile_tier_level(s, &ptl->general_PTL);

    ptl->general_PTL.level_idc = get_bits(gb, 8);



    for (i = 0; i < max_num_sub_layers - 1; i++) {

        ptl->sub_layer_profile_present_flag[i] = get_bits1(gb);

        ptl->sub_layer_level_present_flag[i]   = get_bits1(gb);

    }

    if (max_num_sub_layers - 1> 0)

        for (i = max_num_sub_layers - 1; i < 8; i++)

            skip_bits(gb, 2); // reserved_zero_2bits[i]

    for (i = 0; i < max_num_sub_layers - 1; i++) {

        if (ptl->sub_layer_profile_present_flag[i])

            decode_profile_tier_level(s, &ptl->sub_layer_PTL[i]);

        if (ptl->sub_layer_level_present_flag[i])

            ptl->sub_layer_PTL[i].level_idc = get_bits(gb, 8);

    }

    return 0;

}

static int parse_ptl(HEVCContext *s, PTL *ptl, int max_num_sub_layers)

{

    int i;

    HEVCLocalContext *lc = s->HEVClc;

    GetBitContext *gb = &lc->gb;

    decode_profile_tier_level(s, &ptl->general_PTL);

    ptl->general_PTL.level_idc = get_bits(gb, 8);



    for (i = 0; i < max_num_sub_layers - 1; i++) {

        ptl->sub_layer_profile_present_flag[i] = get_bits1(gb);

        ptl->sub_layer_level_present_flag[i]   = get_bits1(gb);

    }

    if (max_num_sub_layers - 1> 0)

        for (i = max_num_sub_layers - 1; i < 8; i++)

            skip_bits(gb, 2); 

    for (i = 0; i < max_num_sub_layers - 1; i++) {

        if (ptl->sub_layer_profile_present_flag[i])

            decode_profile_tier_level(s, &ptl->sub_layer_PTL[i]);

        if (ptl->sub_layer_level_present_flag[i])

            ptl->sub_layer_PTL[i].level_idc = get_bits(gb, 8);

    }

    return 0;

}

static int FUNC_0(HEVCContext *VAR_0, PTL *VAR_1, int VAR_2)

{

    int VAR_3;

    HEVCLocalContext *lc = VAR_0->HEVClc;

    GetBitContext *gb = &lc->gb;

    decode_profile_tier_level(VAR_0, &VAR_1->general_PTL);

    VAR_1->general_PTL.level_idc = get_bits(gb, 8);



    for (VAR_3 = 0; VAR_3 < VAR_2 - 1; VAR_3++) {

        VAR_1->sub_layer_profile_present_flag[VAR_3] = get_bits1(gb);

        VAR_1->sub_layer_level_present_flag[VAR_3]   = get_bits1(gb);

    }

    if (VAR_2 - 1> 0)

        for (VAR_3 = VAR_2 - 1; VAR_3 < 8; VAR_3++)

            skip_bits(gb, 2); 

    for (VAR_3 = 0; VAR_3 < VAR_2 - 1; VAR_3++) {

        if (VAR_1->sub_layer_profile_present_flag[VAR_3])

            decode_profile_tier_level(VAR_0, &VAR_1->sub_layer_PTL[VAR_3]);

        if (VAR_1->sub_layer_level_present_flag[VAR_3])

            VAR_1->sub_layer_PTL[VAR_3].level_idc = get_bits(gb, 8);

    }

    return 0;

}

static int FUNC_0(HEVCContext *VAR_0, PTL *VAR_1, int VAR_2)
{ int VAR_3; HEVCLocalContext *lc = VAR_0->HEVClc; GetBitContext *gb = &lc->gb; decode_profile_tier_level(VAR_0, &VAR_1->general_PTL); VAR_1->general_PTL.level_idc = get_bits(gb, 8); for (VAR_3 = 0; VAR_3 < VAR_2 - 1; VAR_3++) { VAR_1->sub_layer_profile_present_flag[VAR_3] = get_bits1(gb); VAR_1->sub_layer_level_present_flag[VAR_3]   = get_bits1(gb); } if (VAR_2 - 1> 0)
for (VAR_3 = VAR_2 - 1; VAR_3 < 8; VAR_3++) skip_bits(gb, 2); for (VAR_3 = 0; VAR_3 < VAR_2 - 1; VAR_3++) { if (VAR_1->sub_layer_profile_present_flag[VAR_3])
decode_profile_tier_level(VAR_0, &VAR_1->sub_layer_PTL[VAR_3]); if (VAR_1->sub_layer_level_present_flag[VAR_3])
VAR_1->sub_layer_PTL[VAR_3].level_idc = get_bits(gb, 8); } return 0; }