diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index dbbd4e339b17be0c7af0f079da9c42c9da0ac30c..60f06ba9c33fc32dbe621047d7fd6071c9bb89f4 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -2787,7 +2787,7 @@ void vp9_encode_frame(VP9_COMP *cpi) { cm->reference_mode = reference_mode; cm->interp_filter = interp_filter; - if (cpi->compressor_speed == 3) + if (cpi->oxcf.mode == MODE_REALTIME) encode_rtc_frame_internal(cpi); else encode_frame_internal(cpi); @@ -2945,7 +2945,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled, const int mi_height = num_8x8_blocks_high_lookup[bsize]; x->skip_recode = !x->select_txfm_size && mbmi->sb_type >= BLOCK_8X8 && (cpi->oxcf.aq_mode != COMPLEXITY_AQ) && - cpi->compressor_speed != 3; + cpi->oxcf.mode != MODE_REALTIME; x->skip_optimize = ctx->is_coded; ctx->is_coded = 1; x->use_lp32x32fdct = cpi->sf.use_lp32x32fdct; diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index 6bc88ec44907edede1b9d5a675faf4d440baea22..b3f8c7ef769a91536d6165e4280d4ccea65500db 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -455,14 +455,17 @@ static void update_reference_segmentation_map(VP9_COMP *cpi) { cache_ptr += cm->mi_cols; } } +static int is_slowest_mode(int mode) { + return (mode == MODE_SECONDPASS_BEST || mode == MODE_BESTQUALITY); +} -static void set_rd_speed_thresholds(VP9_COMP *cpi, int mode) { +static void set_rd_speed_thresholds(VP9_COMP *cpi) { SPEED_FEATURES *sf = &cpi->sf; int i; // Set baseline threshold values for (i = 0; i < MAX_MODES; ++i) - sf->thresh_mult[i] = mode == 0 ? -500 : 0; + sf->thresh_mult[i] = is_slowest_mode(cpi->oxcf.mode) ? -500 : 0; sf->thresh_mult[THR_NEARESTMV] = 0; sf->thresh_mult[THR_NEARESTG] = 0; @@ -538,12 +541,12 @@ static void set_rd_speed_thresholds(VP9_COMP *cpi, int mode) { } } -static void set_rd_speed_thresholds_sub8x8(VP9_COMP *cpi, int mode) { +static void set_rd_speed_thresholds_sub8x8(VP9_COMP *cpi) { SPEED_FEATURES *sf = &cpi->sf; int i; for (i = 0; i < MAX_REFS; ++i) - sf->thresh_mult_sub8x8[i] = mode == 0 ? -500 : 0; + sf->thresh_mult_sub8x8[i] = is_slowest_mode(cpi->oxcf.mode) ? -500 : 0; sf->thresh_mult_sub8x8[THR_LAST] += 2500; sf->thresh_mult_sub8x8[THR_GOLD] += 2500; @@ -853,7 +856,6 @@ static void set_rt_speed_feature(VP9_COMMON *cm, void vp9_set_speed_features(VP9_COMP *cpi) { SPEED_FEATURES *sf = &cpi->sf; VP9_COMMON *cm = &cpi->common; - int mode = cpi->compressor_speed; int speed = cpi->speed; int i; @@ -907,22 +909,25 @@ void vp9_set_speed_features(VP9_COMP *cpi) { sf->using_small_partition_info = 0; sf->mode_skip_start = MAX_MODES; // Mode index at which mode skip mask set - switch (mode) { - case 0: // This is the best quality mode. + switch (cpi->oxcf.mode) { + case MODE_BESTQUALITY: + case MODE_SECONDPASS_BEST: // This is the best quality mode. cpi->diamond_search_sad = vp9_full_range_search; break; - case 1: - set_good_speed_feature(cm, sf, speed); + case MODE_FIRSTPASS: + case MODE_GOODQUALITY: + case MODE_SECONDPASS: + set_good_speed_feature(cm, sf, speed); break; break; - case 2: + case MODE_REALTIME: set_rt_speed_feature(cm, sf, speed); break; }; /* switch */ // Set rd thresholds based on mode and speed setting - set_rd_speed_thresholds(cpi, mode); - set_rd_speed_thresholds_sub8x8(cpi, mode); + set_rd_speed_thresholds(cpi); + set_rd_speed_thresholds_sub8x8(cpi); // Slow quant, dct and trellis not worthwhile for first pass // so make sure they are always turned off. @@ -1243,29 +1248,24 @@ void vp9_change_config(VP9_PTR ptr, VP9_CONFIG *oxcf) { // Real time and one pass deprecated in test code base case MODE_GOODQUALITY: cpi->pass = 0; - cpi->compressor_speed = 2; cpi->oxcf.cpu_used = clamp(cpi->oxcf.cpu_used, -5, 5); break; case MODE_FIRSTPASS: cpi->pass = 1; - cpi->compressor_speed = 1; break; case MODE_SECONDPASS: cpi->pass = 2; - cpi->compressor_speed = 1; cpi->oxcf.cpu_used = clamp(cpi->oxcf.cpu_used, -5, 5); break; case MODE_SECONDPASS_BEST: cpi->pass = 2; - cpi->compressor_speed = 0; break; case MODE_REALTIME: cpi->pass = 0; - cpi->compressor_speed = 3; break; } @@ -2550,7 +2550,7 @@ static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) { vpx_usec_timer_start(&timer); - if (cpi->compressor_speed == 3) + if (cpi->oxcf.mode == MODE_REALTIME) lf->filter_level = 4; else vp9_pick_filter_level(cpi->Source, cpi, cpi->sf.use_fast_lpf_pick); @@ -2742,7 +2742,7 @@ static void encode_with_recode_loop(VP9_COMP *cpi, if (cpi->sf.recode_loop != 0) { vp9_save_coding_context(cpi); cpi->dummy_packing = 1; - if (cpi->compressor_speed != 3) + if (cpi->oxcf.mode != MODE_REALTIME) vp9_pack_bitstream(cpi, dest, size); cpi->rc.projected_frame_size = (*size) << 3; @@ -3101,7 +3101,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, // JBB : This is realtime mode. In real time mode the first frame // should be larger. Q of 0 is disabled because we force tx size to be // 16x16... - if (cpi->compressor_speed == 3) { + if (cpi->oxcf.mode == MODE_REALTIME) { if (cpi->common.current_video_frame == 0) q /= 3; diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h index d2f42dd3e4b177fbbf8f339b541b65897b89534d..0fbf31b8d486422b9e40fb4fff1a7f5058def969 100644 --- a/vp9/encoder/vp9_onyx_int.h +++ b/vp9/encoder/vp9_onyx_int.h @@ -551,7 +551,6 @@ typedef struct VP9_COMP { // for real time encoding int speed; - int compressor_speed; int cpu_used; int pass; diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index f375a88ffc3694927b4a2736fae84e74d26ab2d4..df33444db3117ea66e1420eeab2e094a0dd85dc8 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -280,7 +280,7 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi) { fill_token_costs(x->token_costs, cm->fc.coef_probs); - if (cpi->compressor_speed != 3) { + if (cpi->oxcf.mode != MODE_REALTIME) { for (i = 0; i < PARTITION_CONTEXTS; i++) vp9_cost_tokens(x->partition_cost[i], get_partition_probs(cm, i), vp9_partition_tree); @@ -427,7 +427,7 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize, if (i == 0) x->pred_sse[ref] = sse; - if (cpi->compressor_speed > 2) { + if (cpi->oxcf.mode == MODE_REALTIME) { dist_sum += (int)sse; } else { int rate; @@ -1761,7 +1761,8 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x, if (best_rd < label_mv_thresh) break; - if (cpi->compressor_speed) { + if (cpi->oxcf.mode != MODE_SECONDPASS_BEST && + cpi->oxcf.mode != MODE_BESTQUALITY) { // use previous block's result as next block's MV predictor. if (i > 0) { bsi->mvp.as_int = mi->bmi[i - 1].as_mv[0].as_int; @@ -1825,7 +1826,8 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x, } // Should we do a full search (best quality only) - if (cpi->compressor_speed == 0) { + if (cpi->oxcf.mode == MODE_BESTQUALITY || + cpi->oxcf.mode == MODE_SECONDPASS_BEST) { /* Check if mvp_full is within the range. */ clamp_mv(&mvp_full, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);