blob: b71aa82aed6f9bccd24c8b161dad02927b1f3125 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
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 Kjellander0f59a882015-11-18 22:31:24 +010011#ifndef WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_PROCESSING_IMPL_H_
12#define WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_PROCESSING_IMPL_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
Peter Boströmf4aa4c22015-09-18 12:24:25 +020014#include "webrtc/base/criticalsection.h"
Henrik Kjellander0f59a882015-11-18 22:31:24 +010015#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.com470e71d2011-07-07 08:21:25 +000020
21namespace webrtc {
22class CriticalSectionWrapper;
23
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000024class VideoProcessingModuleImpl : public VideoProcessingModule {
25 public:
Peter Boströmf4aa4c22015-09-18 12:24:25 +020026 VideoProcessingModuleImpl();
27 ~VideoProcessingModuleImpl() override;
henrik.lundin@webrtc.org33df5332011-11-14 15:30:26 +000028
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000029 void Reset() override;
niklase@google.com470e71d2011-07-07 08:21:25 +000030
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -070031 int32_t Deflickering(VideoFrame* frame, FrameStats* stats) override;
niklase@google.com470e71d2011-07-07 08:21:25 +000032
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -070033 int32_t BrightnessDetection(const VideoFrame& frame,
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000034 const FrameStats& stats) override;
niklase@google.com470e71d2011-07-07 08:21:25 +000035
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000036 // Frame pre-processor functions
niklase@google.com470e71d2011-07-07 08:21:25 +000037
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000038 // Enable temporal decimation
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000039 void EnableTemporalDecimation(bool enable) override;
niklase@google.com470e71d2011-07-07 08:21:25 +000040
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000041 void SetInputFrameResampleMode(VideoFrameResampling resampling_mode) override;
niklase@google.com470e71d2011-07-07 08:21:25 +000042
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000043 // Enable content analysis
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000044 void EnableContentAnalysis(bool enable) override;
niklase@google.com470e71d2011-07-07 08:21:25 +000045
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000046 // Set Target Resolution: frame rate and dimension
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000047 int32_t SetTargetResolution(uint32_t width,
48 uint32_t height,
49 uint32_t frame_rate) override;
henrik.lundin@webrtc.org33df5332011-11-14 15:30:26 +000050
jackychen6e2ce6e2015-07-13 16:26:33 -070051 void SetTargetFramerate(int frame_rate) override;
52
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000053 // Get decimated values: frame rate/dimension
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000054 uint32_t Decimatedframe_rate() override;
55 uint32_t DecimatedWidth() const override;
56 uint32_t DecimatedHeight() const override;
niklase@google.com470e71d2011-07-07 08:21:25 +000057
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000058 // 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-Sanchez47650702015-05-29 17:21:40 -070062 int32_t PreprocessFrame(const VideoFrame& frame,
63 VideoFrame** processed_frame) override;
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000064 VideoContentMetrics* ContentMetrics() const override;
niklase@google.com470e71d2011-07-07 08:21:25 +000065
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000066 private:
Peter Boströmf4aa4c22015-09-18 12:24:25 +020067 mutable rtc::CriticalSection mutex_;
68 VPMDeflickering deflickering_ GUARDED_BY(mutex_);
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000069 VPMBrightnessDetection brightness_detection_;
tommi@webrtc.org41617152015-01-29 12:12:49 +000070 VPMFramePreprocessor frame_pre_processor_;
niklase@google.com470e71d2011-07-07 08:21:25 +000071};
72
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000073} // namespace
niklase@google.com470e71d2011-07-07 08:21:25 +000074
Henrik Kjellander0f59a882015-11-18 22:31:24 +010075#endif // WEBRTC_MODULES_VIDEO_PROCESSING_VIDEO_PROCESSING_IMPL_H_