Commit 251c9dcb authored by Sarah Parker's avatar Sarah Parker

Add option for optimize_b only in final encode

This adds a third option to the optimize_coefficients speed
feature, which turns off optimize_b in the search but uses
it in the final encode. This option is not currently being
used by default.

Change-Id: Ic10c9fd8ef16bc453f5e232733cda34d0ddb7692
parent 03d46bd6
......@@ -4671,6 +4671,10 @@ static void encode_superblock(const AV1_COMP *const cpi, TileDataEnc *tile_data,
const BLOCK_SIZE block_size = bsize;
const int num_planes = av1_num_planes(cm);
// Only optimize coefficients in the final encode
if (cpi->sf.optimize_coefficients == FINAL_PASS_TRELLIS_OPT)
x->optimize = (dry_run == OUTPUT_ENABLED);
if (!is_inter) {
#if CONFIG_CFL
xd->cfl.store_y = 1;
......@@ -4831,4 +4835,6 @@ static void encode_superblock(const AV1_COMP *const cpi, TileDataEnc *tile_data,
cfl_store_block(xd, mbmi->sb_type, mbmi->tx_size);
}
#endif // CONFIG_CFL
// Turn optimize back off for next block
if (cpi->sf.optimize_coefficients == FINAL_PASS_TRELLIS_OPT) x->optimize = 0;
}
......@@ -269,7 +269,7 @@ static void set_good_speed_features_framesize_independent(AV1_COMP *cpi,
if (speed >= 6) {
int i;
sf->optimize_coefficients = 0;
sf->optimize_coefficients = NO_TRELLIS_OPT;
sf->mv.search_method = HEX;
sf->disable_filter_search_var_thresh = 500;
for (i = 0; i < TX_SIZES; ++i) {
......@@ -552,13 +552,13 @@ void av1_set_speed_features_framesize_independent(AV1_COMP *cpi) {
#if !CONFIG_XIPHRC
// Slow quant, dct and trellis not worthwhile for first pass
// so make sure they are always turned off.
if (oxcf->pass == 1) sf->optimize_coefficients = 0;
if (oxcf->pass == 1) sf->optimize_coefficients = NO_TRELLIS_OPT;
#endif
// No recode for 1 pass.
if (oxcf->pass == 0) {
sf->recode_loop = DISALLOW_RECODE;
sf->optimize_coefficients = 0;
sf->optimize_coefficients = NO_TRELLIS_OPT;
}
if (sf->mv.subpel_search_method == SUBPEL_TREE) {
......@@ -571,7 +571,8 @@ void av1_set_speed_features_framesize_independent(AV1_COMP *cpi) {
cpi->find_fractional_mv_step = av1_find_best_sub_pixel_tree_pruned_evenmore;
}
x->optimize = sf->optimize_coefficients == 1 && oxcf->pass != 1;
x->optimize =
sf->optimize_coefficients == FULL_TRELLIS_OPT && oxcf->pass != 1;
#if CONFIG_AOM_QM
// FIXME: trellis not very efficient for quantisation matrices
if (cm->using_qmatrix) x->optimize = 0;
......
......@@ -276,6 +276,12 @@ typedef enum {
GM_DISABLE_SEARCH
} GM_SEARCH_TYPE;
typedef enum {
NO_TRELLIS_OPT, // No trellis optimization
FULL_TRELLIS_OPT, // Trellis optimization in all stages
FINAL_PASS_TRELLIS_OPT // Trellis optimization in only the final encode pass
} TRELLIS_OPT_TYPE;
typedef struct SPEED_FEATURES {
MV_SPEED_FEATURES mv;
......@@ -284,8 +290,8 @@ typedef struct SPEED_FEATURES {
RECODE_LOOP_TYPE recode_loop;
// Trellis (dynamic programming) optimization of quantized values (+1, 0).
int optimize_coefficients;
// Trellis (dynamic programming) optimization of quantized values
TRELLIS_OPT_TYPE optimize_coefficients;
// Always set to 0. If on it enables 0 cost background transmission
// (except for the initial transmission of the segmentation). The feature is
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment