Commit 159cc3b3 authored by Marco's avatar Marco

vp9: Add speed feature flag for computing average source sad.

If enabled will compute source_sad for every superblock on every frame,
prior to encoding. Off by default, only on for speed=8 when
copy_partition is set.

Change-Id: Iab7903180a23dad369135e8234b7f896f20e1231
parent f217049d
......@@ -3165,7 +3165,7 @@ static void encode_without_recode_loop(VP9_COMP *cpi, size_t *size,
if (cpi->oxcf.pass == 0 && cpi->oxcf.mode == REALTIME &&
cpi->oxcf.speed >= 5 && cpi->resize_state == 0 &&
(cpi->oxcf.content == VP9E_CONTENT_SCREEN ||
cpi->oxcf.rc_mode == VPX_VBR || cpi->sf.copy_partition_flag) &&
cpi->oxcf.rc_mode == VPX_VBR || cpi->sf.use_source_sad) &&
cm->show_frame)
vp9_avg_source_sad(cpi);
......
......@@ -2254,8 +2254,8 @@ void vp9_avg_source_sad(VP9_COMP *cpi) {
for (sbi_row = 0; sbi_row < sb_rows; ++sbi_row) {
for (sbi_col = 0; sbi_col < sb_cols; ++sbi_col) {
// Checker-board pattern, ignore boundary.
// If the partition copy is on, compute for every superblock.
if (cpi->sf.copy_partition_flag ||
// If the use_source_sad is on, compute for every superblock.
if (cpi->sf.use_source_sad ||
((sbi_row > 0 && sbi_col > 0) &&
(sbi_row < sb_rows - 1 && sbi_col < sb_cols - 1) &&
((sbi_row % 2 == 0 && sbi_col % 2 == 0) ||
......
......@@ -312,6 +312,7 @@ static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf, int speed,
sf->exhaustive_searches_thresh = INT_MAX;
sf->allow_acl = 0;
sf->copy_partition_flag = 0;
sf->use_source_sad = 0;
if (speed >= 1) {
sf->allow_txfm_domain_distortion = 1;
......@@ -502,6 +503,7 @@ static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf, int speed,
!cpi->external_resize)
sf->copy_partition_flag = 1;
if (sf->copy_partition_flag) {
sf->use_source_sad = 1;
if (cpi->prev_partition == NULL) {
cpi->prev_partition = (BLOCK_SIZE *)vpx_calloc(
cm->mi_stride * cm->mi_rows, sizeof(BLOCK_SIZE));
......
......@@ -478,6 +478,10 @@ typedef struct SPEED_FEATURES {
// Global flag to enable partition copy from the previous frame.
int copy_partition_flag;
// Compute the source sad for every superblock of the frame,
// prior to encoding the frame, to be used to bypass some encoder decisions.
int use_source_sad;
} SPEED_FEATURES;
struct VP9_COMP;
......
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