niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Henrik Kjellander | 0f59a88 | 2015-11-18 22:31:24 +0100 | [diff] [blame^] | 11 | #ifndef WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_PROCESSING_IMPL_H_ |
| 12 | #define WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_PROCESSING_IMPL_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
Peter Boström | f4aa4c2 | 2015-09-18 12:24:25 +0200 | [diff] [blame] | 14 | #include "webrtc/base/criticalsection.h" |
Henrik Kjellander | 0f59a88 | 2015-11-18 22:31:24 +0100 | [diff] [blame^] | 15 | #include "webrtc/modules/video_processing/include/video_processing.h" |
| 16 | #include "webrtc/modules/video_processing/brighten.h" |
| 17 | #include "webrtc/modules/video_processing/brightness_detection.h" |
| 18 | #include "webrtc/modules/video_processing/deflickering.h" |
| 19 | #include "webrtc/modules/video_processing/frame_preprocessor.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
| 22 | class CriticalSectionWrapper; |
| 23 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 24 | class VideoProcessingModuleImpl : public VideoProcessingModule { |
| 25 | public: |
Peter Boström | f4aa4c2 | 2015-09-18 12:24:25 +0200 | [diff] [blame] | 26 | VideoProcessingModuleImpl(); |
| 27 | ~VideoProcessingModuleImpl() override; |
henrik.lundin@webrtc.org | 33df533 | 2011-11-14 15:30:26 +0000 | [diff] [blame] | 28 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 29 | void Reset() override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 30 | |
Miguel Casas-Sanchez | 4765070 | 2015-05-29 17:21:40 -0700 | [diff] [blame] | 31 | int32_t Deflickering(VideoFrame* frame, FrameStats* stats) override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 32 | |
Miguel Casas-Sanchez | 4765070 | 2015-05-29 17:21:40 -0700 | [diff] [blame] | 33 | int32_t BrightnessDetection(const VideoFrame& frame, |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 34 | const FrameStats& stats) override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 35 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 36 | // Frame pre-processor functions |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 37 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 38 | // Enable temporal decimation |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 39 | void EnableTemporalDecimation(bool enable) override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 40 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 41 | void SetInputFrameResampleMode(VideoFrameResampling resampling_mode) override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 42 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 43 | // Enable content analysis |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 44 | void EnableContentAnalysis(bool enable) override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 45 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 46 | // Set Target Resolution: frame rate and dimension |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 47 | int32_t SetTargetResolution(uint32_t width, |
| 48 | uint32_t height, |
| 49 | uint32_t frame_rate) override; |
henrik.lundin@webrtc.org | 33df533 | 2011-11-14 15:30:26 +0000 | [diff] [blame] | 50 | |
jackychen | 6e2ce6e | 2015-07-13 16:26:33 -0700 | [diff] [blame] | 51 | void SetTargetFramerate(int frame_rate) override; |
| 52 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 53 | // Get decimated values: frame rate/dimension |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 54 | uint32_t Decimatedframe_rate() override; |
| 55 | uint32_t DecimatedWidth() const override; |
| 56 | uint32_t DecimatedHeight() const override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 57 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 58 | // Preprocess: |
| 59 | // Pre-process incoming frame: Sample when needed and compute content |
| 60 | // metrics when enabled. |
| 61 | // If no resampling takes place - processed_frame is set to NULL. |
Miguel Casas-Sanchez | 4765070 | 2015-05-29 17:21:40 -0700 | [diff] [blame] | 62 | int32_t PreprocessFrame(const VideoFrame& frame, |
| 63 | VideoFrame** processed_frame) override; |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 64 | VideoContentMetrics* ContentMetrics() const override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 65 | |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 66 | private: |
Peter Boström | f4aa4c2 | 2015-09-18 12:24:25 +0200 | [diff] [blame] | 67 | mutable rtc::CriticalSection mutex_; |
| 68 | VPMDeflickering deflickering_ GUARDED_BY(mutex_); |
mikhal@webrtc.org | b43d807 | 2013-10-03 16:42:41 +0000 | [diff] [blame] | 69 | VPMBrightnessDetection brightness_detection_; |
tommi@webrtc.org | 4161715 | 2015-01-29 12:12:49 +0000 | [diff] [blame] | 70 | VPMFramePreprocessor frame_pre_processor_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 71 | }; |
| 72 | |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 73 | } // namespace |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 74 | |
Henrik Kjellander | 0f59a88 | 2015-11-18 22:31:24 +0100 | [diff] [blame^] | 75 | #endif // WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_PROCESSING_IMPL_H_ |