Commit fc981147 authored by Yunqing Wang's avatar Yunqing Wang Committed by Gerrit Code Review
Browse files

Merge "Rename vbp thresholds"

parents 639955f6 c28ff1a9
...@@ -482,9 +482,9 @@ void vp9_set_vbp_thresholds(VP9_COMP *cpi, int q) { ...@@ -482,9 +482,9 @@ void vp9_set_vbp_thresholds(VP9_COMP *cpi, int q) {
} else { } else {
VP9_COMMON *const cm = &cpi->common; VP9_COMMON *const cm = &cpi->common;
const int is_key_frame = (cm->frame_type == KEY_FRAME); const int is_key_frame = (cm->frame_type == KEY_FRAME);
const int threshold_multiplier = is_key_frame ? 80 : 4; const int threshold_multiplier = is_key_frame ? 20 : 1;
const int64_t threshold_base = (int64_t)(threshold_multiplier * const int64_t threshold_base = (int64_t)(threshold_multiplier *
vp9_convert_qindex_to_q(q, cm->bit_depth)); cpi->y_dequant[q][1]);
// TODO(marpan): Allow 4x4 partitions for inter-frames. // TODO(marpan): Allow 4x4 partitions for inter-frames.
// use_4x4_partition = (variance4x4downsample[i2 + j] == 1); // use_4x4_partition = (variance4x4downsample[i2 + j] == 1);
...@@ -492,21 +492,20 @@ void vp9_set_vbp_thresholds(VP9_COMP *cpi, int q) { ...@@ -492,21 +492,20 @@ void vp9_set_vbp_thresholds(VP9_COMP *cpi, int q) {
// if variance of 16x16 block is very high, so use larger threshold // if variance of 16x16 block is very high, so use larger threshold
// for 16x16 (threshold_bsize_min) in that case. // for 16x16 (threshold_bsize_min) in that case.
if (is_key_frame) { if (is_key_frame) {
cpi->vbp_threshold = threshold_base >> 2; cpi->vbp_threshold_64x64 = threshold_base;
cpi->vbp_threshold_bsize_max = threshold_base; cpi->vbp_threshold_32x32 = threshold_base >> 2;
cpi->vbp_threshold_bsize_min = threshold_base << 2; cpi->vbp_threshold_16x16 = threshold_base >> 2;
cpi->vbp_threshold_16x16 = cpi->vbp_threshold; cpi->vbp_threshold_8x8 = threshold_base << 2;
cpi->vbp_bsize_min = BLOCK_8X8; cpi->vbp_bsize_min = BLOCK_8X8;
} else { } else {
cpi->vbp_threshold = threshold_base; cpi->vbp_threshold_32x32 = threshold_base;
if (cm->width <= 352 && cm->height <= 288) { if (cm->width <= 352 && cm->height <= 288) {
cpi->vbp_threshold_bsize_max = threshold_base >> 2; cpi->vbp_threshold_64x64 = threshold_base >> 2;
cpi->vbp_threshold_bsize_min = threshold_base << 3; cpi->vbp_threshold_16x16 = threshold_base << 3;
} else { } else {
cpi->vbp_threshold_bsize_max = threshold_base; cpi->vbp_threshold_64x64 = threshold_base;
cpi->vbp_threshold_bsize_min = threshold_base << cpi->oxcf.speed; cpi->vbp_threshold_16x16 = threshold_base << cpi->oxcf.speed;
} }
cpi->vbp_threshold_16x16 = cpi->vbp_threshold_bsize_min;
cpi->vbp_bsize_min = BLOCK_16X16; cpi->vbp_bsize_min = BLOCK_16X16;
} }
} }
...@@ -692,7 +691,7 @@ static void choose_partitioning(VP9_COMP *cpi, ...@@ -692,7 +691,7 @@ static void choose_partitioning(VP9_COMP *cpi,
} }
if (is_key_frame || (low_res && if (is_key_frame || (low_res &&
vt.split[i].split[j].part_variances.none.variance > vt.split[i].split[j].part_variances.none.variance >
(cpi->vbp_threshold << 1))) { (cpi->vbp_threshold_32x32 << 1))) {
// Go down to 4x4 down-sampling for variance. // Go down to 4x4 down-sampling for variance.
variance4x4downsample[i2 + j] = 1; variance4x4downsample[i2 + j] = 1;
for (k = 0; k < 4; k++) { for (k = 0; k < 4; k++) {
...@@ -757,7 +756,7 @@ static void choose_partitioning(VP9_COMP *cpi, ...@@ -757,7 +756,7 @@ static void choose_partitioning(VP9_COMP *cpi,
// If variance of this 32x32 block is above the threshold, force the block // If variance of this 32x32 block is above the threshold, force the block
// to split. This also forces a split on the upper (64x64) level. // to split. This also forces a split on the upper (64x64) level.
get_variance(&vt.split[i].part_variances.none); get_variance(&vt.split[i].part_variances.none);
if (vt.split[i].part_variances.none.variance > cpi->vbp_threshold) { if (vt.split[i].part_variances.none.variance > cpi->vbp_threshold_32x32) {
force_split[i + 1] = 1; force_split[i + 1] = 1;
force_split[0] = 1; force_split[0] = 1;
} }
...@@ -769,7 +768,7 @@ static void choose_partitioning(VP9_COMP *cpi, ...@@ -769,7 +768,7 @@ static void choose_partitioning(VP9_COMP *cpi,
// we get to one that's got a variance lower than our threshold. // we get to one that's got a variance lower than our threshold.
if ( mi_col + 8 > cm->mi_cols || mi_row + 8 > cm->mi_rows || if ( mi_col + 8 > cm->mi_cols || mi_row + 8 > cm->mi_rows ||
!set_vt_partitioning(cpi, xd, &vt, BLOCK_64X64, mi_row, mi_col, !set_vt_partitioning(cpi, xd, &vt, BLOCK_64X64, mi_row, mi_col,
cpi->vbp_threshold_bsize_max, BLOCK_16X16, cpi->vbp_threshold_64x64, BLOCK_16X16,
force_split[0])) { force_split[0])) {
for (i = 0; i < 4; ++i) { for (i = 0; i < 4; ++i) {
const int x32_idx = ((i & 1) << 2); const int x32_idx = ((i & 1) << 2);
...@@ -777,7 +776,7 @@ static void choose_partitioning(VP9_COMP *cpi, ...@@ -777,7 +776,7 @@ static void choose_partitioning(VP9_COMP *cpi,
const int i2 = i << 2; const int i2 = i << 2;
if (!set_vt_partitioning(cpi, xd, &vt.split[i], BLOCK_32X32, if (!set_vt_partitioning(cpi, xd, &vt.split[i], BLOCK_32X32,
(mi_row + y32_idx), (mi_col + x32_idx), (mi_row + y32_idx), (mi_col + x32_idx),
cpi->vbp_threshold, cpi->vbp_threshold_32x32,
BLOCK_16X16, force_split[i + 1])) { BLOCK_16X16, force_split[i + 1])) {
for (j = 0; j < 4; ++j) { for (j = 0; j < 4; ++j) {
const int x16_idx = ((j & 1) << 1); const int x16_idx = ((j & 1) << 1);
...@@ -801,7 +800,7 @@ static void choose_partitioning(VP9_COMP *cpi, ...@@ -801,7 +800,7 @@ static void choose_partitioning(VP9_COMP *cpi,
BLOCK_8X8, BLOCK_8X8,
mi_row + y32_idx + y16_idx + y8_idx, mi_row + y32_idx + y16_idx + y8_idx,
mi_col + x32_idx + x16_idx + x8_idx, mi_col + x32_idx + x16_idx + x8_idx,
cpi->vbp_threshold_bsize_min, cpi->vbp_threshold_8x8,
BLOCK_8X8, 0)) { BLOCK_8X8, 0)) {
set_block_size(cpi, xd, set_block_size(cpi, xd,
(mi_row + y32_idx + y16_idx + y8_idx), (mi_row + y32_idx + y16_idx + y8_idx),
......
...@@ -460,10 +460,10 @@ typedef struct VP9_COMP { ...@@ -460,10 +460,10 @@ typedef struct VP9_COMP {
int resize_pending; int resize_pending;
// VAR_BASED_PARTITION thresholds // VAR_BASED_PARTITION thresholds
int64_t vbp_threshold; int64_t vbp_threshold_64x64;
int64_t vbp_threshold_bsize_min; int64_t vbp_threshold_32x32;
int64_t vbp_threshold_bsize_max;
int64_t vbp_threshold_16x16; int64_t vbp_threshold_16x16;
int64_t vbp_threshold_8x8;
BLOCK_SIZE vbp_bsize_min; BLOCK_SIZE vbp_bsize_min;
// Multi-threading // Multi-threading
......
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