Commit cef99e12 authored by Matt Oliver's avatar Matt Oliver Committed by Michael Niedermayer

Use rac_get_prob branchy version when used within a conditional branch.

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent f1c16749
...@@ -85,7 +85,7 @@ static void vp5_parse_vector_adjustment(VP56Context *s, VP56mv *vect) ...@@ -85,7 +85,7 @@ static void vp5_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
for (comp=0; comp<2; comp++) { for (comp=0; comp<2; comp++) {
int delta = 0; 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]); 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][0]);
di |= vp56_rac_get_prob(c, model->vector_pdi[comp][1]) << 1; di |= vp56_rac_get_prob(c, model->vector_pdi[comp][1]) << 1;
...@@ -108,19 +108,19 @@ static void vp5_parse_vector_models(VP56Context *s) ...@@ -108,19 +108,19 @@ static void vp5_parse_vector_models(VP56Context *s)
int comp, node; int comp, node;
for (comp=0; comp<2; comp++) { 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); 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); 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); 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); model->vector_pdi[comp][1] = vp56_rac_gets_nn(c, 7);
} }
for (comp=0; comp<2; comp++) for (comp=0; comp<2; comp++)
for (node=0; node<7; node++) 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); model->vector_pdv[comp][node] = vp56_rac_gets_nn(c, 7);
} }
...@@ -137,7 +137,7 @@ static int vp5_parse_coeff_models(VP56Context *s) ...@@ -137,7 +137,7 @@ static int vp5_parse_coeff_models(VP56Context *s)
for (pt=0; pt<2; pt++) for (pt=0; pt<2; pt++)
for (node=0; node<11; node++) 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); def_prob[node] = vp56_rac_gets_nn(c, 7);
model->coeff_dccv[pt][node] = def_prob[node]; model->coeff_dccv[pt][node] = def_prob[node];
} else if (s->frames[VP56_FRAME_CURRENT]->key_frame) { } else if (s->frames[VP56_FRAME_CURRENT]->key_frame) {
...@@ -148,7 +148,7 @@ static int vp5_parse_coeff_models(VP56Context *s) ...@@ -148,7 +148,7 @@ static int vp5_parse_coeff_models(VP56Context *s)
for (pt=0; pt<2; pt++) for (pt=0; pt<2; pt++)
for (cg=0; cg<6; cg++) for (cg=0; cg<6; cg++)
for (node=0; node<11; node++) 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); def_prob[node] = vp56_rac_gets_nn(c, 7);
model->coeff_ract[pt][ct][cg][node] = def_prob[node]; model->coeff_ract[pt][ct][cg][node] = def_prob[node];
} else if (s->frames[VP56_FRAME_CURRENT]->key_frame) { } else if (s->frames[VP56_FRAME_CURRENT]->key_frame) {
...@@ -193,9 +193,9 @@ static void vp5_parse_coeff(VP56Context *s) ...@@ -193,9 +193,9 @@ static void vp5_parse_coeff(VP56Context *s)
coeff_idx = 0; coeff_idx = 0;
for (;;) { for (;;) {
if (vp56_rac_get_prob(c, model2[0])) { if (vp56_rac_get_prob_branchy(c, model2[0])) {
if (vp56_rac_get_prob(c, model2[2])) { if (vp56_rac_get_prob_branchy(c, model2[2])) {
if (vp56_rac_get_prob(c, model2[3])) { if (vp56_rac_get_prob_branchy(c, model2[3])) {
s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 4; s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 4;
idx = vp56_rac_get_tree(c, ff_vp56_pc_tree, model1); idx = vp56_rac_get_tree(c, ff_vp56_pc_tree, model1);
sign = vp56_rac_get(c); sign = vp56_rac_get(c);
...@@ -203,7 +203,7 @@ static void vp5_parse_coeff(VP56Context *s) ...@@ -203,7 +203,7 @@ static void vp5_parse_coeff(VP56Context *s)
for (i=ff_vp56_coeff_bit_length[idx]; i>=0; i--) 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; coeff += vp56_rac_get_prob(c, ff_vp56_coeff_parse_table[idx][i]) << i;
} else { } 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]); coeff = 3 + vp56_rac_get_prob(c, model1[5]);
s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 3; s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 3;
} else { } else {
...@@ -224,7 +224,7 @@ static void vp5_parse_coeff(VP56Context *s) ...@@ -224,7 +224,7 @@ static void vp5_parse_coeff(VP56Context *s)
coeff *= s->dequant_ac; coeff *= s->dequant_ac;
s->block_coeff[b][permute[coeff_idx]] = coeff; s->block_coeff[b][permute[coeff_idx]] = coeff;
} else { } else {
if (ct && !vp56_rac_get_prob(c, model2[1])) if (ct && !vp56_rac_get_prob_branchy(c, model2[1]))
break; break;
ct = 0; ct = 0;
s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 0; s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 0;
......
...@@ -83,16 +83,16 @@ static void vp56_parse_mb_type_models(VP56Context *s) ...@@ -83,16 +83,16 @@ static void vp56_parse_mb_type_models(VP56Context *s)
int i, ctx, type; int i, ctx, type;
for (ctx=0; ctx<3; ctx++) { 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); int idx = vp56_rac_gets(c, 4);
memcpy(model->mb_types_stats[ctx], memcpy(model->mb_types_stats[ctx],
ff_vp56_pre_def_mb_type_stats[idx][ctx], ff_vp56_pre_def_mb_type_stats[idx][ctx],
sizeof(model->mb_types_stats[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 (type=0; type<10; type++) {
for(i=0; i<2; i++) { 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); int delta, sign = vp56_rac_get(c);
delta = vp56_rac_get_tree(c, ff_vp56_pmbtm_tree, delta = vp56_rac_get_tree(c, ff_vp56_pmbtm_tree,
...@@ -153,7 +153,7 @@ static VP56mb vp56_parse_mb_type(VP56Context *s, ...@@ -153,7 +153,7 @@ static VP56mb vp56_parse_mb_type(VP56Context *s,
uint8_t *mb_type_model = s->modelp->mb_type[ctx][prev_type]; uint8_t *mb_type_model = s->modelp->mb_type[ctx][prev_type];
VP56RangeCoder *c = &s->c; 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; return prev_type;
else else
return vp56_rac_get_tree(c, ff_vp56_pmbt_tree, mb_type_model); return vp56_rac_get_tree(c, ff_vp56_pmbt_tree, mb_type_model);
......
...@@ -363,7 +363,7 @@ int vp56_rac_get_tree(VP56RangeCoder *c, ...@@ -363,7 +363,7 @@ int vp56_rac_get_tree(VP56RangeCoder *c,
const uint8_t *probs) const uint8_t *probs)
{ {
while (tree->val > 0) { 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; tree += tree->val;
else else
tree++; tree++;
......
...@@ -211,20 +211,20 @@ static void vp6_parse_vector_models(VP56Context *s) ...@@ -211,20 +211,20 @@ static void vp6_parse_vector_models(VP56Context *s)
int comp, node; int comp, node;
for (comp=0; comp<2; comp++) { 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); 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); model->vector_sig[comp] = vp56_rac_gets_nn(c, 7);
} }
for (comp=0; comp<2; comp++) for (comp=0; comp<2; comp++)
for (node=0; node<7; node++) 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); model->vector_pdv[comp][node] = vp56_rac_gets_nn(c, 7);
for (comp=0; comp<2; comp++) for (comp=0; comp<2; comp++)
for (node=0; node<8; node++) 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); model->vector_fdv[comp][node] = vp56_rac_gets_nn(c, 7);
} }
...@@ -270,7 +270,7 @@ static int vp6_parse_coeff_models(VP56Context *s) ...@@ -270,7 +270,7 @@ static int vp6_parse_coeff_models(VP56Context *s)
for (pt=0; pt<2; pt++) for (pt=0; pt<2; pt++)
for (node=0; node<11; node++) 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); def_prob[node] = vp56_rac_gets_nn(c, 7);
model->coeff_dccv[pt][node] = def_prob[node]; model->coeff_dccv[pt][node] = def_prob[node];
} else if (s->frames[VP56_FRAME_CURRENT]->key_frame) { } else if (s->frames[VP56_FRAME_CURRENT]->key_frame) {
...@@ -279,21 +279,21 @@ static int vp6_parse_coeff_models(VP56Context *s) ...@@ -279,21 +279,21 @@ static int vp6_parse_coeff_models(VP56Context *s)
if (vp56_rac_get(c)) { if (vp56_rac_get(c)) {
for (pos=1; pos<64; pos++) 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); model->coeff_reorder[pos] = vp56_rac_gets(c, 4);
vp6_coeff_order_table_init(s); vp6_coeff_order_table_init(s);
} }
for (cg=0; cg<2; cg++) for (cg=0; cg<2; cg++)
for (node=0; node<14; node++) 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); model->coeff_runv[cg][node] = vp56_rac_gets_nn(c, 7);
for (ct=0; ct<3; ct++) for (ct=0; ct<3; ct++)
for (pt=0; pt<2; pt++) for (pt=0; pt<2; pt++)
for (cg=0; cg<6; cg++) for (cg=0; cg<6; cg++)
for (node=0; node<11; node++) 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); def_prob[node] = vp56_rac_gets_nn(c, 7);
model->coeff_ract[pt][ct][cg][node] = def_prob[node]; model->coeff_ract[pt][ct][cg][node] = def_prob[node];
} else if (s->frames[VP56_FRAME_CURRENT]->key_frame) { } else if (s->frames[VP56_FRAME_CURRENT]->key_frame) {
...@@ -339,7 +339,7 @@ static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect) ...@@ -339,7 +339,7 @@ static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
for (comp=0; comp<2; comp++) { for (comp=0; comp<2; comp++) {
int i, delta = 0; 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}; static const uint8_t prob_order[] = {0, 1, 2, 7, 6, 5, 4};
for (i=0; i<sizeof(prob_order); i++) { for (i=0; i<sizeof(prob_order); i++) {
int j = prob_order[i]; int j = prob_order[i];
...@@ -354,7 +354,7 @@ static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect) ...@@ -354,7 +354,7 @@ static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
model->vector_pdv[comp]); 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; delta = -delta;
if (!comp) if (!comp)
...@@ -462,16 +462,16 @@ static void vp6_parse_coeff(VP56Context *s) ...@@ -462,16 +462,16 @@ static void vp6_parse_coeff(VP56Context *s)
coeff_idx = 0; coeff_idx = 0;
for (;;) { 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 */ /* parse a coeff */
if (vp56_rac_get_prob(c, model2[2])) { if (vp56_rac_get_prob_branchy(c, model2[2])) {
if (vp56_rac_get_prob(c, model2[3])) { if (vp56_rac_get_prob_branchy(c, model2[3])) {
idx = vp56_rac_get_tree(c, ff_vp56_pc_tree, model1); idx = vp56_rac_get_tree(c, ff_vp56_pc_tree, model1);
coeff = ff_vp56_coeff_bias[idx+5]; coeff = ff_vp56_coeff_bias[idx+5];
for (i=ff_vp56_coeff_bit_length[idx]; i>=0; i--) 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; coeff += vp56_rac_get_prob(c, ff_vp56_coeff_parse_table[idx][i]) << i;
} else { } 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]); coeff = 3 + vp56_rac_get_prob(c, model1[5]);
else else
coeff = 2; coeff = 2;
...@@ -492,7 +492,7 @@ static void vp6_parse_coeff(VP56Context *s) ...@@ -492,7 +492,7 @@ static void vp6_parse_coeff(VP56Context *s)
/* parse a run */ /* parse a run */
ct = 0; ct = 0;
if (coeff_idx > 0) { if (coeff_idx > 0) {
if (!vp56_rac_get_prob(c, model2[1])) if (!vp56_rac_get_prob_branchy(c, model2[1]))
break; break;
model3 = model->coeff_runv[coeff_idx >= 6]; 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, ...@@ -1153,7 +1153,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y,
*segment = 0; *segment = 0;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (s->feature_enabled[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, int index = vp8_rac_get_tree(c, vp7_feature_index_tree,
s->feature_index_prob[i]); s->feature_index_prob[i]);
av_log(s->avctx, AV_LOG_WARNING, av_log(s->avctx, AV_LOG_WARNING,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment