static void vp6_parse_coeff(VP56Context *s)

{

    VP56RangeCoder *c = s->ccp;

    VP56Model *model = s->modelp;

    uint8_t *permute = s->scantable.permutated;

    uint8_t *model1, *model2, *model3;

    int coeff, sign, coeff_idx;

    int b, i, cg, idx, ctx;

    int pt = 0;    /* plane type (0 for Y, 1 for U or V) */



    for (b=0; b<6; b++) {

        int ct = 1;    /* code type */

        int run = 1;



        if (b > 3) pt = 1;



        ctx = s->left_block[vp56_b6to4[b]].not_null_dc

              + s->above_blocks[s->above_block_idx[b]].not_null_dc;

        model1 = model->coeff_dccv[pt];

        model2 = model->coeff_dcct[pt][ctx];



        for (coeff_idx=0; coeff_idx<64; ) {

            if ((coeff_idx>1 && ct==0) || vp56_rac_get_prob(c, model2[0])) {

                /* parse a coeff */

                if (vp56_rac_get_prob(c, model2[2])) {

                    if (vp56_rac_get_prob(c, model2[3])) {

                        idx = vp56_rac_get_tree(c, vp56_pc_tree, model1);

                        coeff = vp56_coeff_bias[idx+5];

                        for (i=vp56_coeff_bit_length[idx]; i>=0; i--)

                            coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i;

                    } else {

                        if (vp56_rac_get_prob(c, model2[4]))

                            coeff = 3 + vp56_rac_get_prob(c, model1[5]);

                        else

                            coeff = 2;

                    }

                    ct = 2;

                } else {

                    ct = 1;

                    coeff = 1;

                }

                sign = vp56_rac_get(c);

                coeff = (coeff ^ -sign) + sign;

                if (coeff_idx)

                    coeff *= s->dequant_ac;

                idx = model->coeff_index_to_pos[coeff_idx];

                s->block_coeff[b][permute[idx]] = coeff;

                run = 1;

            } else {

                /* parse a run */

                ct = 0;

                if (coeff_idx > 0) {

                    if (!vp56_rac_get_prob(c, model2[1]))

                        break;



                    model3 = model->coeff_runv[coeff_idx >= 6];

                    run = vp56_rac_get_tree(c, vp6_pcr_tree, model3);

                    if (!run)

                        for (run=9, i=0; i<6; i++)

                            run += vp56_rac_get_prob(c, model3[i+8]) << i;

                }

            }



            cg = vp6_coeff_groups[coeff_idx+=run];

            model1 = model2 = model->coeff_ract[pt][ct][cg];

        }



        s->left_block[vp56_b6to4[b]].not_null_dc =

        s->above_blocks[s->above_block_idx[b]].not_null_dc = !!s->block_coeff[b][0];

    }

}

static void vp6_parse_coeff(VP56Context *s)

{

    VP56RangeCoder *c = s->ccp;

    VP56Model *model = s->modelp;

    uint8_t *permute = s->scantable.permutated;

    uint8_t *model1, *model2, *model3;

    int coeff, sign, coeff_idx;

    int b, i, cg, idx, ctx;

    int pt = 0;    



    for (b=0; b<6; b++) {

        int ct = 1;    

        int run = 1;



        if (b > 3) pt = 1;



        ctx = s->left_block[vp56_b6to4[b]].not_null_dc

              + s->above_blocks[s->above_block_idx[b]].not_null_dc;

        model1 = model->coeff_dccv[pt];

        model2 = model->coeff_dcct[pt][ctx];



        for (coeff_idx=0; coeff_idx<64; ) {

            if ((coeff_idx>1 && ct==0) || vp56_rac_get_prob(c, model2[0])) {

                

                if (vp56_rac_get_prob(c, model2[2])) {

                    if (vp56_rac_get_prob(c, model2[3])) {

                        idx = vp56_rac_get_tree(c, vp56_pc_tree, model1);

                        coeff = vp56_coeff_bias[idx+5];

                        for (i=vp56_coeff_bit_length[idx]; i>=0; i--)

                            coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i;

                    } else {

                        if (vp56_rac_get_prob(c, model2[4]))

                            coeff = 3 + vp56_rac_get_prob(c, model1[5]);

                        else

                            coeff = 2;

                    }

                    ct = 2;

                } else {

                    ct = 1;

                    coeff = 1;

                }

                sign = vp56_rac_get(c);

                coeff = (coeff ^ -sign) + sign;

                if (coeff_idx)

                    coeff *= s->dequant_ac;

                idx = model->coeff_index_to_pos[coeff_idx];

                s->block_coeff[b][permute[idx]] = coeff;

                run = 1;

            } else {

                

                ct = 0;

                if (coeff_idx > 0) {

                    if (!vp56_rac_get_prob(c, model2[1]))

                        break;



                    model3 = model->coeff_runv[coeff_idx >= 6];

                    run = vp56_rac_get_tree(c, vp6_pcr_tree, model3);

                    if (!run)

                        for (run=9, i=0; i<6; i++)

                            run += vp56_rac_get_prob(c, model3[i+8]) << i;

                }

            }



            cg = vp6_coeff_groups[coeff_idx+=run];

            model1 = model2 = model->coeff_ract[pt][ct][cg];

        }



        s->left_block[vp56_b6to4[b]].not_null_dc =

        s->above_blocks[s->above_block_idx[b]].not_null_dc = !!s->block_coeff[b][0];

    }

}

        for (coeff_idx=0; coeff_idx<64; ) {             cg = vp6_coeff_groups[coeff_idx+=run];
static void FUNC_0(VP56Context *VAR_0)

{

    VP56RangeCoder *c = VAR_0->ccp;

    VP56Model *model = VAR_0->modelp;

    uint8_t *permute = VAR_0->scantable.permutated;

    uint8_t *model1, *model2, *model3;

    int VAR_1, VAR_2, VAR_3;

    int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;

    int VAR_9 = 0;    



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

        int VAR_10 = 1;    

        int VAR_11 = 1;



        if (VAR_4 > 3) VAR_9 = 1;



        VAR_8 = VAR_0->left_block[vp56_b6to4[VAR_4]].not_null_dc

              + VAR_0->above_blocks[VAR_0->above_block_idx[VAR_4]].not_null_dc;

        model1 = model->coeff_dccv[VAR_9];

        model2 = model->coeff_dcct[VAR_9][VAR_8];



        for (VAR_3=0; VAR_3<64; ) {

            if ((VAR_3>1 && VAR_10==0) || vp56_rac_get_prob(c, model2[0])) {

                

                if (vp56_rac_get_prob(c, model2[2])) {

                    if (vp56_rac_get_prob(c, model2[3])) {

                        VAR_7 = vp56_rac_get_tree(c, vp56_pc_tree, model1);

                        VAR_1 = vp56_coeff_bias[VAR_7+5];

                        for (VAR_5=vp56_coeff_bit_length[VAR_7]; VAR_5>=0; VAR_5--)

                            VAR_1 += vp56_rac_get_prob(c, vp56_coeff_parse_table[VAR_7][VAR_5]) << VAR_5;

                    } else {

                        if (vp56_rac_get_prob(c, model2[4]))

                            VAR_1 = 3 + vp56_rac_get_prob(c, model1[5]);

                        else

                            VAR_1 = 2;

                    }

                    VAR_10 = 2;

                } else {

                    VAR_10 = 1;

                    VAR_1 = 1;

                }

                VAR_2 = vp56_rac_get(c);

                VAR_1 = (VAR_1 ^ -VAR_2) + VAR_2;

                if (VAR_3)

                    VAR_1 *= VAR_0->dequant_ac;

                VAR_7 = model->coeff_index_to_pos[VAR_3];

                VAR_0->block_coeff[VAR_4][permute[VAR_7]] = VAR_1;

                VAR_11 = 1;

            } else {

                

                VAR_10 = 0;

                if (VAR_3 > 0) {

                    if (!vp56_rac_get_prob(c, model2[1]))

                        break;



                    model3 = model->coeff_runv[VAR_3 >= 6];

                    VAR_11 = vp56_rac_get_tree(c, vp6_pcr_tree, model3);

                    if (!VAR_11)

                        for (VAR_11=9, VAR_5=0; VAR_5<6; VAR_5++)

                            VAR_11 += vp56_rac_get_prob(c, model3[VAR_5+8]) << VAR_5;

                }

            }



            VAR_6 = vp6_coeff_groups[VAR_3+=VAR_11];

            model1 = model2 = model->coeff_ract[VAR_9][VAR_10][VAR_6];

        }



        VAR_0->left_block[vp56_b6to4[VAR_4]].not_null_dc =

        VAR_0->above_blocks[VAR_0->above_block_idx[VAR_4]].not_null_dc = !!VAR_0->block_coeff[VAR_4][0];

    }

}

static void FUNC_0(VP56Context *VAR_0)
{ VP56RangeCoder *c = VAR_0->ccp; VP56Model *model = VAR_0->modelp; uint8_t *permute = VAR_0->scantable.permutated; uint8_t *model1, *model2, *model3; int VAR_1, VAR_2, VAR_3; int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8; int VAR_9 = 0; for (VAR_4=0; VAR_4<6; VAR_4++) { int VAR_10 = 1; int VAR_11 = 1; if (VAR_4 > 3) VAR_9 = 1; VAR_8 = VAR_0->left_block[vp56_b6to4[VAR_4]].not_null_dc
+ VAR_0->above_blocks[VAR_0->above_block_idx[VAR_4]].not_null_dc; model1 = model->coeff_dccv[VAR_9]; model2 = model->coeff_dcct[VAR_9][VAR_8]; for (VAR_3=0; VAR_3<64; ) { if ((VAR_3>1 && VAR_10==0) || vp56_rac_get_prob(c, model2[0])) { if (vp56_rac_get_prob(c, model2[2])) { if (vp56_rac_get_prob(c, model2[3])) { VAR_7 = vp56_rac_get_tree(c, vp56_pc_tree, model1); VAR_1 = vp56_coeff_bias[VAR_7+5]; for (VAR_5=vp56_coeff_bit_length[VAR_7]; VAR_5>=0; VAR_5--) VAR_1 += vp56_rac_get_prob(c, vp56_coeff_parse_table[VAR_7][VAR_5]) << VAR_5; } else { if (vp56_rac_get_prob(c, model2[4]))
VAR_1 = 3 + vp56_rac_get_prob(c, model1[5]); else
VAR_1 = 2; } VAR_10 = 2; } else { VAR_10 = 1; VAR_1 = 1; } VAR_2 = vp56_rac_get(c); VAR_1 = (VAR_1 ^ -VAR_2) + VAR_2; if (VAR_3)
VAR_1 *= VAR_0->dequant_ac; VAR_7 = model->coeff_index_to_pos[VAR_3]; VAR_0->block_coeff[VAR_4][permute[VAR_7]] = VAR_1; VAR_11 = 1; } else { VAR_10 = 0; if (VAR_3 > 0) { if (!vp56_rac_get_prob(c, model2[1]))
break; model3 = model->coeff_runv[VAR_3 >= 6]; VAR_11 = vp56_rac_get_tree(c, vp6_pcr_tree, model3); if (!VAR_11)
for (VAR_11=9, VAR_5=0; VAR_5<6; VAR_5++) VAR_11 += vp56_rac_get_prob(c, model3[VAR_5+8]) << VAR_5; } } VAR_6 = vp6_coeff_groups[VAR_3+=VAR_11]; model1 = model2 = model->coeff_ract[VAR_9][VAR_10][VAR_6]; } VAR_0->left_block[vp56_b6to4[VAR_4]].not_null_dc =
VAR_0->above_blocks[VAR_0->above_block_idx[VAR_4]].not_null_dc = !!VAR_0->block_coeff[VAR_4][0]; } }