void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_t *segment, uint8_t *ref)

{

    VP56RangeCoder *c = &s->c;



    if (s->segmentation.update_map)

        *segment = vp8_rac_get_tree(c, vp8_segmentid_tree, s->prob->segmentid);

    else

        *segment = ref ? *ref : *segment;

    s->segment = *segment;



    mb->skip = s->mbskip_enabled ? vp56_rac_get_prob(c, s->prob->mbskip) : 0;



    if (s->keyframe) {

        mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_intra, vp8_pred16x16_prob_intra);



        if (mb->mode == MODE_I4x4) {

            decode_intra4x4_modes(s, c, mb_x, 1);

        } else {

            const uint32_t modes = vp8_pred4x4_mode[mb->mode] * 0x01010101u;

            AV_WN32A(s->intra4x4_pred_mode_top + 4 * mb_x, modes);

            AV_WN32A(s->intra4x4_pred_mode_left, modes);

        }



        s->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, vp8_pred8x8c_prob_intra);

        mb->ref_frame = VP56_FRAME_CURRENT;

    } else if (vp56_rac_get_prob_branchy(c, s->prob->intra)) {

        // inter MB, 16.2

        if (vp56_rac_get_prob_branchy(c, s->prob->last))

            mb->ref_frame = vp56_rac_get_prob(c, s->prob->golden) ?

                VP56_FRAME_GOLDEN2 /* altref */ : VP56_FRAME_GOLDEN;

        else

            mb->ref_frame = VP56_FRAME_PREVIOUS;

        s->ref_count[mb->ref_frame-1]++;



        // motion vectors, 16.3

        decode_mvs(s, mb, mb_x, mb_y);

    } else {

        // intra MB, 16.1

        mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_inter, s->prob->pred16x16);



        if (mb->mode == MODE_I4x4)

            decode_intra4x4_modes(s, c, mb_x, 0);



        s->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, s->prob->pred8x8c);

        mb->ref_frame = VP56_FRAME_CURRENT;

        mb->partitioning = VP8_SPLITMVMODE_NONE;

        AV_ZERO32(&mb->bmv[0]);

    }

}

void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_t *segment, uint8_t *ref)

{

    VP56RangeCoder *c = &s->c;



    if (s->segmentation.update_map)

        *segment = vp8_rac_get_tree(c, vp8_segmentid_tree, s->prob->segmentid);

    else

        *segment = ref ? *ref : *segment;

    s->segment = *segment;



    mb->skip = s->mbskip_enabled ? vp56_rac_get_prob(c, s->prob->mbskip) : 0;



    if (s->keyframe) {

        mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_intra, vp8_pred16x16_prob_intra);



        if (mb->mode == MODE_I4x4) {

            decode_intra4x4_modes(s, c, mb_x, 1);

        } else {

            const uint32_t modes = vp8_pred4x4_mode[mb->mode] * 0x01010101u;

            AV_WN32A(s->intra4x4_pred_mode_top + 4 * mb_x, modes);

            AV_WN32A(s->intra4x4_pred_mode_left, modes);

        }



        s->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, vp8_pred8x8c_prob_intra);

        mb->ref_frame = VP56_FRAME_CURRENT;

    } else if (vp56_rac_get_prob_branchy(c, s->prob->intra)) {

        

        if (vp56_rac_get_prob_branchy(c, s->prob->last))

            mb->ref_frame = vp56_rac_get_prob(c, s->prob->golden) ?

                VP56_FRAME_GOLDEN2  : VP56_FRAME_GOLDEN;

        else

            mb->ref_frame = VP56_FRAME_PREVIOUS;

        s->ref_count[mb->ref_frame-1]++;



        

        decode_mvs(s, mb, mb_x, mb_y);

    } else {

        

        mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_inter, s->prob->pred16x16);



        if (mb->mode == MODE_I4x4)

            decode_intra4x4_modes(s, c, mb_x, 0);



        s->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, s->prob->pred8x8c);

        mb->ref_frame = VP56_FRAME_CURRENT;

        mb->partitioning = VP8_SPLITMVMODE_NONE;

        AV_ZERO32(&mb->bmv[0]);

    }

}

void FUNC_0(VP8Context *VAR_0, VP8Macroblock *VAR_1, int VAR_2, int VAR_3, uint8_t *VAR_4, uint8_t *VAR_5)

{

    VP56RangeCoder *c = &VAR_0->c;



    if (VAR_0->segmentation.update_map)

        *VAR_4 = vp8_rac_get_tree(c, vp8_segmentid_tree, VAR_0->prob->segmentid);

    else

        *VAR_4 = VAR_5 ? *VAR_5 : *VAR_4;

    VAR_0->VAR_4 = *VAR_4;



    VAR_1->skip = VAR_0->mbskip_enabled ? vp56_rac_get_prob(c, VAR_0->prob->mbskip) : 0;



    if (VAR_0->keyframe) {

        VAR_1->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_intra, vp8_pred16x16_prob_intra);



        if (VAR_1->mode == MODE_I4x4) {

            decode_intra4x4_modes(VAR_0, c, VAR_2, 1);

        } else {

            const uint32_t VAR_6 = vp8_pred4x4_mode[VAR_1->mode] * 0x01010101u;

            AV_WN32A(VAR_0->intra4x4_pred_mode_top + 4 * VAR_2, VAR_6);

            AV_WN32A(VAR_0->intra4x4_pred_mode_left, VAR_6);

        }



        VAR_0->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, vp8_pred8x8c_prob_intra);

        VAR_1->ref_frame = VP56_FRAME_CURRENT;

    } else if (vp56_rac_get_prob_branchy(c, VAR_0->prob->intra)) {

        

        if (vp56_rac_get_prob_branchy(c, VAR_0->prob->last))

            VAR_1->ref_frame = vp56_rac_get_prob(c, VAR_0->prob->golden) ?

                VP56_FRAME_GOLDEN2  : VP56_FRAME_GOLDEN;

        else

            VAR_1->ref_frame = VP56_FRAME_PREVIOUS;

        VAR_0->ref_count[VAR_1->ref_frame-1]++;



        

        decode_mvs(VAR_0, VAR_1, VAR_2, VAR_3);

    } else {

        

        VAR_1->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_inter, VAR_0->prob->pred16x16);



        if (VAR_1->mode == MODE_I4x4)

            decode_intra4x4_modes(VAR_0, c, VAR_2, 0);



        VAR_0->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, VAR_0->prob->pred8x8c);

        VAR_1->ref_frame = VP56_FRAME_CURRENT;

        VAR_1->partitioning = VP8_SPLITMVMODE_NONE;

        AV_ZERO32(&VAR_1->bmv[0]);

    }

}

void FUNC_0(VP8Context *VAR_0, VP8Macroblock *VAR_1, int VAR_2, int VAR_3, uint8_t *VAR_4, uint8_t *VAR_5)
{ VP56RangeCoder *c = &VAR_0->c; if (VAR_0->segmentation.update_map)
*VAR_4 = vp8_rac_get_tree(c, vp8_segmentid_tree, VAR_0->prob->segmentid); else
*VAR_4 = VAR_5 ? *VAR_5 : *VAR_4; VAR_0->VAR_4 = *VAR_4; VAR_1->skip = VAR_0->mbskip_enabled ? vp56_rac_get_prob(c, VAR_0->prob->mbskip) : 0; if (VAR_0->keyframe) { VAR_1->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_intra, vp8_pred16x16_prob_intra); if (VAR_1->mode == MODE_I4x4) { decode_intra4x4_modes(VAR_0, c, VAR_2, 1); } else { const uint32_t VAR_6 = vp8_pred4x4_mode[VAR_1->mode] * 0x01010101u; AV_WN32A(VAR_0->intra4x4_pred_mode_top + 4 * VAR_2, VAR_6); AV_WN32A(VAR_0->intra4x4_pred_mode_left, VAR_6); } VAR_0->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, vp8_pred8x8c_prob_intra); VAR_1->ref_frame = VP56_FRAME_CURRENT; } else if (vp56_rac_get_prob_branchy(c, VAR_0->prob->intra)) { if (vp56_rac_get_prob_branchy(c, VAR_0->prob->last))
VAR_1->ref_frame = vp56_rac_get_prob(c, VAR_0->prob->golden) ?
VP56_FRAME_GOLDEN2  : VP56_FRAME_GOLDEN; else
VAR_1->ref_frame = VP56_FRAME_PREVIOUS; VAR_0->ref_count[VAR_1->ref_frame-1]++; decode_mvs(VAR_0, VAR_1, VAR_2, VAR_3); } else { VAR_1->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_inter, VAR_0->prob->pred16x16); if (VAR_1->mode == MODE_I4x4)
decode_intra4x4_modes(VAR_0, c, VAR_2, 0); VAR_0->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, VAR_0->prob->pred8x8c); VAR_1->ref_frame = VP56_FRAME_CURRENT; VAR_1->partitioning = VP8_SPLITMVMODE_NONE; AV_ZERO32(&VAR_1->bmv[0]); } }