Variance Partition
Encoder Algorithm

## Functions

void | av1_set_variance_partition_thresholds (AV1_COMP *cpi, int q, int content_lowsumdiff)
| Set the thresholds for variance based partition.
int | av1_choose_var_based_partitioning (AV1_COMP *cpi, const TileInfo *const tile, ThreadData *td, MACROBLOCK *x, int mi_row, int mi_col)
| Variance based partition selection.

## Detailed Description

This module describes variance partition algorithm in AV1. More details will be added.

## Function Documentation

## av1_set_variance_partition_thresholds()

void av1_set_variance_partition_thresholds | ( | AV1_COMP * | cpi,
|  | int | q,
|  | int | content_lowsumdiff )

Set the thresholds for variance based partition.

Set the variance split thresholds for following the block sizes: 0 - threshold_128x128, 1 - threshold_64x64, 2 - threshold_32x32, 3 - vbp_threshold_16x16. 4 - vbp_threshold_8x8 (to split to 4x4 partition) is currently only used on key frame. The thresholds are based om Q, resolution, noise level, and content state.

Parameters

  [in] | cpi | Top level encoder structure
  [in] | q | q index
  [in] | content_lowsumdiff | Low sumdiff flag for superblock

Remarks
  Returns the set of thresholds in `cpi->vbp_info.thresholds`.

Referenced by encode_with_recode_loop(), and encode_without_recode().

## av1_choose_var_based_partitioning()

int av1_choose_var_based_partitioning | ( | AV1_COMP * | cpi,
|  | const TileInfo *const | tile,
|  | ThreadData * | td,
|  | MACROBLOCK * | x,
|  | int | mi_row,
|  | int | mi_col )

Variance based partition selection.

Select the partitioning based on the variance of the residual signal, residual generated as the difference between the source and prediction. The prediction is the reconstructed LAST or reconstructed GOLDEN, whichever has lower y sad. For LAST, option exists (speed feature) to use motion compensation based on superblock motion via int_pro_motion_estimation. For key frames reference is fixed 128 level, so variance is the source variance. The variance is computed for downsampled inputs (8x8 or 4x4 downsampled), and selection is done top-down via as set of partition thresholds. defined for each block level, and set based on Q, resolution, noise level, and content state.

Parameters

  [in] | cpi | Top level encoder structure
  [in] | tile | Pointer to TileInfo
  [in] | td | Pointer to ThreadData
  [in] | x | Pointer to MACROBLOCK
  [in] | mi_row | Row coordinate of the superblock in a step size of MI_SIZE
  [in] | mi_col | Column coordinate of the super block in a step size of MI_SIZE

Returns
  Returns the partition in `xd->mi`[0]->sb_type. Also sets the low temporal variance flag and the color sensitivity flag (both used in nonrd_pickmode).

Referenced by encode_nonrd_sb(), and encode_rd_sb().