rtc: correct the source_sad_nonrd condition
The low blksad condition is modified to consider all levels
less than or equal to kLowSad. Due to this, kZeroSad level is
added to the condition.
The overall speed-up quality impact is as follows.
For rt:
cpu Test set Instr count BD-Rate Loss (%)
Reduction(%) avg.psnr ovr.psnr ssim
7 rtc -0.000 -0.0070 -0.0080 -0.0060
7 rtc_derf 0.084 0.0432 0.0463 0.0506
8 rtc 0.005 0.0054 0.0050 0.0047
8 rtc_derf 0.022 -0.0070 -0.0084 -0.0151
9 rtc_derf 0.024 0.0104 0.0101 0.0145
10 rtc_derf 0.022 0.0007 0.0006 0.0006
For rt-scc:
cpu Test set Instr count BD-Rate Loss (%)
Reduction (%) avg.psnr ovr.psnr ssim
7 rtc-screen 0.489 -0.3409 -0.1311 0.1628
8 rtc-screen 0.256 0.1260 0.3704 0.5530
9 rtc-screen 1.107 0.1680 0.5971 0.6135
10 rtc-screen 0.991 0.0445 0.6612 0.5348
STATS_CHANGED for rt
Change-Id: I53d301e1b1c42771ad07bef53ec7617b2f1ede99
diff --git a/av1/encoder/av1_temporal_denoiser.c b/av1/encoder/av1_temporal_denoiser.c
index deb22ed..9a182c2 100644
--- a/av1/encoder/av1_temporal_denoiser.c
+++ b/av1/encoder/av1_temporal_denoiser.c
@@ -671,8 +671,7 @@
int64_t av1_scale_part_thresh(int64_t threshold, AV1_DENOISER_LEVEL noise_level,
CONTENT_STATE_SB content_state,
int temporal_layer_id) {
- if (((content_state.source_sad_nonrd == kVeryLowSad ||
- content_state.source_sad_nonrd == kLowSad) &&
+ if ((content_state.source_sad_nonrd <= kLowSad &&
content_state.low_sumdiff) ||
(content_state.source_sad_nonrd == kHighSad &&
content_state.low_sumdiff) ||
diff --git a/av1/encoder/nonrd_pickmode.c b/av1/encoder/nonrd_pickmode.c
index 74450d8..6e77c46 100644
--- a/av1/encoder/nonrd_pickmode.c
+++ b/av1/encoder/nonrd_pickmode.c
@@ -2235,8 +2235,7 @@
// even if best_early_term is set.
if (bsize >= BLOCK_32X32) best_early_term = 0;
} else if (cpi->sf.rt_sf.source_metrics_sb_nonrd &&
- (x->content_state_sb.source_sad_nonrd == kVeryLowSad ||
- x->content_state_sb.source_sad_nonrd == kLowSad)) {
+ x->content_state_sb.source_sad_nonrd <= kLowSad) {
perform_intra_pred = 0;
}
diff --git a/av1/encoder/var_based_part.c b/av1/encoder/var_based_part.c
index 69b061a..91f309b 100644
--- a/av1/encoder/var_based_part.c
+++ b/av1/encoder/var_based_part.c
@@ -457,8 +457,6 @@
int64_t threshold_base = (int64_t)(threshold_multiplier * ac_q);
const int current_qindex = cm->quant_params.base_qindex;
const int threshold_left_shift = cpi->sf.rt_sf.var_part_split_threshold_shift;
- const int low_blksad =
- (source_sad_nonrd == kVeryLowSad || source_sad_nonrd == kLowSad);
if (is_key_frame) {
if (cpi->sf.rt_sf.force_large_partition_blocks_intra) {
@@ -590,7 +588,7 @@
thresholds[3] = INT32_MAX;
if (segment_id == 0) {
thresholds[1] <<= 2;
- thresholds[2] <<= low_blksad ? 5 : 4;
+ thresholds[2] <<= (source_sad_nonrd <= kLowSad) ? 5 : 4;
} else {
thresholds[1] <<= 1;
thresholds[2] <<= 3;
@@ -621,10 +619,11 @@
thresholds[3] = INT32_MAX;
}
} else if (cpi->sf.rt_sf.prefer_large_partition_blocks >= 2) {
- thresholds[1] <<= low_blksad ? 2 : 0;
- thresholds[2] = low_blksad ? (3 * thresholds[2]) : thresholds[2];
+ thresholds[1] <<= (source_sad_nonrd <= kLowSad) ? 2 : 0;
+ thresholds[2] =
+ (source_sad_nonrd <= kLowSad) ? (3 * thresholds[2]) : thresholds[2];
} else if (cpi->sf.rt_sf.prefer_large_partition_blocks >= 1) {
- const int fac = low_blksad ? 2 : 1;
+ const int fac = (source_sad_nonrd <= kLowSad) ? 2 : 1;
tune_thresh_based_on_qindex_window(current_qindex, QINDEX_LARGE_BLOCK_THR,
45, fac, thresholds);
}