2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-02-20 09:00:35 +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-12-07 01:09:52 -08:00
|
|
|
|
2015-11-18 22:31:24 +01:00
|
|
|
#include "webrtc/modules/video_processing/video_processing_impl.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-08-05 16:22:53 +00:00
|
|
|
#include <assert.h>
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-12-07 01:09:52 -08:00
|
|
|
#include "webrtc/base/checks.h"
|
|
|
|
|
#include "webrtc/base/logging.h"
|
|
|
|
|
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
|
|
|
|
|
|
2011-07-07 08:21:25 +00:00
|
|
|
namespace webrtc {
|
|
|
|
|
|
2015-12-07 01:09:52 -08:00
|
|
|
VideoProcessing* VideoProcessing::Create() {
|
|
|
|
|
return new VideoProcessingImpl();
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-12-07 01:09:52 -08:00
|
|
|
VideoProcessingImpl::VideoProcessingImpl() {}
|
|
|
|
|
VideoProcessingImpl::~VideoProcessingImpl() {}
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-12-07 01:09:52 -08:00
|
|
|
void VideoProcessingImpl::EnableTemporalDecimation(bool enable) {
|
2015-09-18 12:24:25 +02:00
|
|
|
rtc::CritScope mutex(&mutex_);
|
2013-10-03 16:42:41 +00:00
|
|
|
frame_pre_processor_.EnableTemporalDecimation(enable);
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-12-07 22:54:50 -08:00
|
|
|
void VideoProcessingImpl::SetInputFrameResampleMode(
|
|
|
|
|
VideoFrameResampling resampling_mode) {
|
2015-09-18 12:24:25 +02:00
|
|
|
rtc::CritScope cs(&mutex_);
|
2013-10-03 16:42:41 +00:00
|
|
|
frame_pre_processor_.SetInputFrameResampleMode(resampling_mode);
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-12-07 01:09:52 -08:00
|
|
|
int32_t VideoProcessingImpl::SetTargetResolution(uint32_t width,
|
|
|
|
|
uint32_t height,
|
|
|
|
|
uint32_t frame_rate) {
|
2015-09-18 12:24:25 +02:00
|
|
|
rtc::CritScope cs(&mutex_);
|
2013-10-03 16:42:41 +00:00
|
|
|
return frame_pre_processor_.SetTargetResolution(width, height, frame_rate);
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-12-07 01:09:52 -08:00
|
|
|
uint32_t VideoProcessingImpl::GetDecimatedFrameRate() {
|
2015-09-18 12:24:25 +02:00
|
|
|
rtc::CritScope cs(&mutex_);
|
2015-12-07 22:54:50 -08:00
|
|
|
return frame_pre_processor_.GetDecimatedFrameRate();
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-12-07 01:09:52 -08:00
|
|
|
uint32_t VideoProcessingImpl::GetDecimatedWidth() const {
|
2015-09-18 12:24:25 +02:00
|
|
|
rtc::CritScope cs(&mutex_);
|
2015-12-07 01:09:52 -08:00
|
|
|
return frame_pre_processor_.GetDecimatedWidth();
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-12-07 01:09:52 -08:00
|
|
|
uint32_t VideoProcessingImpl::GetDecimatedHeight() const {
|
2015-09-18 12:24:25 +02:00
|
|
|
rtc::CritScope cs(&mutex_);
|
2015-12-07 01:09:52 -08:00
|
|
|
return frame_pre_processor_.GetDecimatedHeight();
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2016-04-27 00:59:22 -07:00
|
|
|
void VideoProcessingImpl::EnableDenoising(bool enable) {
|
2015-12-07 01:09:52 -08:00
|
|
|
rtc::CritScope cs(&mutex_);
|
2016-04-27 00:59:22 -07:00
|
|
|
frame_pre_processor_.EnableDenoising(enable);
|
2015-12-07 01:09:52 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const VideoFrame* VideoProcessingImpl::PreprocessFrame(
|
|
|
|
|
const VideoFrame& frame) {
|
2015-09-18 12:24:25 +02:00
|
|
|
rtc::CritScope mutex(&mutex_);
|
2015-12-07 01:09:52 -08:00
|
|
|
return frame_pre_processor_.PreprocessFrame(frame);
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-03 16:42:41 +00:00
|
|
|
} // namespace webrtc
|