2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-02-28 23:39:31 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2015-11-18 22:31:24 +01:00
|
|
|
#ifndef WEBRTC_MODULES_VIDEO_PROCESSING_FRAME_PREPROCESSOR_H_
|
|
|
|
|
#define WEBRTC_MODULES_VIDEO_PROCESSING_FRAME_PREPROCESSOR_H_
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-12-07 01:09:52 -08:00
|
|
|
#include "webrtc/base/scoped_ptr.h"
|
2015-11-18 22:31:24 +01:00
|
|
|
#include "webrtc/modules/video_processing/include/video_processing.h"
|
|
|
|
|
#include "webrtc/modules/video_processing/content_analysis.h"
|
|
|
|
|
#include "webrtc/modules/video_processing/spatial_resampler.h"
|
|
|
|
|
#include "webrtc/modules/video_processing/video_decimator.h"
|
2013-05-27 14:12:16 +00:00
|
|
|
#include "webrtc/typedefs.h"
|
2015-11-26 02:59:48 -08:00
|
|
|
#include "webrtc/video_frame.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2015-12-07 01:09:52 -08:00
|
|
|
class VideoDenoiser;
|
|
|
|
|
|
|
|
|
|
// All pointers/members in this class are assumed to be protected by the class
|
|
|
|
|
// owner.
|
2013-10-03 16:42:41 +00:00
|
|
|
class VPMFramePreprocessor {
|
|
|
|
|
public:
|
|
|
|
|
VPMFramePreprocessor();
|
|
|
|
|
~VPMFramePreprocessor();
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-10-03 16:42:41 +00:00
|
|
|
void Reset();
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-10-03 16:42:41 +00:00
|
|
|
// Enable temporal decimation.
|
|
|
|
|
void EnableTemporalDecimation(bool enable);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-10-03 16:42:41 +00:00
|
|
|
void SetInputFrameResampleMode(VideoFrameResampling resampling_mode);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-10-03 16:42:41 +00:00
|
|
|
// Enable content analysis.
|
|
|
|
|
void EnableContentAnalysis(bool enable);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-10-03 16:42:41 +00:00
|
|
|
// Set target resolution: frame rate and dimension.
|
|
|
|
|
int32_t SetTargetResolution(uint32_t width, uint32_t height,
|
|
|
|
|
uint32_t frame_rate);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-07-13 16:26:33 -07:00
|
|
|
// Set target frame rate.
|
|
|
|
|
void SetTargetFramerate(int frame_rate);
|
|
|
|
|
|
2013-10-03 16:42:41 +00:00
|
|
|
// Update incoming frame rate/dimension.
|
|
|
|
|
void UpdateIncomingframe_rate();
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-10-03 16:42:41 +00:00
|
|
|
int32_t updateIncomingFrameSize(uint32_t width, uint32_t height);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-10-03 16:42:41 +00:00
|
|
|
// Set decimated values: frame rate/dimension.
|
2015-12-07 01:09:52 -08:00
|
|
|
uint32_t GetDecimatedFrameRate();
|
|
|
|
|
uint32_t GetDecimatedWidth() const;
|
|
|
|
|
uint32_t GetDecimatedHeight() const;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-10-03 16:42:41 +00:00
|
|
|
// Preprocess output:
|
2015-12-07 01:09:52 -08:00
|
|
|
void EnableDenosing(bool enable);
|
|
|
|
|
const VideoFrame* PreprocessFrame(const VideoFrame& frame);
|
|
|
|
|
VideoContentMetrics* GetContentMetrics() const;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-10-03 16:42:41 +00:00
|
|
|
private:
|
|
|
|
|
// The content does not change so much every frame, so to reduce complexity
|
|
|
|
|
// we can compute new content metrics every |kSkipFrameCA| frames.
|
|
|
|
|
enum { kSkipFrameCA = 2 };
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-10-03 16:42:41 +00:00
|
|
|
VideoContentMetrics* content_metrics_;
|
2015-11-26 02:59:48 -08:00
|
|
|
VideoFrame denoised_frame_;
|
2015-05-29 17:21:40 -07:00
|
|
|
VideoFrame resampled_frame_;
|
2013-10-03 16:42:41 +00:00
|
|
|
VPMSpatialResampler* spatial_resampler_;
|
|
|
|
|
VPMContentAnalysis* ca_;
|
|
|
|
|
VPMVideoDecimator* vd_;
|
2015-12-07 01:09:52 -08:00
|
|
|
rtc::scoped_ptr<VideoDenoiser> denoiser_;
|
2013-10-03 16:42:41 +00:00
|
|
|
bool enable_ca_;
|
2015-12-07 01:09:52 -08:00
|
|
|
uint32_t frame_cnt_;
|
2013-10-03 16:42:41 +00:00
|
|
|
};
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-10-03 16:42:41 +00:00
|
|
|
} // namespace webrtc
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-12-07 01:09:52 -08:00
|
|
|
#endif // WEBRTC_MODULES_VIDEO_PROCESSING_FRAME_PREPROCESSOR_H_
|