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

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

Issue 1917703002: Fix an issue in external VNR when width or height not divisible by 16. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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
« no previous file with comments | « webrtc/modules/video_processing/video_denoiser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_processing/video_denoiser.cc
diff --git a/webrtc/modules/video_processing/video_denoiser.cc b/webrtc/modules/video_processing/video_denoiser.cc
index e48bf5b8cd2ef181c80329b92249501723eac5bf..c1cab8187d28c4b3ad2c3c58b882818979931600 100644
--- a/webrtc/modules/video_processing/video_denoiser.cc
+++ b/webrtc/modules/video_processing/video_denoiser.cc
@@ -207,6 +207,23 @@ void VideoDenoiser::CopySrcOnMOB(const uint8_t* y_src, uint8_t* y_dst) {
}
}
+void VideoDenoiser::CopyLumaOnMargin(const uint8_t* y_src, uint8_t* y_dst) {
+ if ((mb_rows_ << 4) != height_) {
+ const uint8_t* margin_y_src = y_src + (mb_rows_ << 4) * stride_y_;
+ uint8_t* margin_y_dst = y_dst + (mb_rows_ << 4) * stride_y_;
+ memcpy(margin_y_dst, margin_y_src, (height_ - (mb_rows_ << 4)) * stride_y_);
+ }
+ if ((mb_cols_ << 4) != width_) {
+ const uint8_t* margin_y_src = y_src + (mb_cols_ << 4);
+ uint8_t* margin_y_dst = y_dst + (mb_cols_ << 4);
+ for (int i = 0; i < height_; ++i) {
+ for (int j = mb_cols_ << 4; j < width_; ++j) {
+ margin_y_dst[i * stride_y_ + j] = margin_y_src[i * stride_y_ + j];
+ }
+ }
+ }
+}
+
void VideoDenoiser::DenoiseFrame(const VideoFrame& frame,
VideoFrame* denoised_frame,
VideoFrame* denoised_frame_prev,
@@ -309,6 +326,11 @@ void VideoDenoiser::DenoiseFrame(const VideoFrame& frame,
CopySrcOnMOB(y_src, y_dst);
+ // When frame width/height not divisible by 16, copy the margin to
+ // denoised_frame.
+ if ((mb_rows_ << 4) != height_ || (mb_cols_ << 4) != width_)
+ CopyLumaOnMargin(y_src, y_dst);
+
// TODO(jackychen): Need SSE2/NEON opt.
// Copy u/v planes.
memcpy(u_dst, u_src, (height_ >> 1) * stride_u_);
« no previous file with comments | « webrtc/modules/video_processing/video_denoiser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698