diff options
Diffstat (limited to 'third_party/libaom/source/libaom/av1/encoder/x86/temporal_filter_sse2.c')
-rw-r--r-- | third_party/libaom/source/libaom/av1/encoder/x86/temporal_filter_sse2.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/third_party/libaom/source/libaom/av1/encoder/x86/temporal_filter_sse2.c b/third_party/libaom/source/libaom/av1/encoder/x86/temporal_filter_sse2.c index d70792c644..26c3926dca 100644 --- a/third_party/libaom/source/libaom/av1/encoder/x86/temporal_filter_sse2.c +++ b/third_party/libaom/source/libaom/av1/encoder/x86/temporal_filter_sse2.c @@ -215,10 +215,16 @@ void av1_apply_temporal_filter_sse2( TF_SEARCH_ERROR_NORM_WEIGHT); const double weight_factor = (double)TF_WINDOW_BLOCK_BALANCE_WEIGHT * inv_factor; - // Decay factors for non-local mean approach. - // Smaller q -> smaller filtering weight. + // Adjust filtering based on q. + // Larger q -> stronger filtering -> larger weight. + // Smaller q -> weaker filtering -> smaller weight. double q_decay = pow((double)q_factor / TF_Q_DECAY_THRESHOLD, 2); q_decay = CLIP(q_decay, 1e-5, 1); + if (q_factor >= TF_QINDEX_CUTOFF) { + // Max q_factor is 255, therefore the upper bound of q_decay is 8. + // We do not need a clip here. + q_decay = 0.5 * pow((double)q_factor / 64, 2); + } // Smaller strength -> smaller filtering weight. double s_decay = pow((double)filter_strength / TF_STRENGTH_THRESHOLD, 2); s_decay = CLIP(s_decay, 1e-5, 1); @@ -254,6 +260,7 @@ void av1_apply_temporal_filter_sse2( const double inv_num_ref_pixels = 1.0 / num_ref_pixels; // Larger noise -> larger filtering weight. const double n_decay = 0.5 + log(2 * noise_levels[plane] + 5.0); + // Decay factors for non-local mean approach. const double decay_factor = 1 / (n_decay * q_decay * s_decay); // Filter U-plane and V-plane using Y-plane. This is because motion |