summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_noise_estimate.c26
-rw-r--r--vp9/encoder/vp9_noise_estimate.h2
-rw-r--r--vp9/encoder/vp9_pickmode.c2
-rw-r--r--vp9/encoder/vp9_ratectrl.c8
4 files changed, 25 insertions, 13 deletions
diff --git a/vp9/encoder/vp9_noise_estimate.c b/vp9/encoder/vp9_noise_estimate.c
index b26f6f217..4befbb066 100644
--- a/vp9/encoder/vp9_noise_estimate.c
+++ b/vp9/encoder/vp9_noise_estimate.c
@@ -82,6 +82,21 @@ static void copy_frame(YV12_BUFFER_CONFIG * const dest,
}
}
+NOISE_LEVEL vp9_noise_estimate_extract_level(NOISE_ESTIMATE *const ne) {
+ int noise_level = kLowLow;
+ if (ne->value > (ne->thresh << 1)) {
+ noise_level = kHigh;
+ } else {
+ if (ne->value > ne->thresh)
+ noise_level = kMedium;
+ else if (ne->value > (ne->thresh >> 1))
+ noise_level = kLow;
+ else
+ noise_level = kLowLow;
+ }
+ return noise_level;
+}
+
void vp9_update_noise_estimate(VP9_COMP *const cpi) {
const VP9_COMMON *const cm = &cpi->common;
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
@@ -220,16 +235,7 @@ void vp9_update_noise_estimate(VP9_COMP *const cpi) {
// Reset counter and check noise level condition.
ne->num_frames_estimate = 30;
ne->count = 0;
- if (ne->value > (ne->thresh << 1)) {
- ne->level = kHigh;
- } else {
- if (ne->value > ne->thresh)
- ne->level = kMedium;
- else if (ne->value > (ne->thresh >> 1))
- ne->level = kLow;
- else
- ne->level = kLowLow;
- }
+ ne->level = vp9_noise_estimate_extract_level(ne);
#if CONFIG_VP9_TEMPORAL_DENOISING
if (cpi->oxcf.noise_sensitivity > 0)
vp9_denoiser_set_noise_level(&cpi->denoiser, ne->level);
diff --git a/vp9/encoder/vp9_noise_estimate.h b/vp9/encoder/vp9_noise_estimate.h
index 0d22ef042..826d125b5 100644
--- a/vp9/encoder/vp9_noise_estimate.h
+++ b/vp9/encoder/vp9_noise_estimate.h
@@ -47,6 +47,8 @@ void vp9_noise_estimate_init(NOISE_ESTIMATE *const ne,
int width,
int height);
+NOISE_LEVEL vp9_noise_estimate_extract_level(NOISE_ESTIMATE *const ne);
+
void vp9_update_noise_estimate(struct VP9_COMP *const cpi);
#ifdef __cplusplus
diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c
index 095847a23..17272013f 100644
--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -1703,7 +1703,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
decision == FILTER_BLOCK &&
cpi->noise_estimate.enabled &&
cpi->noise_estimate.level > kLow &&
- zero_last_cost_orig < (best_rdc.rdcost << 2)) {
+ zero_last_cost_orig < (best_rdc.rdcost << 3)) {
// Check if we should pick ZEROMV on denoised signal.
int rate = 0;
int64_t dist = 0;
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index fdff36315..45445df8d 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -1257,8 +1257,12 @@ static void update_golden_frame_stats(VP9_COMP *cpi) {
rc->frames_since_golden = 0;
// If we are not using alt ref in the up and coming group clear the arf
- // active flag.
- if (!rc->source_alt_ref_pending) {
+ // active flag. In multi arf group case, if the index is not 0 then
+ // we are overlaying a mid group arf so should not reset the flag.
+ if (cpi->oxcf.pass == 2) {
+ if (!rc->source_alt_ref_pending && (cpi->twopass.gf_group.index == 0))
+ rc->source_alt_ref_active = 0;
+ } else if (!rc->source_alt_ref_pending) {
rc->source_alt_ref_active = 0;
}