rtc: Force larger partition blocks only on segment 0
The Q on segment > 0 is always much lower, and used
to cleanup artifacts, so avoid forcing large partition
for superblocks with seg > 0 (which is about ~10% of frame).
Only affects speed 9 for resoln above CIF:
bdrate gain on rtc set: ~1.3%, max 5%, several clips 2-3%.
Speed slowdown ~5% observed on vga/hd clips.
Change-Id: Ia7fbb38ec8e648d5574a08b7202ee5fe32f3427e
diff --git a/av1/encoder/var_based_part.c b/av1/encoder/var_based_part.c
index 0b27377..3402b22 100644
--- a/av1/encoder/var_based_part.c
+++ b/av1/encoder/var_based_part.c
@@ -342,7 +342,8 @@
}
static AOM_INLINE void set_vbp_thresholds(AV1_COMP *cpi, int64_t thresholds[],
- int q, int content_state) {
+ int q, int content_state,
+ int segment_id) {
AV1_COMMON *const cm = &cpi->common;
const int is_key_frame = frame_is_intra_only(cm);
const int threshold_multiplier = is_key_frame ? 40 : 1;
@@ -419,14 +420,14 @@
thresholds[1] <<= 2;
thresholds[2] <<= 5;
thresholds[3] = INT32_MAX;
- } else if (cm->width * cm->height > 640 * 480) {
+ } else if (cm->width * cm->height > 640 * 480 && segment_id == 0) {
thresholds[0] <<= 2;
thresholds[3] = INT32_MAX;
if (current_qindex >= QINDEX_LARGE_BLOCK_THR) {
thresholds[1] <<= 1;
thresholds[2] <<= 1;
}
- } else if (current_qindex > QINDEX_LARGE_BLOCK_THR) {
+ } else if (current_qindex > QINDEX_LARGE_BLOCK_THR && segment_id == 0) {
thresholds[1] <<= 2;
thresholds[2] <<= 5;
thresholds[3] = INT32_MAX;
@@ -600,7 +601,7 @@
if (sf->part_sf.partition_search_type != VAR_BASED_PARTITION) {
return;
} else {
- set_vbp_thresholds(cpi, cpi->vbp_info.thresholds, q, content_state);
+ set_vbp_thresholds(cpi, cpi->vbp_info.thresholds, q, content_state, 0);
// The threshold below is not changed locally.
cpi->vbp_info.threshold_minmax = 15 + (q >> 3);
}
@@ -879,10 +880,10 @@
cyclic_refresh_segment_id_boosted(segment_id) &&
cpi->sf.rt_sf.use_nonrd_pick_mode) {
int q = av1_get_qindex(&cm->seg, segment_id, cm->quant_params.base_qindex);
- set_vbp_thresholds(cpi, thresholds, q, content_state);
+ set_vbp_thresholds(cpi, thresholds, q, content_state, 1);
} else {
set_vbp_thresholds(cpi, thresholds, cm->quant_params.base_qindex,
- content_state);
+ content_state, 0);
}
// For non keyframes, disable 4x4 average for low resolution when speed = 8