diff options
Diffstat (limited to 'vp8/encoder')
-rw-r--r-- | vp8/encoder/bitstream.c | 48 | ||||
-rw-r--r-- | vp8/encoder/block.h | 7 | ||||
-rw-r--r-- | vp8/encoder/encodeframe.c | 10 | ||||
-rw-r--r-- | vp8/encoder/modecosts.c | 3 | ||||
-rw-r--r-- | vp8/encoder/onyx_if.c | 20 | ||||
-rw-r--r-- | vp8/encoder/onyx_int.h | 6 | ||||
-rw-r--r-- | vp8/encoder/ratectrl.c | 4 | ||||
-rw-r--r-- | vp8/encoder/rdopt.c | 17 |
8 files changed, 13 insertions, 102 deletions
diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c index d66886561..36776ab21 100644 --- a/vp8/encoder/bitstream.c +++ b/vp8/encoder/bitstream.c @@ -259,57 +259,23 @@ void update_skip_probs(VP8_COMP *cpi) { } } -#if CONFIG_SWITCHABLE_INTERP void update_switchable_interp_probs(VP8_COMP *cpi, vp8_writer* const bc) { VP8_COMMON *const pc = &cpi->common; unsigned int branch_ct[32][2]; int i, j; for (j = 0; j <= VP8_SWITCHABLE_FILTERS; ++j) { - //for (j = 0; j <= 0; ++j) { -/* - if (!cpi->dummy_packing) -#if VP8_SWITCHABLE_FILTERS == 3 - printf("HELLO %d %d %d\n", cpi->switchable_interp_count[j][0], - cpi->switchable_interp_count[j][1], cpi->switchable_interp_count[j][2]); -#else - printf("HELLO %d %d\n", cpi->switchable_interp_count[j][0], - cpi->switchable_interp_count[j][1]); -#endif -*/ vp8_tree_probs_from_distribution( VP8_SWITCHABLE_FILTERS, vp8_switchable_interp_encodings, vp8_switchable_interp_tree, - pc->fc.switchable_interp_prob[j], branch_ct, cpi->switchable_interp_count[j], - 256, 1 - ); + pc->fc.switchable_interp_prob[j], branch_ct, + cpi->switchable_interp_count[j], 256, 1); for (i = 0; i < VP8_SWITCHABLE_FILTERS - 1; ++i) { if (pc->fc.switchable_interp_prob[j][i] < 1) pc->fc.switchable_interp_prob[j][i] = 1; vp8_write_literal(bc, pc->fc.switchable_interp_prob[j][i], 8); -/* - if (!cpi->dummy_packing) -#if VP8_SWITCHABLE_FILTERS == 3 - printf("Probs %d %d [%d]\n", - pc->fc.switchable_interp_prob[j][0], - pc->fc.switchable_interp_prob[j][1], pc->frame_type); -#else - printf("Probs %d [%d]\n", pc->fc.switchable_interp_prob[j][0], - pc->frame_type); -#endif -*/ } } - /* - if (!cpi->dummy_packing) -#if VP8_SWITCHABLE_FILTERS == 3 - printf("Probs %d %d [%d]\n", - pc->fc.switchable_interp_prob[0], pc->fc.switchable_interp_prob[1], pc->frame_type); -#else - printf("Probs %d [%d]\n", pc->fc.switchable_interp_prob[0], pc->frame_type); -#endif - */ } -#endif // This function updates the reference frame prediction stats static void update_refpred_stats(VP8_COMP *cpi) { @@ -1005,21 +971,19 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi, vp8_writer *const bc) { cpi->common.pred_filter_mode); } #endif -#if CONFIG_SWITCHABLE_INTERP if (mode >= NEARESTMV && mode <= SPLITMV) { if (cpi->common.mcomp_filter_type == SWITCHABLE) { vp8_write_token(bc, vp8_switchable_interp_tree, - get_pred_probs(&cpi->common, xd, PRED_SWITCHABLE_INTERP), + get_pred_probs(&cpi->common, xd, + PRED_SWITCHABLE_INTERP), vp8_switchable_interp_encodings + vp8_switchable_interp_map[mi->interp_filter]); - //if (!cpi->dummy_packing) printf("Reading: %d\n", mi->interp_filter); } else { assert (mi->interp_filter == cpi->common.mcomp_filter_type); } } -#endif if (mi->second_ref_frame && (mode == NEWMV || mode == SPLITMV)) { int_mv n1, n2; @@ -2590,7 +2554,6 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size) // Signal whether to allow high MV precision vp8_write_bit(&header_bc, (xd->allow_high_precision_mv) ? 1 : 0); -#if CONFIG_SWITCHABLE_INTERP if (pc->mcomp_filter_type == SWITCHABLE) { /* Check to see if only one of the filters is actually used */ int count[VP8_SWITCHABLE_FILTERS]; @@ -2615,7 +2578,6 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size) // Signal the type of subpel filter to use vp8_write_bit(&header_bc, (pc->mcomp_filter_type == SWITCHABLE)); if (pc->mcomp_filter_type != SWITCHABLE) -#endif /* CONFIG_SWITCHABLE_INTERP */ vp8_write_literal(&header_bc, (pc->mcomp_filter_type), 2); } @@ -2688,10 +2650,8 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size) vp8_write_literal(&header_bc, pc->prob_pred_filter_off, 8); #endif -#if CONFIG_SWITCHABLE_INTERP if (pc->mcomp_filter_type == SWITCHABLE) update_switchable_interp_probs(cpi, &header_bc); -#endif vp8_write_literal(&header_bc, pc->prob_intra_coded, 8); vp8_write_literal(&header_bc, pc->prob_last_coded, 8); diff --git a/vp8/encoder/block.h b/vp8/encoder/block.h index c18b64f2c..48623be8c 100644 --- a/vp8/encoder/block.h +++ b/vp8/encoder/block.h @@ -129,12 +129,11 @@ typedef struct { int bmode_costs[VP8_BINTRAMODES][VP8_BINTRAMODES][VP8_BINTRAMODES]; int i8x8_mode_costs[MB_MODE_COUNT]; int inter_bmode_costs[B_MODE_COUNT]; -#if CONFIG_SWITCHABLE_INTERP - int switchable_interp_costs[VP8_SWITCHABLE_FILTERS+1] + int switchable_interp_costs[VP8_SWITCHABLE_FILTERS + 1] [VP8_SWITCHABLE_FILTERS]; -#endif - // These define limits to motion vector components to prevent them from extending outside the UMV borders + // These define limits to motion vector components to prevent them + // from extending outside the UMV borders int mv_col_min; int mv_col_max; int mv_row_min; diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index 20e63725c..0910cfd35 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -1340,15 +1340,7 @@ static void encode_frame_internal(VP8_COMP *cpi) { cpi->pred_filter_on_count = 0; cpi->pred_filter_off_count = 0; #endif -#if CONFIG_SWITCHABLE_INTERP vp8_zero(cpi->switchable_interp_count); -#endif - -#if 0 - // Experimental code - cpi->frame_distortion = 0; - cpi->last_mb_distortion = 0; -#endif xd->mode_info_context = cm->mi; xd->prev_mode_info_context = cm->prev_mi; @@ -1980,9 +1972,7 @@ void vp8cx_encode_inter_macroblock (VP8_COMP *cpi, MACROBLOCK *x, assert(!xd->mode_info_context->mbmi.encoded_as_sb); #endif -#if CONFIG_SWITCHABLE_INTERP vp8_setup_interp_filters(xd, mbmi->interp_filter, cm); -#endif if (cpi->oxcf.tuning == VP8_TUNE_SSIM) { // Adjust the zbin based on this MB rate. adjust_act_zbin(cpi, x); diff --git a/vp8/encoder/modecosts.c b/vp8/encoder/modecosts.c index b1abd1e2a..23b9973c3 100644 --- a/vp8/encoder/modecosts.c +++ b/vp8/encoder/modecosts.c @@ -46,14 +46,11 @@ void vp8_init_mode_costs(VP8_COMP *c) { vp8_cost_tokens(c->mb.i8x8_mode_costs, x->fc.i8x8_mode_prob, vp8_i8x8_mode_tree); -#if CONFIG_SWITCHABLE_INTERP { int i; for (i = 0; i <= VP8_SWITCHABLE_FILTERS; ++i) - //for (i = 0; i <= 0; ++i) vp8_cost_tokens((int *)c->mb.switchable_interp_costs[i], x->fc.switchable_interp_prob[i], vp8_switchable_interp_tree); } -#endif } diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index ce0caf8e2..f11ff5936 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -85,6 +85,7 @@ static void set_default_lf_deltas(VP8_COMP *cpi); extern const int vp8_gf_interval_table[101]; +#define DEFAULT_INTERP_FILTER EIGHTTAP /* SWITCHABLE for better performance */ #define SEARCH_BEST_FILTER 0 /* to search exhaustively for best filter */ #define RESET_FOREACH_FILTER 0 /* whether to reset the encoder state @@ -1617,7 +1618,7 @@ void vp8_change_config(VP8_PTR ptr, VP8_CONFIG *oxcf) { cpi->cq_target_quality = cpi->oxcf.cq_level; if (!cm->use_bilinear_mc_filter) - cm->mcomp_filter_type = EIGHTTAP; + cm->mcomp_filter_type = DEFAULT_INTERP_FILTER; else cm->mcomp_filter_type = BILINEAR; @@ -2933,13 +2934,10 @@ static void encode_frame_to_data_rate /* list of filters to search over */ int mcomp_filters_to_search[] = { -#if CONFIG_SWITCHABLE_INTERP EIGHTTAP, EIGHTTAP_SHARP, SIXTAP, SWITCHABLE -#else - EIGHTTAP, EIGHTTAP_SHARP, SIXTAP, -#endif }; - int mcomp_filters = sizeof(mcomp_filters_to_search) / sizeof(*mcomp_filters_to_search); + int mcomp_filters = sizeof(mcomp_filters_to_search) / + sizeof(*mcomp_filters_to_search); int mcomp_filter_index = 0; INT64 mcomp_filter_cost[4]; @@ -3164,12 +3162,7 @@ static void encode_frame_to_data_rate cm->mcomp_filter_type = mcomp_filters_to_search[0]; mcomp_filter_index = 0; } else { -#if CONFIG_SWITCHABLE_INTERP - cm->mcomp_filter_type = SWITCHABLE; -#else - cm->mcomp_filter_type = - (Q < SHARP_FILTER_QTHRESH ? EIGHTTAP_SHARP : EIGHTTAP); -#endif + cm->mcomp_filter_type = DEFAULT_INTERP_FILTER; } /* TODO: Decide this more intelligently */ xd->allow_high_precision_mv = (Q < HIGH_PRECISION_MV_QTHRESH); @@ -3482,7 +3475,6 @@ static void encode_frame_to_data_rate if (cpi->is_src_frame_alt_ref) Loop = FALSE; -#if CONFIG_SWITCHABLE_INTERP if (cm->frame_type != KEY_FRAME && !sf->search_best_filter && cm->mcomp_filter_type == SWITCHABLE) { @@ -3508,13 +3500,11 @@ static void encode_frame_to_data_rate if (count[i]) { cm->mcomp_filter_type = vp8_switchable_interp[i]; Loop = TRUE; /* Make sure to loop since the filter changed */ - //loop_count = -1; break; } } } } -#endif if (Loop == FALSE && cm->frame_type != KEY_FRAME && sf->search_best_filter) { if (mcomp_filter_index < mcomp_filters) { diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index ab1bb44ec..ab6802509 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@ -110,10 +110,8 @@ typedef struct { vp8_prob sub_mv_ref_prob [SUBMVREF_COUNT][VP8_SUBMVREFS - 1]; vp8_prob mbsplit_prob [VP8_NUMMBSPLITS - 1]; -#if CONFIG_SWITCHABLE_INTERP vp8_prob switchable_interp_prob[VP8_SWITCHABLE_FILTERS + 1] [VP8_SWITCHABLE_FILTERS - 1]; -#endif int mv_ref_ct[6][4][2]; int mode_context[6][4]; @@ -753,10 +751,8 @@ typedef struct VP8_COMP { int pred_filter_on_count; int pred_filter_off_count; #endif -#if CONFIG_SWITCHABLE_INTERP - unsigned int switchable_interp_count[VP8_SWITCHABLE_FILTERS+1] + unsigned int switchable_interp_count[VP8_SWITCHABLE_FILTERS + 1] [VP8_SWITCHABLE_FILTERS]; -#endif #if CONFIG_NEW_MVREF unsigned int best_ref_index_counts[MAX_MV_REFS]; diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c index 85036e4c0..cc3c82e74 100644 --- a/vp8/encoder/ratectrl.c +++ b/vp8/encoder/ratectrl.c @@ -176,9 +176,7 @@ void vp8_save_coding_context(VP8_COMP *cpi) { vp8_copy(cc->hybrid_coef_probs_8x8, cm->fc.hybrid_coef_probs_8x8); vp8_copy(cc->coef_probs_16x16, cm->fc.coef_probs_16x16); vp8_copy(cc->hybrid_coef_probs_16x16, cm->fc.hybrid_coef_probs_16x16); -#if CONFIG_SWITCHABLE_INTERP vp8_copy(cc->switchable_interp_prob, cm->fc.switchable_interp_prob); -#endif } void vp8_restore_coding_context(VP8_COMP *cpi) { @@ -234,9 +232,7 @@ void vp8_restore_coding_context(VP8_COMP *cpi) { vp8_copy(cm->fc.hybrid_coef_probs_8x8, cc->hybrid_coef_probs_8x8); vp8_copy(cm->fc.coef_probs_16x16, cc->coef_probs_16x16); vp8_copy(cm->fc.hybrid_coef_probs_16x16, cc->hybrid_coef_probs_16x16); -#if CONFIG_SWITCHABLE_INTERP vp8_copy(cm->fc.switchable_interp_prob, cc->switchable_interp_prob); -#endif } diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index 2c31f960a..97a38dd8b 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -60,10 +60,8 @@ extern void vp8_update_zbin_extra(VP8_COMP *cpi, MACROBLOCK *x); #define INVALID_MV 0x80008000 -#if CONFIG_SWITCHABLE_INTERP /* Factor to weigh the rate for switchable interp filters */ #define SWITCHABLE_INTERP_RATE_FACTOR 1 -#endif static const int auto_speed_thresh[17] = { 1000, @@ -3385,9 +3383,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int int_mv ref_mv[MAX_REF_FRAMES] = {{0}}; #endif -#if CONFIG_SWITCHABLE_INTERP int switchable_filter_index = 0; -#endif MB_PREDICTION_MODE uv_intra_mode; MB_PREDICTION_MODE uv_intra_mode_8x8 = 0; @@ -3484,12 +3480,8 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int // that depend on the current prediction etc. vp8_estimate_ref_frame_costs(cpi, segment_id, ref_costs); -#if CONFIG_SWITCHABLE_INTERP for (mode_index = 0; mode_index < MAX_MODES; mode_index += (!switchable_filter_index)) { -#else - for (mode_index = 0; mode_index < MAX_MODES; ++mode_index) { -#endif int64_t this_rd = INT64_MAX; int is_comp_pred; int disable_skip = 0, skippable = 0; @@ -3517,19 +3509,16 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int #if CONFIG_PRED_FILTER mbmi->pred_filter_enabled = 0; #endif -#if CONFIG_SWITCHABLE_INTERP if (cpi->common.mcomp_filter_type == SWITCHABLE && this_mode >= NEARESTMV && this_mode <= SPLITMV) { mbmi->interp_filter = vp8_switchable_interp[switchable_filter_index++]; if (switchable_filter_index == VP8_SWITCHABLE_FILTERS) switchable_filter_index = 0; - //printf("Searching %d (%d)\n", this_mode, switchable_filter_index); } else { mbmi->interp_filter = cpi->common.mcomp_filter_type; } vp8_setup_interp_filters(xd, mbmi->interp_filter, &cpi->common); -#endif // Test best rd so far against threshold for trying this mode. if (best_rd <= cpi->rd_threshes[mode_index]) @@ -3788,12 +3777,10 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rate2 += rate; distortion2 += distortion; -#if CONFIG_SWITCHABLE_INTERP if (cpi->common.mcomp_filter_type == SWITCHABLE) rate2 += SWITCHABLE_INTERP_RATE_FACTOR * x->switchable_interp_costs [get_pred_context(&cpi->common, xd, PRED_SWITCHABLE_INTERP)] [vp8_switchable_interp_map[mbmi->interp_filter]]; -#endif // If even the 'Y' rd value of split is higher than best so far // then dont bother looking at UV if (tmp_rd < best_yrd) { @@ -3931,13 +3918,11 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rate2 += vp8_cost_bit(cpi->common.prob_pred_filter_off, xd->mode_info_context->mbmi.pred_filter_enabled); #endif -#if CONFIG_SWITCHABLE_INTERP if (cpi->common.mcomp_filter_type == SWITCHABLE) rate2 += SWITCHABLE_INTERP_RATE_FACTOR * x->switchable_interp_costs [get_pred_context(&cpi->common, xd, PRED_SWITCHABLE_INTERP)] [vp8_switchable_interp_map[ x->e_mbd.mode_info_context->mbmi.interp_filter]]; -#endif /* We don't include the cost of the second reference here, because there are only * three options: Last/Golden, ARF/Last or Golden/ARF, or in other words if you @@ -4204,7 +4189,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int else ++cpi->pred_filter_off_count; #endif -#if CONFIG_SWITCHABLE_INTERP if (cpi->common.mcomp_filter_type == SWITCHABLE && best_mbmode.mode >= NEARESTMV && best_mbmode.mode <= SPLITMV) { @@ -4212,7 +4196,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int [get_pred_context(&cpi->common, xd, PRED_SWITCHABLE_INTERP)] [vp8_switchable_interp_map[best_mbmode.interp_filter]]; } -#endif // Reduce the activation RD thresholds for the best choice mode if ((cpi->rd_baseline_thresh[best_mode_index] > 0) && |