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

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

Issue 2469763002: Refactor VideoDenoiser to use a buffer pool, replacing explicit double buffering. (Closed)
Patch Set: Rebase. Created 4 years, 1 month 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 e86bbbb3bf931d829596bbfc8c726bf9b246bff3..8d6d8bbaa6ef41c55997ec9b2c557e4f06970677 100644
--- a/webrtc/modules/video_processing/frame_preprocessor.cc
+++ b/webrtc/modules/video_processing/frame_preprocessor.cc
@@ -19,7 +19,6 @@ VPMFramePreprocessor::VPMFramePreprocessor()
spatial_resampler_ = new VPMSimpleSpatialResampler();
vd_ = new VPMVideoDecimator();
EnableDenoising(false);
- denoised_frame_toggle_ = 0;
}
VPMFramePreprocessor::~VPMFramePreprocessor() {
@@ -96,22 +95,10 @@ const VideoFrame* VPMFramePreprocessor::PreprocessFrame(
const VideoFrame* current_frame = &frame;
if (denoiser_) {
- rtc::scoped_refptr<I420Buffer>* denoised_buffer = &denoised_buffer_[0];
- rtc::scoped_refptr<I420Buffer>* denoised_buffer_prev = &denoised_buffer_[1];
- // Swap the buffer to save one memcpy in DenoiseFrame.
- if (denoised_frame_toggle_) {
- denoised_buffer = &denoised_buffer_[1];
- denoised_buffer_prev = &denoised_buffer_[0];
- }
- // Invert the flag.
- denoised_frame_toggle_ ^= 1;
- denoiser_->DenoiseFrame(current_frame->video_frame_buffer(),
- denoised_buffer,
- denoised_buffer_prev, true);
- denoised_frame_ = VideoFrame(*denoised_buffer,
- current_frame->timestamp(),
- current_frame->render_time_ms(),
- current_frame->rotation());
+ denoised_frame_ = VideoFrame(
+ denoiser_->DenoiseFrame(current_frame->video_frame_buffer(), true),
+ current_frame->timestamp(), current_frame->render_time_ms(),
+ current_frame->rotation());
current_frame = &denoised_frame_;
}
« 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