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

Side by Side Diff: webrtc/modules/video_processing/video_denoiser.h

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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DENOISER_H_ 11 #ifndef WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DENOISER_H_
12 #define WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DENOISER_H_ 12 #define WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DENOISER_H_
13 13
14 #include <memory> 14 #include <memory>
15 15
16 #include "webrtc/modules/video_processing/util/denoiser_filter.h" 16 #include "webrtc/modules/video_processing/util/denoiser_filter.h"
17 #include "webrtc/modules/video_processing/util/noise_estimation.h" 17 #include "webrtc/modules/video_processing/util/noise_estimation.h"
18 #include "webrtc/modules/video_processing/util/skin_detection.h" 18 #include "webrtc/modules/video_processing/util/skin_detection.h"
19 19
20 namespace webrtc { 20 namespace webrtc {
21 21
22 class VideoDenoiser { 22 class VideoDenoiser {
23 public: 23 public:
24 explicit VideoDenoiser(bool runtime_cpu_detection); 24 explicit VideoDenoiser(bool runtime_cpu_detection);
25
25 void DenoiseFrame(const VideoFrame& frame, 26 void DenoiseFrame(const VideoFrame& frame,
26 VideoFrame* denoised_frame, 27 VideoFrame* denoised_frame,
27 VideoFrame* denoised_frame_track, 28 VideoFrame* denoised_frame_prev,
28 int noise_level_prev); 29 bool noise_estimation_enabled);
29 30
30 private: 31 private:
32 void DenoiserReset(const VideoFrame& frame,
33 VideoFrame* denoised_frame,
34 VideoFrame* denoised_frame_prev);
35
36 // Check the mb position, return 1: close to the frame center (between 1/8
37 // and 7/8 of width/height), 3: close to the border (out of 1/16 and 15/16
38 // of width/height), 2: in between.
39 int PositionCheck(int mb_row, int mb_col, int noise_level);
40
41 // To reduce false detection in moving object detection (MOD).
42 void ReduceFalseDetection(const std::unique_ptr<uint8_t[]>& d_status,
43 std::unique_ptr<uint8_t[]>* d_status_red,
44 int noise_level);
45
46 // Return whether a block might cause trailing artifact by checking if one of
47 // its neighbor blocks is a moving edge block.
48 bool IsTrailingBlock(const std::unique_ptr<uint8_t[]>& d_status,
49 int mb_row,
50 int mb_col);
51
52 // Copy input blocks to dst buffer on moving object blocks (MOB).
53 void CopySrcOnMOB(const uint8_t* y_src, uint8_t* y_dst);
54
31 int width_; 55 int width_;
32 int height_; 56 int height_;
57 int mb_rows_;
58 int mb_cols_;
59 int stride_y_;
60 int stride_u_;
61 int stride_v_;
33 CpuType cpu_type_; 62 CpuType cpu_type_;
34 std::unique_ptr<DenoiseMetrics[]> metrics_;
35 std::unique_ptr<DenoiserFilter> filter_; 63 std::unique_ptr<DenoiserFilter> filter_;
36 std::unique_ptr<NoiseEstimation> ne_; 64 std::unique_ptr<NoiseEstimation> ne_;
37 std::unique_ptr<uint8_t[]> d_status_; 65 // 1 for moving edge block, 0 for static block.
38 #if EXPERIMENTAL 66 std::unique_ptr<uint8_t[]> moving_edge_;
39 std::unique_ptr<uint8_t[]> d_status_tmp1_; 67 // 1 for moving object block, 0 for static block.
40 std::unique_ptr<uint8_t[]> d_status_tmp2_; 68 std::unique_ptr<uint8_t[]> moving_object_;
41 #endif 69 // x_density_ and y_density_ are used in MOD process.
42 std::unique_ptr<uint8_t[]> x_density_; 70 std::unique_ptr<uint8_t[]> x_density_;
43 std::unique_ptr<uint8_t[]> y_density_; 71 std::unique_ptr<uint8_t[]> y_density_;
72 // Save the return values by MbDenoise for each block.
73 std::unique_ptr<DenoiserDecision[]> mb_filter_decision_;
44 }; 74 };
45 75
46 } // namespace webrtc 76 } // namespace webrtc
47 77
48 #endif // WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DENOISER_H_ 78 #endif // WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_DENOISER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/video_processing/util/noise_estimation.cc ('k') | webrtc/modules/video_processing/video_denoiser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698