Signed-off-by: Martin Storsjö <martin@martin.st>tags/n0.11
| @@ -83,7 +83,7 @@ static void vp5_parse_vector_adjustment(VP56Context *s, VP56mv *vect) | |||
| 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; | |||
| delta = vp56_rac_get_tree(c, vp56_pva_tree, | |||
| delta = vp56_rac_get_tree(c, ff_vp56_pva_tree, | |||
| model->vector_pdv[comp]); | |||
| delta = di | (delta << 2); | |||
| delta = (delta ^ -sign) + sign; | |||
| @@ -180,7 +180,7 @@ static void vp5_parse_coeff(VP56Context *s) | |||
| if (b > 3) pt = 1; | |||
| ctx = 6*s->coeff_ctx[vp56_b6to4[b]][0] | |||
| ctx = 6*s->coeff_ctx[ff_vp56_b6to4[b]][0] | |||
| + s->above_blocks[s->above_block_idx[b]].not_null_dc; | |||
| model1 = model->coeff_dccv[pt]; | |||
| model2 = model->coeff_dcct[pt][ctx]; | |||
| @@ -190,26 +190,26 @@ static void vp5_parse_coeff(VP56Context *s) | |||
| if (vp56_rac_get_prob(c, model2[0])) { | |||
| if (vp56_rac_get_prob(c, model2[2])) { | |||
| if (vp56_rac_get_prob(c, model2[3])) { | |||
| s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 4; | |||
| idx = vp56_rac_get_tree(c, vp56_pc_tree, model1); | |||
| 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); | |||
| 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; | |||
| 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])) { | |||
| coeff = 3 + vp56_rac_get_prob(c, model1[5]); | |||
| s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 3; | |||
| s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 3; | |||
| } else { | |||
| coeff = 2; | |||
| s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 2; | |||
| s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 2; | |||
| } | |||
| sign = vp56_rac_get(c); | |||
| } | |||
| ct = 2; | |||
| } else { | |||
| ct = 1; | |||
| s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 1; | |||
| s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 1; | |||
| sign = vp56_rac_get(c); | |||
| coeff = 1; | |||
| } | |||
| @@ -221,24 +221,24 @@ static void vp5_parse_coeff(VP56Context *s) | |||
| if (ct && !vp56_rac_get_prob(c, model2[1])) | |||
| break; | |||
| ct = 0; | |||
| s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 0; | |||
| s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 0; | |||
| } | |||
| coeff_idx++; | |||
| if (coeff_idx >= 64) | |||
| break; | |||
| cg = vp5_coeff_groups[coeff_idx]; | |||
| ctx = s->coeff_ctx[vp56_b6to4[b]][coeff_idx]; | |||
| ctx = s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx]; | |||
| model1 = model->coeff_ract[pt][ct][cg]; | |||
| model2 = cg > 2 ? model1 : model->coeff_acct[pt][ct][cg][ctx]; | |||
| } | |||
| ctx_last = FFMIN(s->coeff_ctx_last[vp56_b6to4[b]], 24); | |||
| s->coeff_ctx_last[vp56_b6to4[b]] = coeff_idx; | |||
| ctx_last = FFMIN(s->coeff_ctx_last[ff_vp56_b6to4[b]], 24); | |||
| s->coeff_ctx_last[ff_vp56_b6to4[b]] = coeff_idx; | |||
| if (coeff_idx < ctx_last) | |||
| for (i=coeff_idx; i<=ctx_last; i++) | |||
| s->coeff_ctx[vp56_b6to4[b]][i] = 5; | |||
| s->above_blocks[s->above_block_idx[b]].not_null_dc = s->coeff_ctx[vp56_b6to4[b]][0]; | |||
| s->coeff_ctx[ff_vp56_b6to4[b]][i] = 5; | |||
| s->above_blocks[s->above_block_idx[b]].not_null_dc = s->coeff_ctx[ff_vp56_b6to4[b]][0]; | |||
| } | |||
| } | |||
| @@ -253,7 +253,7 @@ static void vp5_default_models_init(VP56Context *s) | |||
| model->vector_pdi[i][0] = 0x55; | |||
| model->vector_pdi[i][1] = 0x80; | |||
| } | |||
| memcpy(model->mb_types_stats, vp56_def_mb_types_stats, sizeof(model->mb_types_stats)); | |||
| memcpy(model->mb_types_stats, ff_vp56_def_mb_types_stats, sizeof(model->mb_types_stats)); | |||
| memset(model->vector_pdv, 0x80, sizeof(model->vector_pdv)); | |||
| } | |||
| @@ -268,7 +268,7 @@ static void vp56_add_predictors_dc(VP56Context *s, VP56Frame ref_frame) | |||
| for (b=0; b<6; b++) { | |||
| VP56RefDc *ab = &s->above_blocks[s->above_block_idx[b]]; | |||
| VP56RefDc *lb = &s->left_block[vp56_b6to4[b]]; | |||
| VP56RefDc *lb = &s->left_block[ff_vp56_b6to4[b]]; | |||
| int count = 0; | |||
| int dc = 0; | |||
| int i; | |||
| @@ -288,12 +288,12 @@ static void vp56_add_predictors_dc(VP56Context *s, VP56Frame ref_frame) | |||
| count++; | |||
| } | |||
| if (count == 0) | |||
| dc = s->prev_dc[vp56_b2p[b]][ref_frame]; | |||
| dc = s->prev_dc[ff_vp56_b2p[b]][ref_frame]; | |||
| else if (count == 2) | |||
| dc /= 2; | |||
| s->block_coeff[b][idx] += dc; | |||
| s->prev_dc[vp56_b2p[b]][ref_frame] = s->block_coeff[b][idx]; | |||
| s->prev_dc[ff_vp56_b2p[b]][ref_frame] = s->block_coeff[b][idx]; | |||
| ab->dc_coeff = s->block_coeff[b][idx]; | |||
| ab->ref_frame = ref_frame; | |||
| lb->dc_coeff = s->block_coeff[b][idx]; | |||
| @@ -410,7 +410,7 @@ static void vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha) | |||
| switch (mb_type) { | |||
| case VP56_MB_INTRA: | |||
| for (b=0; b<b_max; b++) { | |||
| plane = vp56_b2p[b+ab]; | |||
| plane = ff_vp56_b2p[b+ab]; | |||
| s->dsp.idct_put(frame_current->data[plane] + s->block_offset[b], | |||
| s->stride[plane], s->block_coeff[b]); | |||
| } | |||
| @@ -419,7 +419,7 @@ static void vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha) | |||
| case VP56_MB_INTER_NOVEC_PF: | |||
| case VP56_MB_INTER_NOVEC_GF: | |||
| for (b=0; b<b_max; b++) { | |||
| plane = vp56_b2p[b+ab]; | |||
| plane = ff_vp56_b2p[b+ab]; | |||
| off = s->block_offset[b]; | |||
| s->dsp.put_pixels_tab[1][0](frame_current->data[plane] + off, | |||
| frame_ref->data[plane] + off, | |||
| @@ -439,7 +439,7 @@ static void vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha) | |||
| for (b=0; b<b_max; b++) { | |||
| int x_off = b==1 || b==3 ? 8 : 0; | |||
| int y_off = b==2 || b==3 ? 8 : 0; | |||
| plane = vp56_b2p[b+ab]; | |||
| plane = ff_vp56_b2p[b+ab]; | |||
| vp56_mc(s, b, plane, frame_ref->data[plane], s->stride[plane], | |||
| 16*col+x_off, 16*row+y_off); | |||
| s->dsp.idct_add(frame_current->data[plane] + s->block_offset[b], | |||
| @@ -25,10 +25,10 @@ | |||
| #include "vp56data.h" | |||
| const uint8_t vp56_b2p[] = { 0, 0, 0, 0, 1, 2, 3, 3, 3, 3 }; | |||
| const uint8_t vp56_b6to4[] = { 0, 0, 1, 1, 2, 3 }; | |||
| const uint8_t ff_vp56_b2p[] = { 0, 0, 0, 0, 1, 2, 3, 3, 3, 3 }; | |||
| const uint8_t ff_vp56_b6to4[] = { 0, 0, 1, 1, 2, 3 }; | |||
| const uint8_t vp56_coeff_parse_table[6][11] = { | |||
| const uint8_t ff_vp56_coeff_parse_table[6][11] = { | |||
| { 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, | |||
| { 145, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, | |||
| { 140, 148, 173, 0, 0, 0, 0, 0, 0, 0, 0 }, | |||
| @@ -37,7 +37,7 @@ const uint8_t vp56_coeff_parse_table[6][11] = { | |||
| { 129, 130, 133, 140, 153, 177, 196, 230, 243, 254, 254 }, | |||
| }; | |||
| const uint8_t vp56_def_mb_types_stats[3][10][2] = { | |||
| const uint8_t ff_vp56_def_mb_types_stats[3][10][2] = { | |||
| { { 69, 42 }, { 1, 2 }, { 1, 7 }, { 44, 42 }, { 6, 22 }, | |||
| { 1, 3 }, { 0, 2 }, { 1, 5 }, { 0, 1 }, { 0, 0 }, }, | |||
| { { 229, 8 }, { 1, 1 }, { 0, 8 }, { 0, 0 }, { 0, 0 }, | |||
| @@ -46,7 +46,7 @@ const uint8_t vp56_def_mb_types_stats[3][10][2] = { | |||
| { 1, 2 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, }, | |||
| }; | |||
| const VP56Tree vp56_pva_tree[] = { | |||
| const VP56Tree ff_vp56_pva_tree[] = { | |||
| { 8, 0}, | |||
| { 4, 1}, | |||
| { 2, 2}, {-0}, {-1}, | |||
| @@ -56,7 +56,7 @@ const VP56Tree vp56_pva_tree[] = { | |||
| { 2, 6}, {-6}, {-7}, | |||
| }; | |||
| const VP56Tree vp56_pc_tree[] = { | |||
| const VP56Tree ff_vp56_pc_tree[] = { | |||
| { 4, 6}, | |||
| { 2, 7}, {-0}, {-1}, | |||
| { 4, 8}, | |||
| @@ -64,5 +64,5 @@ const VP56Tree vp56_pc_tree[] = { | |||
| { 2,10}, {-4}, {-5}, | |||
| }; | |||
| const uint8_t vp56_coeff_bias[] = { 0, 1, 2, 3, 4, 5, 7, 11, 19, 35, 67 }; | |||
| const uint8_t vp56_coeff_bit_length[] = { 0, 1, 2, 3, 4, 10 }; | |||
| const uint8_t ff_vp56_coeff_bias[] = { 0, 1, 2, 3, 4, 5, 7, 11, 19, 35, 67 }; | |||
| const uint8_t ff_vp56_coeff_bit_length[] = { 0, 1, 2, 3, 4, 10 }; | |||
| @@ -56,14 +56,14 @@ typedef struct { | |||
| int8_t prob_idx; | |||
| } VP56Tree; | |||
| extern const uint8_t vp56_b2p[]; | |||
| extern const uint8_t vp56_b6to4[]; | |||
| extern const uint8_t vp56_coeff_parse_table[6][11]; | |||
| extern const uint8_t vp56_def_mb_types_stats[3][10][2]; | |||
| extern const VP56Tree vp56_pva_tree[]; | |||
| extern const VP56Tree vp56_pc_tree[]; | |||
| extern const uint8_t vp56_coeff_bias[]; | |||
| extern const uint8_t vp56_coeff_bit_length[]; | |||
| extern const uint8_t ff_vp56_b2p[]; | |||
| extern const uint8_t ff_vp56_b6to4[]; | |||
| extern const uint8_t ff_vp56_coeff_parse_table[6][11]; | |||
| extern const uint8_t ff_vp56_def_mb_types_stats[3][10][2]; | |||
| extern const VP56Tree ff_vp56_pva_tree[]; | |||
| extern const VP56Tree ff_vp56_pc_tree[]; | |||
| extern const uint8_t ff_vp56_coeff_bias[]; | |||
| extern const uint8_t ff_vp56_coeff_bit_length[]; | |||
| static const VP56Frame vp56_reference_frame[] = { | |||
| VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_NOVEC_PF */ | |||
| @@ -178,7 +178,7 @@ static void vp6_default_models_init(VP56Context *s) | |||
| model->vector_sig[0] = 0x80; | |||
| model->vector_sig[1] = 0x80; | |||
| memcpy(model->mb_types_stats, vp56_def_mb_types_stats, sizeof(model->mb_types_stats)); | |||
| memcpy(model->mb_types_stats, ff_vp56_def_mb_types_stats, sizeof(model->mb_types_stats)); | |||
| memcpy(model->vector_fdv, vp6_def_fdv_vector_model, sizeof(model->vector_fdv)); | |||
| memcpy(model->vector_pdv, vp6_def_pdv_vector_model, sizeof(model->vector_pdv)); | |||
| memcpy(model->coeff_runv, vp6_def_runv_coeff_model, sizeof(model->coeff_runv)); | |||
| @@ -332,7 +332,7 @@ static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect) | |||
| else | |||
| delta |= 8; | |||
| } else { | |||
| delta = vp56_rac_get_tree(c, vp56_pva_tree, | |||
| delta = vp56_rac_get_tree(c, ff_vp56_pva_tree, | |||
| model->vector_pdv[comp]); | |||
| } | |||
| @@ -400,7 +400,7 @@ static void vp6_parse_coeff_huffman(VP56Context *s) | |||
| s->nb_null[1][pt] = vp6_get_nb_null(s); | |||
| break; | |||
| } else { | |||
| int coeff2 = vp56_coeff_bias[coeff]; | |||
| int coeff2 = ff_vp56_coeff_bias[coeff]; | |||
| if (coeff > 4) | |||
| coeff2 += get_bits(&s->gb, coeff <= 9 ? coeff - 4 : 11); | |||
| ct = 1 + (coeff2 > 1); | |||
| @@ -437,7 +437,7 @@ static void vp6_parse_coeff(VP56Context *s) | |||
| if (b > 3) pt = 1; | |||
| ctx = s->left_block[vp56_b6to4[b]].not_null_dc | |||
| ctx = s->left_block[ff_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]; | |||
| @@ -448,10 +448,10 @@ static void vp6_parse_coeff(VP56Context *s) | |||
| /* 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; | |||
| 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])) | |||
| coeff = 3 + vp56_rac_get_prob(c, model1[5]); | |||
| @@ -491,7 +491,7 @@ static void vp6_parse_coeff(VP56Context *s) | |||
| model1 = model2 = model->coeff_ract[pt][ct][cg]; | |||
| } | |||
| s->left_block[vp56_b6to4[b]].not_null_dc = | |||
| s->left_block[ff_vp56_b6to4[b]].not_null_dc = | |||
| s->above_blocks[s->above_block_idx[b]].not_null_dc = !!s->block_coeff[b][0]; | |||
| } | |||
| } | |||