Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions av2/encoder/tx_search.c
Original file line number Diff line number Diff line change
Expand Up @@ -3231,7 +3231,8 @@ static AVM_INLINE int skip_tx_partition_by_eval_type(
// single partition trial.
static AVM_INLINE void measure_residual_stationarity(
const MACROBLOCK *x, BLOCK_SIZE plane_bsize, int blk_row, int blk_col,
TX_SIZE max_tx_size, int *stationary_rows, int *stationary_cols) {
TX_SIZE max_tx_size, int margin, int *stationary_rows,
int *stationary_cols) {
*stationary_rows = 0;
*stationary_cols = 0;

Expand Down Expand Up @@ -3283,9 +3284,9 @@ static AVM_INLINE void measure_residual_stationarity(
}

// max <= mean * (1 + 1/margin), written without division.
const uint64_t bound = mean * (TX_PART_STATIONARITY_MARGIN + 1);
*stationary_rows = (max_row * TX_PART_STATIONARITY_MARGIN <= bound);
*stationary_cols = (max_col * TX_PART_STATIONARITY_MARGIN <= bound);
const uint64_t bound = mean * (margin + 1);
*stationary_rows = (max_row * margin <= bound);
*stationary_cols = (max_col * margin <= bound);
}

// True when `type` cuts the block along an axis the residual is stationary on,
Expand Down Expand Up @@ -3381,8 +3382,10 @@ static void select_tx_partition_type(

if (cpi->sf.tx_sf.prune_tx_part_stationarity && type != TX_PARTITION_NONE) {
if (!stationarity_valid) {
const int margin =
cpi->oxcf.speed >= 5 ? 1 : TX_PART_STATIONARITY_MARGIN;
measure_residual_stationarity(x, plane_bsize, blk_row, blk_col,
max_tx_size, &stationary_rows,
max_tx_size, margin, &stationary_rows,
&stationary_cols);
stationarity_valid = 1;
}
Expand Down