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

Unified Diff: webrtc/modules/video_processing/frame_preprocessor.cc

Issue 1871853003: External VNR speed improvement and more. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: More clean-up. Created 4 years, 8 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
Index: webrtc/modules/video_processing/frame_preprocessor.cc
diff --git a/webrtc/modules/video_processing/frame_preprocessor.cc b/webrtc/modules/video_processing/frame_preprocessor.cc
index fd0d0efb97d2a713ba45b191e198ace584bc763c..c2042148a2afc07029351790d923eed0e1a46df0 100644
--- a/webrtc/modules/video_processing/frame_preprocessor.cc
+++ b/webrtc/modules/video_processing/frame_preprocessor.cc
@@ -23,6 +23,7 @@ VPMFramePreprocessor::VPMFramePreprocessor()
ca_ = new VPMContentAnalysis(true);
vd_ = new VPMVideoDecimator();
EnableDenosing(false);
+ denoised_frame_toggle_ = 0;
}
VPMFramePreprocessor::~VPMFramePreprocessor() {
@@ -116,9 +117,18 @@ const VideoFrame* VPMFramePreprocessor::PreprocessFrame(
const VideoFrame* current_frame = &frame;
if (denoiser_) {
- denoiser_->DenoiseFrame(*current_frame, &denoised_frame_,
- &denoised_frame_prev_, 0);
- current_frame = &denoised_frame_;
+ VideoFrame* denoised_frame = &denoised_frame_[0];
+ VideoFrame* denoised_frame_prev = &denoised_frame_[1];
+ // Swap the buffer to save one memcpy in DenoiseFrame.
+ if (denoised_frame_toggle_) {
+ denoised_frame = &denoised_frame_[1];
+ denoised_frame_prev = &denoised_frame_[0];
+ }
+ // Invert the flag.
+ denoised_frame_toggle_ ^= 1;
+ denoiser_->DenoiseFrame(*current_frame, denoised_frame, denoised_frame_prev,
+ true);
+ current_frame = denoised_frame;
}
if (spatial_resampler_->ApplyResample(current_frame->width(),
« no previous file with comments | « webrtc/modules/video_processing/frame_preprocessor.h ('k') | webrtc/modules/video_processing/test/denoiser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698