Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: source/libvpx/vp9/encoder/vp9_temporal_filter.c

Issue 478033002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_svc_layercontext.c ('k') | source/libvpx/vp9/encoder/vp9_write_bit_buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/vp9/encoder/vp9_temporal_filter.c
===================================================================
--- source/libvpx/vp9/encoder/vp9_temporal_filter.c (revision 290053)
+++ source/libvpx/vp9/encoder/vp9_temporal_filter.c (working copy)
@@ -357,12 +357,14 @@
// Apply buffer limits and context specific adjustments to arnr filter.
static void adjust_arnr_filter(VP9_COMP *cpi,
- int distance, int group_boost) {
+ int distance, int group_boost,
+ int *arnr_frames, int *arnr_strength) {
+ const VP9EncoderConfig *const oxcf = &cpi->oxcf;
const int frames_after_arf =
- vp9_lookahead_depth(cpi->lookahead) - distance - 1;
+ vp9_lookahead_depth(cpi->lookahead) - distance - 1;
int frames_fwd = (cpi->oxcf.arnr_max_frames - 1) >> 1;
int frames_bwd;
- int q;
+ int q, frames, strength;
// Define the forward and backwards filter limits for this arnr group.
if (frames_fwd > frames_after_arf)
@@ -375,10 +377,10 @@
// For even length filter there is one more frame backward
// than forward: e.g. len=6 ==> bbbAff, len=7 ==> bbbAfff.
if (frames_bwd < distance)
- frames_bwd += (cpi->oxcf.arnr_max_frames + 1) & 0x1;
+ frames_bwd += (oxcf->arnr_max_frames + 1) & 0x1;
// Set the baseline active filter size.
- cpi->active_arnr_frames = frames_bwd + 1 + frames_fwd;
+ frames = frames_bwd + 1 + frames_fwd;
// Adjust the strength based on active max q.
if (cpi->common.current_video_frame > 1)
@@ -388,29 +390,33 @@
q = ((int)vp9_convert_qindex_to_q(
cpi->rc.avg_frame_qindex[KEY_FRAME]));
if (q > 16) {
- cpi->active_arnr_strength = cpi->oxcf.arnr_strength;
+ strength = oxcf->arnr_strength;
} else {
- cpi->active_arnr_strength = cpi->oxcf.arnr_strength - ((16 - q) / 2);
- if (cpi->active_arnr_strength < 0)
- cpi->active_arnr_strength = 0;
+ strength = oxcf->arnr_strength - ((16 - q) / 2);
+ if (strength < 0)
+ strength = 0;
}
// Adjust number of frames in filter and strength based on gf boost level.
- if (cpi->active_arnr_frames > (group_boost / 150)) {
- cpi->active_arnr_frames = (group_boost / 150);
- cpi->active_arnr_frames += !(cpi->active_arnr_frames & 1);
+ if (frames > group_boost / 150) {
+ frames = group_boost / 150;
+ frames += !(frames & 1);
}
- if (cpi->active_arnr_strength > (group_boost / 300)) {
- cpi->active_arnr_strength = (group_boost / 300);
+
+ if (strength > group_boost / 300) {
+ strength = group_boost / 300;
}
// Adjustments for second level arf in multi arf case.
- if (cpi->pass == 2 && cpi->multi_arf_allowed) {
+ if (cpi->oxcf.pass == 2 && cpi->multi_arf_allowed) {
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
if (gf_group->rf_level[gf_group->index] != GF_ARF_STD) {
- cpi->active_arnr_strength >>= 1;
+ strength >>= 1;
}
}
+
+ *arnr_frames = frames;
+ *arnr_strength = strength;
}
void vp9_temporal_filter(VP9_COMP *cpi, int distance) {
@@ -425,9 +431,7 @@
struct scale_factors sf;
// Apply context specific adjustments to the arnr filter parameters.
- adjust_arnr_filter(cpi, distance, rc->gfu_boost);
- strength = cpi->active_arnr_strength;
- frames_to_blur = cpi->active_arnr_frames;
+ adjust_arnr_filter(cpi, distance, rc->gfu_boost, &frames_to_blur, &strength);
frames_to_blur_backward = (frames_to_blur / 2);
frames_to_blur_forward = ((frames_to_blur - 1) / 2);
start_frame = distance + frames_to_blur_forward;
@@ -442,7 +446,7 @@
}
// Setup scaling factors. Scaling on each of the arnr frames is not supported
- if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) {
+ if (is_spatial_svc(cpi)) {
// In spatial svc the scaling factors might be less then 1/2. So we will use
// non-normative scaling.
int frame_used = 0;
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_svc_layercontext.c ('k') | source/libvpx/vp9/encoder/vp9_write_bit_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698