From ce5f42b2456eb62bb07d704ccabf15ef4a62940b Mon Sep 17 00:00:00 2001 From: Jerome Jiang Date: Fri, 24 Apr 2020 10:36:39 -0700 Subject: [PATCH] Revert "Revert "Remove RD code for CONFIG_REALTIME_ONLY in vp9."" Under CONFIG_REALTIME_ONLY flag, map speed < 5 to speed 5. Bug: webm:1684 This reverts commit 85cb983682fe9ca14fd302b50d27d762da05d665. Change-Id: I67b7ed37e8b74417db310ea0c817d3c5a5de9e44 --- vp9/encoder/vp9_encodeframe.c | 31 +++++++++++++++++++++++---- vp9/encoder/vp9_encoder.c | 36 ++++++++++++++++++++++++++++---- vp9/encoder/vp9_encoder.h | 2 ++ vp9/encoder/vp9_rdopt.c | 18 ++++++++++++++-- vp9/encoder/vp9_rdopt.h | 4 ++++ vp9/encoder/vp9_speed_features.c | 13 +++++++++--- vp9/vp9_cx_iface.c | 4 ++++ vp9/vp9cx.mk | 8 +++++++ 8 files changed, 103 insertions(+), 13 deletions(-) diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 617750fac..dd2e0692b 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -37,11 +37,14 @@ #include "vp9/common/vp9_reconinter.h" #include "vp9/common/vp9_seg_common.h" #include "vp9/common/vp9_tile_common.h" - +#if !CONFIG_REALTIME_ONLY #include "vp9/encoder/vp9_aq_360.h" #include "vp9/encoder/vp9_aq_complexity.h" +#endif #include "vp9/encoder/vp9_aq_cyclicrefresh.h" +#if !CONFIG_REALTIME_ONLY #include "vp9/encoder/vp9_aq_variance.h" +#endif #include "vp9/encoder/vp9_encodeframe.h" #include "vp9/encoder/vp9_encodemb.h" #include "vp9/encoder/vp9_encodemv.h" @@ -156,6 +159,7 @@ unsigned int vp9_high_get_sby_perpixel_variance(VP9_COMP *cpi, } #endif // CONFIG_VP9_HIGHBITDEPTH +#if !CONFIG_REALTIME_ONLY static unsigned int get_sby_perpixel_diff_variance(VP9_COMP *cpi, const struct buf_2d *ref, int mi_row, int mi_col, @@ -184,6 +188,7 @@ static BLOCK_SIZE get_rd_var_based_fixed_partition(VP9_COMP *cpi, MACROBLOCK *x, else return BLOCK_8X8; } +#endif // !CONFIG_REALTIME_ONLY static void set_segment_index(VP9_COMP *cpi, MACROBLOCK *const x, int mi_row, int mi_col, BLOCK_SIZE bsize, int segment_index) { @@ -206,6 +211,7 @@ static void set_segment_index(VP9_COMP *cpi, MACROBLOCK *const x, int mi_row, case CYCLIC_REFRESH_AQ: mi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col); break; +#if !CONFIG_REALTIME_ONLY case VARIANCE_AQ: if (cm->frame_type == KEY_FRAME || cpi->refresh_alt_ref_frame || cpi->force_update_segmentation || @@ -225,15 +231,16 @@ static void set_segment_index(VP9_COMP *cpi, MACROBLOCK *const x, int mi_row, mi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col); } break; - case LOOKAHEAD_AQ: - mi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col); - break; case EQUATOR360_AQ: if (cm->frame_type == KEY_FRAME || cpi->force_update_segmentation) mi->segment_id = vp9_360aq_segment_id(mi_row, cm->mi_rows); else mi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col); break; +#endif + case LOOKAHEAD_AQ: + mi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col); + break; case PSNR_AQ: mi->segment_id = segment_index; break; case PERCEPTUAL_AQ: mi->segment_id = x->segment_id; break; default: @@ -1793,6 +1800,7 @@ static int choose_partitioning(VP9_COMP *cpi, const TileInfo *const tile, return 0; } +#if !CONFIG_REALTIME_ONLY static void update_state(VP9_COMP *cpi, ThreadData *td, PICK_MODE_CONTEXT *ctx, int mi_row, int mi_col, BLOCK_SIZE bsize, int output_enabled) { @@ -1921,6 +1929,7 @@ static void update_state(VP9_COMP *cpi, ThreadData *td, PICK_MODE_CONTEXT *ctx, } } } +#endif // !CONFIG_REALTIME_ONLY void vp9_setup_src_planes(MACROBLOCK *x, const YV12_BUFFER_CONFIG *src, int mi_row, int mi_col) { @@ -1963,6 +1972,7 @@ static void set_mode_info_seg_skip(MACROBLOCK *x, TX_MODE tx_mode, vp9_rd_cost_init(rd_cost); } +#if !CONFIG_REALTIME_ONLY static void set_segment_rdmult(VP9_COMP *const cpi, MACROBLOCK *const x, int mi_row, int mi_col, BLOCK_SIZE bsize, AQ_MODE aq_mode) { @@ -2107,6 +2117,7 @@ static void rd_pick_sb_modes(VP9_COMP *cpi, TileDataEnc *tile_data, ctx->rate = rd_cost->rate; ctx->dist = rd_cost->dist; } +#endif // !CONFIG_REALTIME_ONLY static void update_stats(VP9_COMMON *cm, ThreadData *td) { const MACROBLOCK *x = &td->mb; @@ -2167,6 +2178,7 @@ static void update_stats(VP9_COMMON *cm, ThreadData *td) { } } +#if !CONFIG_REALTIME_ONLY static void restore_context(MACROBLOCK *const x, int mi_row, int mi_col, ENTROPY_CONTEXT a[16 * MAX_MB_PLANE], ENTROPY_CONTEXT l[16 * MAX_MB_PLANE], @@ -2320,6 +2332,7 @@ static void encode_sb(VP9_COMP *cpi, ThreadData *td, const TileInfo *const tile, if (partition != PARTITION_SPLIT || bsize == BLOCK_8X8) update_partition_context(xd, mi_row, mi_col, subsize, bsize); } +#endif // !CONFIG_REALTIME_ONLY // Check to see if the given partition size is allowed for a specified number // of 8x8 block rows and columns remaining in the image. @@ -2656,6 +2669,7 @@ static void encode_sb_rt(VP9_COMP *cpi, ThreadData *td, update_partition_context(xd, mi_row, mi_col, subsize, bsize); } +#if !CONFIG_REALTIME_ONLY static void rd_use_partition(VP9_COMP *cpi, ThreadData *td, TileDataEnc *tile_data, MODE_INFO **mi_8x8, TOKENEXTRA **tp, int mi_row, int mi_col, @@ -3095,6 +3109,7 @@ static void set_partition_range(VP9_COMMON *cm, MACROBLOCKD *xd, int mi_row, *min_bs = min_size; *max_bs = max_size; } +#endif // !CONFIG_REALTIME_ONLY static INLINE void store_pred_mv(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx) { memcpy(ctx->pred_mv, x->pred_mv, sizeof(x->pred_mv)); @@ -3199,6 +3214,7 @@ static void nn_predict(const float *features, const NN_CONFIG *nn_config, } } +#if !CONFIG_REALTIME_ONLY #define FEATURES 7 // Machine-learning based partition search early termination. // Return 1 to skip split and rect partitions. @@ -3648,6 +3664,7 @@ static void ml_predict_var_rd_paritioning(const VP9_COMP *const cpi, } } #undef FEATURES +#endif // !CONFIG_REALTIME_ONLY static double log_wiener_var(int64_t wiener_variance) { return log(1.0 + wiener_variance) / log(2.0); @@ -3703,6 +3720,7 @@ static void build_kmeans_segmentation(VP9_COMP *cpi) { } } +#if !CONFIG_REALTIME_ONLY static int wiener_var_segment(VP9_COMP *cpi, BLOCK_SIZE bsize, int mi_row, int mi_col) { VP9_COMMON *cm = &cpi->common; @@ -3798,6 +3816,7 @@ static int get_rdmult_delta(VP9_COMP *cpi, BLOCK_SIZE bsize, int mi_row, return dr; } +#endif // !CONFIG_REALTIME_ONLY #if CONFIG_RATE_CTRL static void assign_partition_info( @@ -4009,6 +4028,7 @@ static void store_superblock_info( } #endif // CONFIG_RATE_CTRL +#if !CONFIG_REALTIME_ONLY // TODO(jingning,jimbankoski,rbultje): properly skip partition types that are // unlikely to be selected depending on previous rate-distortion optimization // results, for encoding speed-up. @@ -4719,6 +4739,7 @@ static void encode_rd_sb_row(VP9_COMP *cpi, ThreadData *td, sb_col_in_tile, num_sb_cols); } } +#endif // !CONFIG_REALTIME_ONLY static void init_encode_frame_mb_context(VP9_COMP *cpi) { MACROBLOCK *const x = &cpi->td.mb; @@ -6009,8 +6030,10 @@ void vp9_encode_sb_row(VP9_COMP *cpi, ThreadData *td, int tile_row, if (cpi->sf.use_nonrd_pick_mode) encode_nonrd_sb_row(cpi, td, this_tile, mi_row, &tok); +#if !CONFIG_REALTIME_ONLY else encode_rd_sb_row(cpi, td, this_tile, mi_row, &tok); +#endif cpi->tplist[tile_row][tile_col][tile_sb_row].stop = tok; cpi->tplist[tile_row][tile_col][tile_sb_row].count = diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 14657fc97..f90aee072 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -44,11 +44,15 @@ #include "vp9/common/vp9_tile_common.h" #include "vp9/common/vp9_scan.h" +#if !CONFIG_REALTIME_ONLY #include "vp9/encoder/vp9_alt_ref_aq.h" #include "vp9/encoder/vp9_aq_360.h" #include "vp9/encoder/vp9_aq_complexity.h" +#endif #include "vp9/encoder/vp9_aq_cyclicrefresh.h" +#if !CONFIG_REALTIME_ONLY #include "vp9/encoder/vp9_aq_variance.h" +#endif #include "vp9/encoder/vp9_bitstream.h" #if CONFIG_INTERNAL_STATS #include "vp9/encoder/vp9_blockiness.h" @@ -128,6 +132,7 @@ void highbd_wht_fwd_txfm(int16_t *src_diff, int bw, tran_low_t *coeff, void wht_fwd_txfm(int16_t *src_diff, int bw, tran_low_t *coeff, TX_SIZE tx_size); +#if !CONFIG_REALTIME_ONLY // compute adaptive threshold for skip recoding static int compute_context_model_thresh(const VP9_COMP *const cpi) { const VP9_COMMON *const cm = &cpi->common; @@ -452,6 +457,7 @@ static int compute_context_model_diff(const VP9_COMMON *const cm) { return -diff; } +#endif // !CONFIG_REALTIME_ONLY // Test for whether to calculate metrics for the frame. static int is_psnr_calc_enabled(const VP9_COMP *cpi) { @@ -2320,7 +2326,9 @@ VP9_COMP *vp9_create_compressor(const VP9EncoderConfig *oxcf, cm, cpi->skin_map, vpx_calloc(cm->mi_rows * cm->mi_cols, sizeof(cpi->skin_map[0]))); +#if !CONFIG_REALTIME_ONLY CHECK_MEM_ERROR(cm, cpi->alt_ref_aq, vp9_alt_ref_aq_create()); +#endif CHECK_MEM_ERROR( cm, cpi->consec_zero_mv, @@ -2806,7 +2814,9 @@ void vp9_remove_compressor(VP9_COMP *cpi) { vp9_bitstream_encode_tiles_buffer_dealloc(cpi); } +#if !CONFIG_REALTIME_ONLY vp9_alt_ref_aq_destroy(cpi->alt_ref_aq); +#endif dealloc_compressor_data(cpi); @@ -3082,6 +3092,7 @@ static void scale_and_extend_frame(const YV12_BUFFER_CONFIG *src, } #endif // CONFIG_VP9_HIGHBITDEPTH +#if !CONFIG_REALTIME_ONLY static int scale_down(VP9_COMP *cpi, int q) { RATE_CONTROL *const rc = &cpi->rc; GF_GROUP *const gf_group = &cpi->twopass.gf_group; @@ -3185,6 +3196,7 @@ static int recode_loop_test(VP9_COMP *cpi, int high_limit, int low_limit, int q, } return force_recode; } +#endif // !CONFIG_REALTIME_ONLY static void update_ref_frames(VP9_COMP *cpi) { VP9_COMMON *const cm = &cpi->common; @@ -4099,6 +4111,7 @@ static int encode_without_recode_loop(VP9_COMP *cpi, size_t *size, } } +#if !CONFIG_REALTIME_ONLY // Variance adaptive and in frame q adjustment experiments are mutually // exclusive. if (cpi->oxcf.aq_mode == VARIANCE_AQ) { @@ -4107,15 +4120,20 @@ static int encode_without_recode_loop(VP9_COMP *cpi, size_t *size, vp9_360aq_frame_setup(cpi); } else if (cpi->oxcf.aq_mode == COMPLEXITY_AQ) { vp9_setup_in_frame_q_adj(cpi); - } else if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) { - vp9_cyclic_refresh_setup(cpi); } else if (cpi->oxcf.aq_mode == LOOKAHEAD_AQ) { // it may be pretty bad for rate-control, // and I should handle it somehow vp9_alt_ref_aq_setup_map(cpi->alt_ref_aq, cpi); - } else if (cpi->roi.enabled && !frame_is_intra_only(cm)) { - apply_roi_map(cpi); + } else { +#endif + if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) { + vp9_cyclic_refresh_setup(cpi); + } else if (cpi->roi.enabled && !frame_is_intra_only(cm)) { + apply_roi_map(cpi); + } +#if !CONFIG_REALTIME_ONLY } +#endif apply_active_map(cpi); @@ -4168,6 +4186,7 @@ static int encode_without_recode_loop(VP9_COMP *cpi, size_t *size, return 1; } +#if !CONFIG_REALTIME_ONLY #define MAX_QSTEP_ADJ 4 static int get_qstep_adj(int rate_excess, int rate_limit) { int qstep = @@ -4546,6 +4565,7 @@ static void encode_with_recode_loop(VP9_COMP *cpi, size_t *size, restore_coding_context(cpi); } } +#endif // !CONFIG_REALTIME_ONLY static int get_ref_frame_flags(const VP9_COMP *cpi) { const int *const map = cpi->common.ref_frame_map; @@ -4839,6 +4859,7 @@ static void spatial_denoise_frame(VP9_COMP *cpi) { } #endif // ENABLE_KF_DENOISE +#if !CONFIG_REALTIME_ONLY static void vp9_try_disable_lookahead_aq(VP9_COMP *cpi, size_t *size, uint8_t *dest) { if (cpi->common.seg.enabled) @@ -4862,6 +4883,7 @@ static void vp9_try_disable_lookahead_aq(VP9_COMP *cpi, size_t *size, vp9_enable_segmentation(&cpi->common.seg); } } +#endif static void set_frame_index(VP9_COMP *cpi, VP9_COMMON *cm) { RefCntBuffer *const ref_buffer = get_ref_cnt_buffer(cm, cm->new_fb_idx); @@ -5179,7 +5201,9 @@ static void encode_frame_to_data_rate( if (cpi->sf.recode_loop == DISALLOW_RECODE) { if (!encode_without_recode_loop(cpi, size, dest)) return; } else { +#if !CONFIG_REALTIME_ONLY encode_with_recode_loop(cpi, size, dest); +#endif } // TODO(jingning): When using show existing frame mode, we assume that the @@ -5191,9 +5215,11 @@ static void encode_frame_to_data_rate( cm->ref_frame_map[cpi->alt_fb_idx]); } +#if !CONFIG_REALTIME_ONLY // Disable segmentation if it decrease rate/distortion ratio if (cpi->oxcf.aq_mode == LOOKAHEAD_AQ) vp9_try_disable_lookahead_aq(cpi, size, dest); +#endif #if CONFIG_VP9_TEMPORAL_DENOISING #ifdef OUTPUT_YUV_DENOISED @@ -5397,8 +5423,10 @@ static void encode_frame_to_data_rate( cpi->force_update_segmentation = 0; +#if !CONFIG_REALTIME_ONLY if (cpi->oxcf.aq_mode == LOOKAHEAD_AQ) vp9_alt_ref_aq_unset_all(cpi->alt_ref_aq, cpi); +#endif cpi->svc.previous_frame_is_intra_only = cm->intra_only; cpi->svc.set_intra_only_frame = 0; diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h index fba75ab61..1a25a496e 100644 --- a/vp9/encoder/vp9_encoder.h +++ b/vp9/encoder/vp9_encoder.h @@ -31,7 +31,9 @@ #include "vp9/common/vp9_thread_common.h" #include "vp9/common/vp9_onyxc_int.h" +#if !CONFIG_REALTIME_ONLY #include "vp9/encoder/vp9_alt_ref_aq.h" +#endif #include "vp9/encoder/vp9_aq_cyclicrefresh.h" #include "vp9/encoder/vp9_context_tree.h" #include "vp9/encoder/vp9_encodemb.h" diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 9a7b5ff80..39b99d50c 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -31,6 +31,9 @@ #include "vp9/common/vp9_scan.h" #include "vp9/common/vp9_seg_common.h" +#if !CONFIG_REALTIME_ONLY +#include "vp9/encoder/vp9_aq_variance.h" +#endif #include "vp9/encoder/vp9_cost.h" #include "vp9/encoder/vp9_encodemb.h" #include "vp9/encoder/vp9_encodemv.h" @@ -40,7 +43,6 @@ #include "vp9/encoder/vp9_ratectrl.h" #include "vp9/encoder/vp9_rd.h" #include "vp9/encoder/vp9_rdopt.h" -#include "vp9/encoder/vp9_aq_variance.h" #define LAST_FRAME_MODE_MASK \ ((1 << GOLDEN_FRAME) | (1 << ALTREF_FRAME) | (1 << INTRA_FRAME)) @@ -81,6 +83,8 @@ struct rdcost_block_args { }; #define LAST_NEW_MV_INDEX 6 + +#if !CONFIG_REALTIME_ONLY static const MODE_DEFINITION vp9_mode_order[MAX_MODES] = { { NEARESTMV, { LAST_FRAME, NONE } }, { NEARESTMV, { ALTREF_FRAME, NONE } }, @@ -128,6 +132,7 @@ static const REF_DEFINITION vp9_ref_order[MAX_REFS] = { { { ALTREF_FRAME, NONE } }, { { LAST_FRAME, ALTREF_FRAME } }, { { GOLDEN_FRAME, ALTREF_FRAME } }, { { INTRA_FRAME, NONE } }, }; +#endif // !CONFIG_REALTIME_ONLY static void swap_block_ptr(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx, int m, int n, int min_plane, int max_plane) { @@ -154,6 +159,7 @@ static void swap_block_ptr(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx, int m, int n, } } +#if !CONFIG_REALTIME_ONLY static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize, MACROBLOCK *x, MACROBLOCKD *xd, int *out_rate_sum, int64_t *out_dist_sum, int *skip_txfm_sb, @@ -278,6 +284,7 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize, MACROBLOCK *x, *out_rate_sum = (int)rate_sum; *out_dist_sum = dist_sum << VP9_DIST_SCALE_LOG2; } +#endif // !CONFIG_REALTIME_ONLY #if CONFIG_VP9_HIGHBITDEPTH int64_t vp9_highbd_block_error_c(const tran_low_t *coeff, @@ -1517,6 +1524,7 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x, return best_rd; } +#if !CONFIG_REALTIME_ONLY static int64_t rd_sbuv_dcpred(const VP9_COMP *cpi, MACROBLOCK *x, int *rate, int *rate_tokenonly, int64_t *distortion, int *skippable, BLOCK_SIZE bsize) { @@ -1728,6 +1736,7 @@ static int64_t encode_inter_mb_segment(VP9_COMP *cpi, MACROBLOCK *x, return RDCOST(x->rdmult, x->rddiv, *labelyrate, *distortion); } +#endif // !CONFIG_REALTIME_ONLY typedef struct { int eobs; @@ -1755,6 +1764,7 @@ typedef struct { int mvthresh; } BEST_SEG_INFO; +#if !CONFIG_REALTIME_ONLY static INLINE int mv_check_bounds(const MvLimits *mv_limits, const MV *mv) { return (mv->row >> 3) < mv_limits->row_min || (mv->row >> 3) > mv_limits->row_max || @@ -3071,6 +3081,7 @@ static int64_t handle_inter_mode( restore_dst_buf(xd, orig_dst, orig_dst_stride); return 0; // The rate-distortion cost will be re-calculated by caller. } +#endif // !CONFIG_REALTIME_ONLY void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *rd_cost, BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx, @@ -3124,6 +3135,7 @@ void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *rd_cost, rd_cost->rdcost = RDCOST(x->rdmult, x->rddiv, rd_cost->rate, rd_cost->dist); } +#if !CONFIG_REALTIME_ONLY // This function is designed to apply a bias or adjustment to an rd value based // on the relative variance of the source and reconstruction. #define LOW_VAR_THRESH 250 @@ -3213,6 +3225,7 @@ static void rd_variance_adjustment(VP9_COMP *cpi, MACROBLOCK *x, (void)xd; } +#endif // !CONFIG_REALTIME_ONLY // Do we have an internal image edge (e.g. formatting bars). int vp9_internal_image_edge(VP9_COMP *cpi) { @@ -3283,6 +3296,7 @@ int vp9_active_edge_sb(VP9_COMP *cpi, int mi_row, int mi_col) { vp9_active_v_edge(cpi, mi_col, MI_BLOCK_SIZE); } +#if !CONFIG_REALTIME_ONLY void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, TileDataEnc *tile_data, MACROBLOCK *x, int mi_row, int mi_col, RD_COST *rd_cost, BLOCK_SIZE bsize, @@ -3775,7 +3789,6 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, TileDataEnc *tile_data, } } } - // Apply an adjustment to the rd value based on the similarity of the // source variance and reconstructed variance. rd_variance_adjustment(cpi, x, bsize, &this_rd, recon, ref_frame, @@ -4751,3 +4764,4 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, TileDataEnc *tile_data, store_coding_context(x, ctx, best_ref_index, best_pred_diff, best_filter_diff, 0); } +#endif // !CONFIG_REALTIME_ONLY diff --git a/vp9/encoder/vp9_rdopt.h b/vp9/encoder/vp9_rdopt.h index 8b810bc47..e1147ff94 100644 --- a/vp9/encoder/vp9_rdopt.h +++ b/vp9/encoder/vp9_rdopt.h @@ -29,6 +29,7 @@ void vp9_rd_pick_intra_mode_sb(struct VP9_COMP *cpi, struct macroblock *x, struct RD_COST *rd_cost, BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx, int64_t best_rd); +#if !CONFIG_REALTIME_ONLY void vp9_rd_pick_inter_mode_sb(struct VP9_COMP *cpi, struct TileDataEnc *tile_data, struct macroblock *x, int mi_row, int mi_col, @@ -39,18 +40,21 @@ void vp9_rd_pick_inter_mode_sb_seg_skip( struct VP9_COMP *cpi, struct TileDataEnc *tile_data, struct macroblock *x, struct RD_COST *rd_cost, BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx, int64_t best_rd_so_far); +#endif int vp9_internal_image_edge(struct VP9_COMP *cpi); int vp9_active_h_edge(struct VP9_COMP *cpi, int mi_row, int mi_step); int vp9_active_v_edge(struct VP9_COMP *cpi, int mi_col, int mi_step); int vp9_active_edge_sb(struct VP9_COMP *cpi, int mi_row, int mi_col); +#if !CONFIG_REALTIME_ONLY void vp9_rd_pick_inter_mode_sub8x8(struct VP9_COMP *cpi, struct TileDataEnc *tile_data, struct macroblock *x, int mi_row, int mi_col, struct RD_COST *rd_cost, BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx, int64_t best_rd_so_far); +#endif #ifdef __cplusplus } // extern "C" diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c index 2cd5dee8b..dea17e124 100644 --- a/vp9/encoder/vp9_speed_features.c +++ b/vp9/encoder/vp9_speed_features.c @@ -20,6 +20,7 @@ static MESH_PATTERN best_quality_mesh_pattern[MAX_MESH_STEP] = { { 64, 4 }, { 28, 2 }, { 15, 1 }, { 7, 1 } }; +#if !CONFIG_REALTIME_ONLY // Define 3 mesh density levels to control the number of searches. #define MESH_DENSITY_LEVELS 3 static MESH_PATTERN @@ -385,6 +386,7 @@ static void set_good_speed_feature_framesize_independent(VP9_COMP *cpi, sf->simple_model_rd_from_var = 1; } } +#endif // !CONFIG_REALTIME_ONLY static void set_rt_speed_feature_framesize_dependent(VP9_COMP *cpi, SPEED_FEATURES *sf, @@ -846,11 +848,12 @@ void vp9_set_speed_features_framesize_dependent(VP9_COMP *cpi, int speed) { sf->rd_ml_partition.search_early_termination = 0; sf->rd_ml_partition.search_breakout = 0; - if (oxcf->mode == REALTIME) { + if (oxcf->mode == REALTIME) set_rt_speed_feature_framesize_dependent(cpi, sf, speed); - } else if (oxcf->mode == GOOD) { +#if !CONFIG_REALTIME_ONLY + else if (oxcf->mode == GOOD) set_good_speed_feature_framesize_dependent(cpi, sf, speed); - } +#endif if (sf->disable_split_mask == DISABLE_ALL_SPLIT) { sf->adaptive_pred_interp_filter = 0; @@ -880,7 +883,9 @@ void vp9_set_speed_features_framesize_dependent(VP9_COMP *cpi, int speed) { void vp9_set_speed_features_framesize_independent(VP9_COMP *cpi, int speed) { SPEED_FEATURES *const sf = &cpi->sf; +#if !CONFIG_REALTIME_ONLY VP9_COMMON *const cm = &cpi->common; +#endif MACROBLOCK *const x = &cpi->td.mb; const VP9EncoderConfig *const oxcf = &cpi->oxcf; int i; @@ -993,8 +998,10 @@ void vp9_set_speed_features_framesize_independent(VP9_COMP *cpi, int speed) { if (oxcf->mode == REALTIME) set_rt_speed_feature_framesize_independent(cpi, sf, speed, oxcf->content); +#if !CONFIG_REALTIME_ONLY else if (oxcf->mode == GOOD) set_good_speed_feature_framesize_independent(cpi, cm, sf, speed); +#endif cpi->diamond_search_sad = vp9_diamond_search_sad; diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index 2ca2114ec..bd6b07a29 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -698,6 +698,10 @@ static vpx_codec_err_t ctrl_set_cpuused(vpx_codec_alg_priv_t *ctx, extra_cfg.cpu_used = CAST(VP8E_SET_CPUUSED, args); extra_cfg.cpu_used = VPXMIN(9, extra_cfg.cpu_used); extra_cfg.cpu_used = VPXMAX(-9, extra_cfg.cpu_used); +#if CONFIG_REALTIME_ONLY + if (extra_cfg.cpu_used > -5 && extra_cfg.cpu_used < 5) + extra_cfg.cpu_used = (extra_cfg.cpu_used > 0) ? 5 : -5; +#endif return update_extra_cfg(ctx, &extra_cfg); } diff --git a/vp9/vp9cx.mk b/vp9/vp9cx.mk index 2e6a7d689..ad774505c 100644 --- a/vp9/vp9cx.mk +++ b/vp9/vp9cx.mk @@ -160,5 +160,13 @@ VP9_CX_SRCS_REMOVE-$(CONFIG_REALTIME_ONLY) += encoder/vp9_temporal_filter.c VP9_CX_SRCS_REMOVE-$(CONFIG_REALTIME_ONLY) += encoder/x86/temporal_filter_sse4.c VP9_CX_SRCS_REMOVE-$(CONFIG_REALTIME_ONLY) += encoder/x86/temporal_filter_constants.h VP9_CX_SRCS_REMOVE-$(CONFIG_REALTIME_ONLY) += encoder/x86/highbd_temporal_filter_sse4.c +VP9_CX_SRCS_REMOVE-$(CONFIG_REALTIME_ONLY) += encoder/vp9_alt_ref_aq.h +VP9_CX_SRCS_REMOVE-$(CONFIG_REALTIME_ONLY) += encoder/vp9_alt_ref_aq.c +VP9_CX_SRCS_REMOVE-$(CONFIG_REALTIME_ONLY) += encoder/vp9_aq_variance.c +VP9_CX_SRCS_REMOVE-$(CONFIG_REALTIME_ONLY) += encoder/vp9_aq_variance.h +VP9_CX_SRCS_REMOVE-$(CONFIG_REALTIME_ONLY) += encoder/vp9_aq_360.c +VP9_CX_SRCS_REMOVE-$(CONFIG_REALTIME_ONLY) += encoder/vp9_aq_360.h +VP9_CX_SRCS_REMOVE-$(CONFIG_REALTIME_ONLY) += encoder/vp9_aq_complexity.c +VP9_CX_SRCS_REMOVE-$(CONFIG_REALTIME_ONLY) += encoder/vp9_aq_complexity.h VP9_CX_SRCS-yes := $(filter-out $(VP9_CX_SRCS_REMOVE-yes),$(VP9_CX_SRCS-yes)) -- 2.40.0