diff options
Diffstat (limited to 'vp10/encoder')
-rw-r--r-- | vp10/encoder/bitstream.c | 26 | ||||
-rw-r--r-- | vp10/encoder/encoder.h | 2 | ||||
-rw-r--r-- | vp10/encoder/rd.c | 8 | ||||
-rw-r--r-- | vp10/encoder/rdopt.c | 6 |
4 files changed, 18 insertions, 24 deletions
diff --git a/vp10/encoder/bitstream.c b/vp10/encoder/bitstream.c index 7dd8e4a34..bf66e017d 100644 --- a/vp10/encoder/bitstream.c +++ b/vp10/encoder/bitstream.c @@ -470,7 +470,7 @@ static void write_mb_modes_kf(const VP10_COMMON *cm, const MACROBLOCKD *xd, } } - write_intra_mode(w, mbmi->uv_mode, vp10_kf_uv_mode_prob[mbmi->mode]); + write_intra_mode(w, mbmi->uv_mode, cm->fc->uv_mode_prob[mbmi->mode]); if (bsize >= BLOCK_8X8 && cm->allow_screen_content_tools && mbmi->mode == DC_PRED) @@ -525,7 +525,7 @@ static void write_partition(const VP10_COMMON *const cm, int hbs, int mi_row, int mi_col, PARTITION_TYPE p, BLOCK_SIZE bsize, vpx_writer *w) { const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize); - const vpx_prob *const probs = xd->partition_probs[ctx]; + const vpx_prob *const probs = cm->fc->partition_prob[ctx]; const int has_rows = (mi_row + hbs) < cm->mi_rows; const int has_cols = (mi_col + hbs) < cm->mi_cols; @@ -603,12 +603,9 @@ static void write_modes_sb(VP10_COMP *cpi, static void write_modes(VP10_COMP *cpi, const TileInfo *const tile, vpx_writer *w, TOKENEXTRA **tok, const TOKENEXTRA *const tok_end) { - const VP10_COMMON *const cm = &cpi->common; MACROBLOCKD *const xd = &cpi->td.mb.e_mbd; int mi_row, mi_col; - set_partition_probs(cm, xd); - for (mi_row = tile->mi_row_start; mi_row < tile->mi_row_end; mi_row += MI_BLOCK_SIZE) { vp10_zero(xd->left_seg_context); @@ -1350,6 +1347,7 @@ static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) { FRAME_CONTEXT *const fc = cm->fc; FRAME_COUNTS *counts = cpi->td.counts; vpx_writer header_bc; + int i; vpx_start_encode(&header_bc, data); @@ -1365,11 +1363,17 @@ static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) { update_skip_probs(cm, &header_bc, counts); #if CONFIG_MISC_FIXES update_seg_probs(cpi, &header_bc); + + for (i = 0; i < INTRA_MODES; ++i) + prob_diff_update(vp10_intra_mode_tree, fc->uv_mode_prob[i], + counts->uv_mode[i], INTRA_MODES, &header_bc); + + for (i = 0; i < PARTITION_CONTEXTS; ++i) + prob_diff_update(vp10_partition_tree, fc->partition_prob[i], + counts->partition[i], PARTITION_TYPES, &header_bc); #endif if (!frame_is_intra_only(cm)) { - int i; - for (i = 0; i < INTER_MODE_CONTEXTS; ++i) prob_diff_update(vp10_inter_mode_tree, cm->fc->inter_mode_probs[i], counts->inter_mode[i], INTER_MODES, &header_bc); @@ -1420,15 +1424,11 @@ static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) { prob_diff_update(vp10_intra_mode_tree, cm->fc->y_mode_prob[i], counts->y_mode[i], INTRA_MODES, &header_bc); -#if CONFIG_MISC_FIXES - for (i = 0; i < INTRA_MODES; ++i) - prob_diff_update(vp10_intra_mode_tree, cm->fc->uv_mode_prob[i], - counts->uv_mode[i], INTRA_MODES, &header_bc); -#endif - +#if !CONFIG_MISC_FIXES for (i = 0; i < PARTITION_CONTEXTS; ++i) prob_diff_update(vp10_partition_tree, fc->partition_prob[i], counts->partition[i], PARTITION_TYPES, &header_bc); +#endif vp10_write_nmv_probs(cm, cm->allow_high_precision_mv, &header_bc, &counts->mv); diff --git a/vp10/encoder/encoder.h b/vp10/encoder/encoder.h index 98ded30d1..630032fa3 100644 --- a/vp10/encoder/encoder.h +++ b/vp10/encoder/encoder.h @@ -456,7 +456,7 @@ typedef struct VP10_COMP { int mbmode_cost[INTRA_MODES]; unsigned int inter_mode_cost[INTER_MODE_CONTEXTS][INTER_MODES]; - int intra_uv_mode_cost[FRAME_TYPES][INTRA_MODES]; + int intra_uv_mode_cost[INTRA_MODES]; int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES]; int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS]; int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES]; diff --git a/vp10/encoder/rd.c b/vp10/encoder/rd.c index 806b8542b..22d8f6de7 100644 --- a/vp10/encoder/rd.c +++ b/vp10/encoder/rd.c @@ -76,9 +76,7 @@ static void fill_mode_costs(VP10_COMP *cpi) { vp10_intra_mode_tree); vp10_cost_tokens(cpi->mbmode_cost, fc->y_mode_prob[1], vp10_intra_mode_tree); - vp10_cost_tokens(cpi->intra_uv_mode_cost[KEY_FRAME], - vp10_kf_uv_mode_prob[TM_PRED], vp10_intra_mode_tree); - vp10_cost_tokens(cpi->intra_uv_mode_cost[INTER_FRAME], + vp10_cost_tokens(cpi->intra_uv_mode_cost, fc->uv_mode_prob[TM_PRED], vp10_intra_mode_tree); for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; ++i) @@ -287,7 +285,6 @@ static void set_block_thresholds(const VP10_COMMON *cm, RD_OPT *rd) { void vp10_initialize_rd_consts(VP10_COMP *cpi) { VP10_COMMON *const cm = &cpi->common; MACROBLOCK *const x = &cpi->td.mb; - MACROBLOCKD *const xd = &cpi->td.mb.e_mbd; RD_OPT *const rd = &cpi->rd; int i; @@ -303,14 +300,13 @@ void vp10_initialize_rd_consts(VP10_COMP *cpi) { cm->frame_type != KEY_FRAME) ? 0 : 1; set_block_thresholds(cm, rd); - set_partition_probs(cm, xd); fill_token_costs(x->token_costs, cm->fc->coef_probs); if (cpi->sf.partition_search_type != VAR_BASED_PARTITION || cm->frame_type == KEY_FRAME) { for (i = 0; i < PARTITION_CONTEXTS; ++i) - vp10_cost_tokens(cpi->partition_cost[i], get_partition_probs(xd, i), + vp10_cost_tokens(cpi->partition_cost[i], cm->fc->partition_prob[i], vp10_partition_tree); } diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c index c9ad94557..4c9b4ba29 100644 --- a/vp10/encoder/rdopt.c +++ b/vp10/encoder/rdopt.c @@ -1347,8 +1347,7 @@ static int64_t rd_pick_intra_sbuv_mode(VP10_COMP *cpi, MACROBLOCK *x, if (!super_block_uvrd(cpi, x, &this_rate_tokenonly, &this_distortion, &s, &this_sse, bsize, best_rd)) continue; - this_rate = this_rate_tokenonly + - cpi->intra_uv_mode_cost[cpi->common.frame_type][mode]; + this_rate = this_rate_tokenonly + cpi->intra_uv_mode_cost[mode]; this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion); if (this_rd < best_rd) { @@ -1371,14 +1370,13 @@ static int64_t rd_sbuv_dcpred(const VP10_COMP *cpi, MACROBLOCK *x, int *rate, int *rate_tokenonly, int64_t *distortion, int *skippable, BLOCK_SIZE bsize) { - const VP10_COMMON *cm = &cpi->common; int64_t unused; x->e_mbd.mi[0]->mbmi.uv_mode = DC_PRED; memset(x->skip_txfm, SKIP_TXFM_NONE, sizeof(x->skip_txfm)); super_block_uvrd(cpi, x, rate_tokenonly, distortion, skippable, &unused, bsize, INT64_MAX); - *rate = *rate_tokenonly + cpi->intra_uv_mode_cost[cm->frame_type][DC_PRED]; + *rate = *rate_tokenonly + cpi->intra_uv_mode_cost[DC_PRED]; return RDCOST(x->rdmult, x->rddiv, *rate, *distortion); } |