Use rac_get_prob branchy version when used within a conditional branch.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		
							parent
							
								
									f1c167496e
								
							
						
					
					
						commit
						cef99e12bc
					
				@ -85,7 +85,7 @@ static void vp5_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
 | 
			
		||||
 | 
			
		||||
    for (comp=0; comp<2; comp++) {
 | 
			
		||||
        int delta = 0;
 | 
			
		||||
        if (vp56_rac_get_prob(c, model->vector_dct[comp])) {
 | 
			
		||||
        if (vp56_rac_get_prob_branchy(c, model->vector_dct[comp])) {
 | 
			
		||||
            int sign = vp56_rac_get_prob(c, model->vector_sig[comp]);
 | 
			
		||||
            di  = vp56_rac_get_prob(c, model->vector_pdi[comp][0]);
 | 
			
		||||
            di |= vp56_rac_get_prob(c, model->vector_pdi[comp][1]) << 1;
 | 
			
		||||
@ -108,19 +108,19 @@ static void vp5_parse_vector_models(VP56Context *s)
 | 
			
		||||
    int comp, node;
 | 
			
		||||
 | 
			
		||||
    for (comp=0; comp<2; comp++) {
 | 
			
		||||
        if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][0]))
 | 
			
		||||
        if (vp56_rac_get_prob_branchy(c, vp5_vmc_pct[comp][0]))
 | 
			
		||||
            model->vector_dct[comp] = vp56_rac_gets_nn(c, 7);
 | 
			
		||||
        if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][1]))
 | 
			
		||||
        if (vp56_rac_get_prob_branchy(c, vp5_vmc_pct[comp][1]))
 | 
			
		||||
            model->vector_sig[comp] = vp56_rac_gets_nn(c, 7);
 | 
			
		||||
        if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][2]))
 | 
			
		||||
        if (vp56_rac_get_prob_branchy(c, vp5_vmc_pct[comp][2]))
 | 
			
		||||
            model->vector_pdi[comp][0] = vp56_rac_gets_nn(c, 7);
 | 
			
		||||
        if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][3]))
 | 
			
		||||
        if (vp56_rac_get_prob_branchy(c, vp5_vmc_pct[comp][3]))
 | 
			
		||||
            model->vector_pdi[comp][1] = vp56_rac_gets_nn(c, 7);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    for (comp=0; comp<2; comp++)
 | 
			
		||||
        for (node=0; node<7; node++)
 | 
			
		||||
            if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][4 + node]))
 | 
			
		||||
            if (vp56_rac_get_prob_branchy(c, vp5_vmc_pct[comp][4 + node]))
 | 
			
		||||
                model->vector_pdv[comp][node] = vp56_rac_gets_nn(c, 7);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -137,7 +137,7 @@ static int vp5_parse_coeff_models(VP56Context *s)
 | 
			
		||||
 | 
			
		||||
    for (pt=0; pt<2; pt++)
 | 
			
		||||
        for (node=0; node<11; node++)
 | 
			
		||||
            if (vp56_rac_get_prob(c, vp5_dccv_pct[pt][node])) {
 | 
			
		||||
            if (vp56_rac_get_prob_branchy(c, vp5_dccv_pct[pt][node])) {
 | 
			
		||||
                def_prob[node] = vp56_rac_gets_nn(c, 7);
 | 
			
		||||
                model->coeff_dccv[pt][node] = def_prob[node];
 | 
			
		||||
            } else if (s->frames[VP56_FRAME_CURRENT]->key_frame) {
 | 
			
		||||
@ -148,7 +148,7 @@ static int vp5_parse_coeff_models(VP56Context *s)
 | 
			
		||||
        for (pt=0; pt<2; pt++)
 | 
			
		||||
            for (cg=0; cg<6; cg++)
 | 
			
		||||
                for (node=0; node<11; node++)
 | 
			
		||||
                    if (vp56_rac_get_prob(c, vp5_ract_pct[ct][pt][cg][node])) {
 | 
			
		||||
                    if (vp56_rac_get_prob_branchy(c, vp5_ract_pct[ct][pt][cg][node])) {
 | 
			
		||||
                        def_prob[node] = vp56_rac_gets_nn(c, 7);
 | 
			
		||||
                        model->coeff_ract[pt][ct][cg][node] = def_prob[node];
 | 
			
		||||
                    } else if (s->frames[VP56_FRAME_CURRENT]->key_frame) {
 | 
			
		||||
@ -193,9 +193,9 @@ static void vp5_parse_coeff(VP56Context *s)
 | 
			
		||||
 | 
			
		||||
        coeff_idx = 0;
 | 
			
		||||
        for (;;) {
 | 
			
		||||
            if (vp56_rac_get_prob(c, model2[0])) {
 | 
			
		||||
                if (vp56_rac_get_prob(c, model2[2])) {
 | 
			
		||||
                    if (vp56_rac_get_prob(c, model2[3])) {
 | 
			
		||||
            if (vp56_rac_get_prob_branchy(c, model2[0])) {
 | 
			
		||||
                if (vp56_rac_get_prob_branchy(c, model2[2])) {
 | 
			
		||||
                    if (vp56_rac_get_prob_branchy(c, model2[3])) {
 | 
			
		||||
                        s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 4;
 | 
			
		||||
                        idx = vp56_rac_get_tree(c, ff_vp56_pc_tree, model1);
 | 
			
		||||
                        sign = vp56_rac_get(c);
 | 
			
		||||
@ -203,7 +203,7 @@ static void vp5_parse_coeff(VP56Context *s)
 | 
			
		||||
                        for (i=ff_vp56_coeff_bit_length[idx]; i>=0; i--)
 | 
			
		||||
                            coeff += vp56_rac_get_prob(c, ff_vp56_coeff_parse_table[idx][i]) << i;
 | 
			
		||||
                    } else {
 | 
			
		||||
                        if (vp56_rac_get_prob(c, model2[4])) {
 | 
			
		||||
                        if (vp56_rac_get_prob_branchy(c, model2[4])) {
 | 
			
		||||
                            coeff = 3 + vp56_rac_get_prob(c, model1[5]);
 | 
			
		||||
                            s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 3;
 | 
			
		||||
                        } else {
 | 
			
		||||
@ -224,7 +224,7 @@ static void vp5_parse_coeff(VP56Context *s)
 | 
			
		||||
                    coeff *= s->dequant_ac;
 | 
			
		||||
                s->block_coeff[b][permute[coeff_idx]] = coeff;
 | 
			
		||||
            } else {
 | 
			
		||||
                if (ct && !vp56_rac_get_prob(c, model2[1]))
 | 
			
		||||
                if (ct && !vp56_rac_get_prob_branchy(c, model2[1]))
 | 
			
		||||
                    break;
 | 
			
		||||
                ct = 0;
 | 
			
		||||
                s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 0;
 | 
			
		||||
 | 
			
		||||
@ -83,16 +83,16 @@ static void vp56_parse_mb_type_models(VP56Context *s)
 | 
			
		||||
    int i, ctx, type;
 | 
			
		||||
 | 
			
		||||
    for (ctx=0; ctx<3; ctx++) {
 | 
			
		||||
        if (vp56_rac_get_prob(c, 174)) {
 | 
			
		||||
        if (vp56_rac_get_prob_branchy(c, 174)) {
 | 
			
		||||
            int idx = vp56_rac_gets(c, 4);
 | 
			
		||||
            memcpy(model->mb_types_stats[ctx],
 | 
			
		||||
                   ff_vp56_pre_def_mb_type_stats[idx][ctx],
 | 
			
		||||
                   sizeof(model->mb_types_stats[ctx]));
 | 
			
		||||
        }
 | 
			
		||||
        if (vp56_rac_get_prob(c, 254)) {
 | 
			
		||||
        if (vp56_rac_get_prob_branchy(c, 254)) {
 | 
			
		||||
            for (type=0; type<10; type++) {
 | 
			
		||||
                for(i=0; i<2; i++) {
 | 
			
		||||
                    if (vp56_rac_get_prob(c, 205)) {
 | 
			
		||||
                    if (vp56_rac_get_prob_branchy(c, 205)) {
 | 
			
		||||
                        int delta, sign = vp56_rac_get(c);
 | 
			
		||||
 | 
			
		||||
                        delta = vp56_rac_get_tree(c, ff_vp56_pmbtm_tree,
 | 
			
		||||
@ -153,7 +153,7 @@ static VP56mb vp56_parse_mb_type(VP56Context *s,
 | 
			
		||||
    uint8_t *mb_type_model = s->modelp->mb_type[ctx][prev_type];
 | 
			
		||||
    VP56RangeCoder *c = &s->c;
 | 
			
		||||
 | 
			
		||||
    if (vp56_rac_get_prob(c, mb_type_model[0]))
 | 
			
		||||
    if (vp56_rac_get_prob_branchy(c, mb_type_model[0]))
 | 
			
		||||
        return prev_type;
 | 
			
		||||
    else
 | 
			
		||||
        return vp56_rac_get_tree(c, ff_vp56_pmbt_tree, mb_type_model);
 | 
			
		||||
 | 
			
		||||
@ -363,7 +363,7 @@ int vp56_rac_get_tree(VP56RangeCoder *c,
 | 
			
		||||
                      const uint8_t *probs)
 | 
			
		||||
{
 | 
			
		||||
    while (tree->val > 0) {
 | 
			
		||||
        if (vp56_rac_get_prob(c, probs[tree->prob_idx]))
 | 
			
		||||
        if (vp56_rac_get_prob_branchy(c, probs[tree->prob_idx]))
 | 
			
		||||
            tree += tree->val;
 | 
			
		||||
        else
 | 
			
		||||
            tree++;
 | 
			
		||||
 | 
			
		||||
@ -211,20 +211,20 @@ static void vp6_parse_vector_models(VP56Context *s)
 | 
			
		||||
    int comp, node;
 | 
			
		||||
 | 
			
		||||
    for (comp=0; comp<2; comp++) {
 | 
			
		||||
        if (vp56_rac_get_prob(c, vp6_sig_dct_pct[comp][0]))
 | 
			
		||||
        if (vp56_rac_get_prob_branchy(c, vp6_sig_dct_pct[comp][0]))
 | 
			
		||||
            model->vector_dct[comp] = vp56_rac_gets_nn(c, 7);
 | 
			
		||||
        if (vp56_rac_get_prob(c, vp6_sig_dct_pct[comp][1]))
 | 
			
		||||
        if (vp56_rac_get_prob_branchy(c, vp6_sig_dct_pct[comp][1]))
 | 
			
		||||
            model->vector_sig[comp] = vp56_rac_gets_nn(c, 7);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    for (comp=0; comp<2; comp++)
 | 
			
		||||
        for (node=0; node<7; node++)
 | 
			
		||||
            if (vp56_rac_get_prob(c, vp6_pdv_pct[comp][node]))
 | 
			
		||||
            if (vp56_rac_get_prob_branchy(c, vp6_pdv_pct[comp][node]))
 | 
			
		||||
                model->vector_pdv[comp][node] = vp56_rac_gets_nn(c, 7);
 | 
			
		||||
 | 
			
		||||
    for (comp=0; comp<2; comp++)
 | 
			
		||||
        for (node=0; node<8; node++)
 | 
			
		||||
            if (vp56_rac_get_prob(c, vp6_fdv_pct[comp][node]))
 | 
			
		||||
            if (vp56_rac_get_prob_branchy(c, vp6_fdv_pct[comp][node]))
 | 
			
		||||
                model->vector_fdv[comp][node] = vp56_rac_gets_nn(c, 7);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -270,7 +270,7 @@ static int vp6_parse_coeff_models(VP56Context *s)
 | 
			
		||||
 | 
			
		||||
    for (pt=0; pt<2; pt++)
 | 
			
		||||
        for (node=0; node<11; node++)
 | 
			
		||||
            if (vp56_rac_get_prob(c, vp6_dccv_pct[pt][node])) {
 | 
			
		||||
            if (vp56_rac_get_prob_branchy(c, vp6_dccv_pct[pt][node])) {
 | 
			
		||||
                def_prob[node] = vp56_rac_gets_nn(c, 7);
 | 
			
		||||
                model->coeff_dccv[pt][node] = def_prob[node];
 | 
			
		||||
            } else if (s->frames[VP56_FRAME_CURRENT]->key_frame) {
 | 
			
		||||
@ -279,21 +279,21 @@ static int vp6_parse_coeff_models(VP56Context *s)
 | 
			
		||||
 | 
			
		||||
    if (vp56_rac_get(c)) {
 | 
			
		||||
        for (pos=1; pos<64; pos++)
 | 
			
		||||
            if (vp56_rac_get_prob(c, vp6_coeff_reorder_pct[pos]))
 | 
			
		||||
            if (vp56_rac_get_prob_branchy(c, vp6_coeff_reorder_pct[pos]))
 | 
			
		||||
                model->coeff_reorder[pos] = vp56_rac_gets(c, 4);
 | 
			
		||||
        vp6_coeff_order_table_init(s);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    for (cg=0; cg<2; cg++)
 | 
			
		||||
        for (node=0; node<14; node++)
 | 
			
		||||
            if (vp56_rac_get_prob(c, vp6_runv_pct[cg][node]))
 | 
			
		||||
            if (vp56_rac_get_prob_branchy(c, vp6_runv_pct[cg][node]))
 | 
			
		||||
                model->coeff_runv[cg][node] = vp56_rac_gets_nn(c, 7);
 | 
			
		||||
 | 
			
		||||
    for (ct=0; ct<3; ct++)
 | 
			
		||||
        for (pt=0; pt<2; pt++)
 | 
			
		||||
            for (cg=0; cg<6; cg++)
 | 
			
		||||
                for (node=0; node<11; node++)
 | 
			
		||||
                    if (vp56_rac_get_prob(c, vp6_ract_pct[ct][pt][cg][node])) {
 | 
			
		||||
                    if (vp56_rac_get_prob_branchy(c, vp6_ract_pct[ct][pt][cg][node])) {
 | 
			
		||||
                        def_prob[node] = vp56_rac_gets_nn(c, 7);
 | 
			
		||||
                        model->coeff_ract[pt][ct][cg][node] = def_prob[node];
 | 
			
		||||
                    } else if (s->frames[VP56_FRAME_CURRENT]->key_frame) {
 | 
			
		||||
@ -339,7 +339,7 @@ static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
 | 
			
		||||
    for (comp=0; comp<2; comp++) {
 | 
			
		||||
        int i, delta = 0;
 | 
			
		||||
 | 
			
		||||
        if (vp56_rac_get_prob(c, model->vector_dct[comp])) {
 | 
			
		||||
        if (vp56_rac_get_prob_branchy(c, model->vector_dct[comp])) {
 | 
			
		||||
            static const uint8_t prob_order[] = {0, 1, 2, 7, 6, 5, 4};
 | 
			
		||||
            for (i=0; i<sizeof(prob_order); i++) {
 | 
			
		||||
                int j = prob_order[i];
 | 
			
		||||
@ -354,7 +354,7 @@ static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
 | 
			
		||||
                                      model->vector_pdv[comp]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (delta && vp56_rac_get_prob(c, model->vector_sig[comp]))
 | 
			
		||||
        if (delta && vp56_rac_get_prob_branchy(c, model->vector_sig[comp]))
 | 
			
		||||
            delta = -delta;
 | 
			
		||||
 | 
			
		||||
        if (!comp)
 | 
			
		||||
@ -462,16 +462,16 @@ static void vp6_parse_coeff(VP56Context *s)
 | 
			
		||||
 | 
			
		||||
        coeff_idx = 0;
 | 
			
		||||
        for (;;) {
 | 
			
		||||
            if ((coeff_idx>1 && ct==0) || vp56_rac_get_prob(c, model2[0])) {
 | 
			
		||||
            if ((coeff_idx>1 && ct==0) || vp56_rac_get_prob_branchy(c, model2[0])) {
 | 
			
		||||
                /* parse a coeff */
 | 
			
		||||
                if (vp56_rac_get_prob(c, model2[2])) {
 | 
			
		||||
                    if (vp56_rac_get_prob(c, model2[3])) {
 | 
			
		||||
                if (vp56_rac_get_prob_branchy(c, model2[2])) {
 | 
			
		||||
                    if (vp56_rac_get_prob_branchy(c, model2[3])) {
 | 
			
		||||
                        idx = vp56_rac_get_tree(c, ff_vp56_pc_tree, model1);
 | 
			
		||||
                        coeff = ff_vp56_coeff_bias[idx+5];
 | 
			
		||||
                        for (i=ff_vp56_coeff_bit_length[idx]; i>=0; i--)
 | 
			
		||||
                            coeff += vp56_rac_get_prob(c, ff_vp56_coeff_parse_table[idx][i]) << i;
 | 
			
		||||
                    } else {
 | 
			
		||||
                        if (vp56_rac_get_prob(c, model2[4]))
 | 
			
		||||
                        if (vp56_rac_get_prob_branchy(c, model2[4]))
 | 
			
		||||
                            coeff = 3 + vp56_rac_get_prob(c, model1[5]);
 | 
			
		||||
                        else
 | 
			
		||||
                            coeff = 2;
 | 
			
		||||
@ -492,7 +492,7 @@ static void vp6_parse_coeff(VP56Context *s)
 | 
			
		||||
                /* parse a run */
 | 
			
		||||
                ct = 0;
 | 
			
		||||
                if (coeff_idx > 0) {
 | 
			
		||||
                    if (!vp56_rac_get_prob(c, model2[1]))
 | 
			
		||||
                    if (!vp56_rac_get_prob_branchy(c, model2[1]))
 | 
			
		||||
                        break;
 | 
			
		||||
 | 
			
		||||
                    model3 = model->coeff_runv[coeff_idx >= 6];
 | 
			
		||||
 | 
			
		||||
@ -1153,7 +1153,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y,
 | 
			
		||||
        *segment = 0;
 | 
			
		||||
        for (i = 0; i < 4; i++) {
 | 
			
		||||
            if (s->feature_enabled[i]) {
 | 
			
		||||
                if (vp56_rac_get_prob(c, s->feature_present_prob[i])) {
 | 
			
		||||
                if (vp56_rac_get_prob_branchy(c, s->feature_present_prob[i])) {
 | 
			
		||||
                      int index = vp8_rac_get_tree(c, vp7_feature_index_tree,
 | 
			
		||||
                                                   s->feature_index_prob[i]);
 | 
			
		||||
                      av_log(s->avctx, AV_LOG_WARNING,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user