aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-08-19 12:06:08 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-08-19 12:06:08 +0000
commitb2812492e49c25cb3339011b3c1ae48bf0b5c71b (patch)
treebd25f0ecf632e1b74044493110b7f481a9aaed75
parent53f35a6e0c62f2573f8bd3e3bf91080b3148249c (diff)
parent0047adef279e54e3e2f90182983a25856bc602a7 (diff)
downloadlibaom-aml_med_341312300.tar.gz
Snap for 10683893 from 0047adef279e54e3e2f90182983a25856bc602a7 to mainline-media-releaseaml_med_341312300aml_med_341312020aml_med_341111000android14-mainline-media-release
Change-Id: Ib9d7e90c4e81b94ae47e123a504515c6800db5a2
-rw-r--r--av1/encoder/nonrd_pickmode.c12
-rw-r--r--av1/encoder/var_based_part.c17
2 files changed, 21 insertions, 8 deletions
diff --git a/av1/encoder/nonrd_pickmode.c b/av1/encoder/nonrd_pickmode.c
index b782256c8..6748f8403 100644
--- a/av1/encoder/nonrd_pickmode.c
+++ b/av1/encoder/nonrd_pickmode.c
@@ -3037,11 +3037,15 @@ static void set_color_sensitivity(AV1_COMP *cpi, MACROBLOCK *x,
struct buf_2d yv12_mb[MAX_MB_PLANE]) {
const int subsampling_x = cpi->common.seq_params->subsampling_x;
const int subsampling_y = cpi->common.seq_params->subsampling_y;
- int factor = (bsize >= BLOCK_32X32) ? 2 : 3;
+ const int source_sad_nonrd = x->content_state_sb.source_sad_nonrd;
int shift = 3;
- if (cpi->oxcf.tune_cfg.content == AOM_CONTENT_SCREEN &&
+ if (source_sad_nonrd >= kMedSad &&
+ cpi->oxcf.tune_cfg.content != AOM_CONTENT_SCREEN &&
+ (int64_t) cpi->common.width * (int64_t) cpi->common.height >=
+ (int64_t) 640 * 360) {
+ shift = 4;
+ } else if (cpi->oxcf.tune_cfg.content == AOM_CONTENT_SCREEN &&
cpi->rc.high_source_sad) {
- factor = 1;
shift = 6;
}
NOISE_LEVEL noise_level = kLow;
@@ -3073,7 +3077,7 @@ static void set_color_sensitivity(AV1_COMP *cpi, MACROBLOCK *x,
const int norm_uv_sad =
uv_sad >> (b_width_log2_lookup[bs] + b_height_log2_lookup[bs]);
x->color_sensitivity[i - 1] =
- uv_sad > (factor * (y_sad >> shift)) && norm_uv_sad > 40;
+ uv_sad > (y_sad >> shift) && norm_uv_sad > 40;
if (source_variance < 50 && norm_uv_sad > 100)
x->color_sensitivity[i - 1] = 1;
}
diff --git a/av1/encoder/var_based_part.c b/av1/encoder/var_based_part.c
index a953a6fb4..695686273 100644
--- a/av1/encoder/var_based_part.c
+++ b/av1/encoder/var_based_part.c
@@ -941,12 +941,21 @@ static AOM_INLINE void chroma_check(AV1_COMP *cpi, MACROBLOCK *x,
int zero_motion, unsigned int *uv_sad) {
int i;
MACROBLOCKD *xd = &x->e_mbd;
- int shift = 3;
+ const int source_sad_nonrd = x->content_state_sb.source_sad_nonrd;
+ int shift_upper_limit = 1;
+ int shift_lower_limit = 3;
if (is_key_frame || cpi->oxcf.tool_cfg.enable_monochrome) return;
if (cpi->oxcf.tune_cfg.content == AOM_CONTENT_SCREEN &&
cpi->rc.high_source_sad)
- shift = 5;
+ shift_lower_limit = 5;
+ else if (source_sad_nonrd >= kMedSad &&
+ cpi->oxcf.tune_cfg.content != AOM_CONTENT_SCREEN &&
+ (int64_t) cpi->common.width * (int64_t) cpi->common.height >=
+ (int64_t) 640 * 360) {
+ shift_upper_limit = 2;
+ shift_lower_limit = source_sad_nonrd > kMedSad ? 5 : 4;
+ }
MB_MODE_INFO *mi = xd->mi[0];
const AV1_COMMON *const cm = &cpi->common;
@@ -996,9 +1005,9 @@ static AOM_INLINE void chroma_check(AV1_COMP *cpi, MACROBLOCK *x,
}
}
- if (uv_sad[i - 1] > (y_sad >> 1))
+ if (uv_sad[i - 1] > (y_sad >> shift_upper_limit))
x->color_sensitivity_sb[i - 1] = 1;
- else if (uv_sad[i - 1] < (y_sad >> shift))
+ else if (uv_sad[i - 1] < (y_sad >> shift_lower_limit))
x->color_sensitivity_sb[i - 1] = 0;
// Borderline case: to be refined at coding block level in nonrd_pickmode,
// for coding block size < sb_size.