From bed27a960a0ed44e4f555f4f74d5fb243df5bd24 Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Wed, 10 Jul 2013 08:59:18 -0700 Subject: [PATCH] Add a feature to reduce chrome intra mode search Change-Id: I721ebdeef2b53ce3e5c3eba3f7462ae2103c95a8 --- vp9/encoder/vp9_onyx_if.c | 4 ++++ vp9/encoder/vp9_onyx_int.h | 1 + vp9/encoder/vp9_rdopt.c | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index a658b1bd9..cc3c5c050 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -719,6 +719,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) { sf->last_partitioning_redo_frequency = 4; sf->disable_splitmv = 0; sf->mode_search_skip_flags = 0; + sf->last_chroma_intra_mode = TM_PRED; // Skip any mode not chosen at size < X for all sizes > X // Hence BLOCK_SIZE_SB64X64 (skip is off) @@ -746,6 +747,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) { sf->auto_mv_step_size = 1; sf->use_avoid_tested_higherror = 1; sf->adaptive_rd_thresh = 1; + sf->last_chroma_intra_mode = TM_PRED; if (speed == 1) { sf->comp_inter_joint_search_thresh = BLOCK_SIZE_TYPES; @@ -764,6 +766,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) { sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH | FLAG_SKIP_INTRA_BESTINTER | FLAG_SKIP_COMP_BESTINTRA; + sf->last_chroma_intra_mode = H_PRED; } if (speed == 2) { sf->adjust_thresholds_by_speed = 1; @@ -786,6 +789,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) { FLAG_SKIP_INTRA_BESTINTER | FLAG_SKIP_COMP_BESTINTRA | FLAG_SKIP_COMP_REFMISMATCH; + sf->last_chroma_intra_mode = DC_PRED; } if (speed == 3) { sf->comp_inter_joint_search_thresh = BLOCK_SIZE_TYPES; diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h index d640da764..0ecbf3570 100644 --- a/vp9/encoder/vp9_onyx_int.h +++ b/vp9/encoder/vp9_onyx_int.h @@ -274,6 +274,7 @@ typedef struct { // The heuristics selected are based on flags // defined in the MODE_SEARCH_SKIP_HEURISTICS enum unsigned int mode_search_skip_flags; + MB_PREDICTION_MODE last_chroma_intra_mode; } SPEED_FEATURES; enum BlockSize { diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index e42b6a4b6..63a2d1059 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -1500,12 +1500,16 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x, int64_t *distortion, int *skippable, BLOCK_SIZE_TYPE bsize) { MB_PREDICTION_MODE mode; + MB_PREDICTION_MODE last_mode; MB_PREDICTION_MODE UNINITIALIZED_IS_SAFE(mode_selected); int64_t best_rd = INT64_MAX, this_rd; int this_rate_tokenonly, this_rate, s; int64_t this_distortion; - for (mode = DC_PRED; mode <= TM_PRED; mode++) { + last_mode = bsize <= BLOCK_SIZE_SB8X8 ? + TM_PRED : cpi->sf.last_chroma_intra_mode; + + for (mode = DC_PRED; mode <= last_mode; mode++) { x->e_mbd.mode_info_context->mbmi.uv_mode = mode; super_block_uvrd(&cpi->common, x, &this_rate_tokenonly, &this_distortion, &s, NULL, bsize); -- 2.40.0