Increase VPMVideoDecimator's initial max_frame_rate_ to 60, which allow us potentially do 60fps.

BUG=
R=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/21499006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6274 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
wu@webrtc.org 2014-05-29 19:43:26 +00:00
parent 7a9a3b70b3
commit 21a5d449b7
9 changed files with 5 additions and 64 deletions

View File

@ -249,7 +249,6 @@ QualityModesTest::Perform(const CmdArgs& args)
VideoContentMetrics* contentMetrics = NULL; VideoContentMetrics* contentMetrics = NULL;
// setting user frame rate // setting user frame rate
_vpm->SetMaxFramerate((uint32_t)(_nativeFrameRate+ 0.5f));
// for starters: keeping native values: // for starters: keeping native values:
_vpm->SetTargetResolution(_width, _height, _vpm->SetTargetResolution(_width, _height,
(uint32_t)(_frameRate+ 0.5f)); (uint32_t)(_frameRate+ 0.5f));

View File

@ -235,14 +235,6 @@ class VideoProcessingModule : public Module {
uint32_t height, uint32_t height,
uint32_t frame_rate) = 0; uint32_t frame_rate) = 0;
/**
Set max frame rate
\param[in] max_frame_rate: maximum frame rate (limited to native frame rate)
\return VPM_OK on success, a negative value on error (see error codes)
*/
virtual int32_t SetMaxFramerate(uint32_t max_frame_rate) = 0;
/** /**
Get decimated(target) frame rate Get decimated(target) frame rate
*/ */

View File

@ -15,7 +15,6 @@ namespace webrtc {
VPMFramePreprocessor::VPMFramePreprocessor() VPMFramePreprocessor::VPMFramePreprocessor()
: id_(0), : id_(0),
content_metrics_(NULL), content_metrics_(NULL),
max_frame_rate_(0),
resampled_frame_(), resampled_frame_(),
enable_ca_(false), enable_ca_(false),
frame_cnt_(0) { frame_cnt_(0) {
@ -59,14 +58,6 @@ void VPMFramePreprocessor::SetInputFrameResampleMode(
spatial_resampler_->SetInputFrameResampleMode(resampling_mode); spatial_resampler_->SetInputFrameResampleMode(resampling_mode);
} }
int32_t VPMFramePreprocessor::SetMaxFramerate(uint32_t max_frame_rate) {
if (max_frame_rate == 0) return VPM_PARAMETER_ERROR;
// Max allowed frame_rate.
max_frame_rate_ = max_frame_rate;
return vd_->SetMaxFramerate(max_frame_rate);
}
int32_t VPMFramePreprocessor::SetTargetResolution( int32_t VPMFramePreprocessor::SetTargetResolution(
uint32_t width, uint32_t height, uint32_t frame_rate) { uint32_t width, uint32_t height, uint32_t frame_rate) {
if ( (width == 0) || (height == 0) || (frame_rate == 0)) { if ( (width == 0) || (height == 0) || (frame_rate == 0)) {
@ -77,7 +68,7 @@ int32_t VPMFramePreprocessor::SetTargetResolution(
if (ret_val < 0) return ret_val; if (ret_val < 0) return ret_val;
ret_val = vd_->SetTargetframe_rate(frame_rate); ret_val = vd_->SetTargetFramerate(frame_rate);
if (ret_val < 0) return ret_val; if (ret_val < 0) return ret_val;
return VPM_OK; return VPM_OK;

View File

@ -39,9 +39,6 @@ class VPMFramePreprocessor {
// Enable content analysis. // Enable content analysis.
void EnableContentAnalysis(bool enable); void EnableContentAnalysis(bool enable);
// Set max frame rate.
int32_t SetMaxFramerate(uint32_t max_frame_rate);
// Set target resolution: frame rate and dimension. // Set target resolution: frame rate and dimension.
int32_t SetTargetResolution(uint32_t width, uint32_t height, int32_t SetTargetResolution(uint32_t width, uint32_t height,
uint32_t frame_rate); uint32_t frame_rate);
@ -68,7 +65,6 @@ class VPMFramePreprocessor {
int32_t id_; int32_t id_;
VideoContentMetrics* content_metrics_; VideoContentMetrics* content_metrics_;
uint32_t max_frame_rate_;
I420VideoFrame resampled_frame_; I420VideoFrame resampled_frame_;
VPMSpatialResampler* spatial_resampler_; VPMSpatialResampler* spatial_resampler_;
VPMContentAnalysis* ca_; VPMContentAnalysis* ca_;

View File

@ -16,15 +16,7 @@
namespace webrtc { namespace webrtc {
VPMVideoDecimator::VPMVideoDecimator() VPMVideoDecimator::VPMVideoDecimator() {
: overshoot_modifier_(0),
drop_count_(0),
keep_count_(0),
target_frame_rate_(30),
incoming_frame_rate_(0.0f),
max_frame_rate_(30),
incoming_frame_times_(),
enable_temporal_decimation_(true) {
Reset(); Reset();
} }
@ -36,7 +28,6 @@ void VPMVideoDecimator::Reset() {
keep_count_ = 0; keep_count_ = 0;
target_frame_rate_ = 30; target_frame_rate_ = 30;
incoming_frame_rate_ = 0.0f; incoming_frame_rate_ = 0.0f;
max_frame_rate_ = 30;
memset(incoming_frame_times_, 0, sizeof(incoming_frame_times_)); memset(incoming_frame_times_, 0, sizeof(incoming_frame_times_));
enable_temporal_decimation_ = true; enable_temporal_decimation_ = true;
} }
@ -45,26 +36,10 @@ void VPMVideoDecimator::EnableTemporalDecimation(bool enable) {
enable_temporal_decimation_ = enable; enable_temporal_decimation_ = enable;
} }
int32_t VPMVideoDecimator::SetMaxFramerate(uint32_t max_frame_rate) { int32_t VPMVideoDecimator::SetTargetFramerate(uint32_t frame_rate) {
if (max_frame_rate == 0) return VPM_PARAMETER_ERROR;
max_frame_rate_ = max_frame_rate;
if (target_frame_rate_ > max_frame_rate_)
target_frame_rate_ = max_frame_rate_;
return VPM_OK;
}
int32_t VPMVideoDecimator::SetTargetframe_rate(uint32_t frame_rate) {
if (frame_rate == 0) return VPM_PARAMETER_ERROR; if (frame_rate == 0) return VPM_PARAMETER_ERROR;
if (frame_rate > max_frame_rate_) { target_frame_rate_ = frame_rate;
// Override.
target_frame_rate_ = max_frame_rate_;
} else {
target_frame_rate_ = frame_rate;
}
return VPM_OK; return VPM_OK;
} }

View File

@ -25,8 +25,7 @@ class VPMVideoDecimator {
void EnableTemporalDecimation(bool enable); void EnableTemporalDecimation(bool enable);
int32_t SetMaxFramerate(uint32_t max_frame_rate); int32_t SetTargetFramerate(uint32_t frame_rate);
int32_t SetTargetframe_rate(uint32_t frame_rate);
bool DropFrame(); bool DropFrame();
@ -50,7 +49,6 @@ class VPMVideoDecimator {
uint32_t keep_count_; uint32_t keep_count_;
uint32_t target_frame_rate_; uint32_t target_frame_rate_;
float incoming_frame_rate_; float incoming_frame_rate_;
uint32_t max_frame_rate_;
int64_t incoming_frame_times_[kFrameCountHistory_size]; int64_t incoming_frame_times_[kFrameCountHistory_size];
bool enable_temporal_decimation_; bool enable_temporal_decimation_;
}; };

View File

@ -171,11 +171,6 @@ void VideoProcessingModuleImpl::SetInputFrameResampleMode(VideoFrameResampling
frame_pre_processor_.SetInputFrameResampleMode(resampling_mode); frame_pre_processor_.SetInputFrameResampleMode(resampling_mode);
} }
int32_t VideoProcessingModuleImpl::SetMaxFramerate(uint32_t max_frame_rate) {
CriticalSectionScoped cs(&mutex_);
return frame_pre_processor_.SetMaxFramerate(max_frame_rate);
}
int32_t VideoProcessingModuleImpl::SetTargetResolution(uint32_t width, int32_t VideoProcessingModuleImpl::SetTargetResolution(uint32_t width,
uint32_t height, uint32_t height,
uint32_t frame_rate) { uint32_t frame_rate) {

View File

@ -51,9 +51,6 @@ class VideoProcessingModuleImpl : public VideoProcessingModule {
// Enable content analysis // Enable content analysis
virtual void EnableContentAnalysis(bool enable); virtual void EnableContentAnalysis(bool enable);
// Set max frame rate
virtual int32_t SetMaxFramerate(uint32_t max_frame_rate);
// Set Target Resolution: frame rate and dimension // Set Target Resolution: frame rate and dimension
virtual int32_t SetTargetResolution(uint32_t width, virtual int32_t SetTargetResolution(uint32_t width,
uint32_t height, uint32_t height,

View File

@ -118,7 +118,6 @@ TEST_F(VideoProcessingModuleTest, HandleBadSize) {
EXPECT_EQ(-3, vpm_->BrightnessDetection(video_frame_, stats)); EXPECT_EQ(-3, vpm_->BrightnessDetection(video_frame_, stats));
EXPECT_EQ(VPM_PARAMETER_ERROR, vpm_->SetTargetResolution(0,0,0)); EXPECT_EQ(VPM_PARAMETER_ERROR, vpm_->SetTargetResolution(0,0,0));
EXPECT_EQ(VPM_PARAMETER_ERROR, vpm_->SetMaxFramerate(0));
I420VideoFrame *out_frame = NULL; I420VideoFrame *out_frame = NULL;
EXPECT_EQ(VPM_PARAMETER_ERROR, vpm_->PreprocessFrame(video_frame_, EXPECT_EQ(VPM_PARAMETER_ERROR, vpm_->PreprocessFrame(video_frame_,
@ -200,7 +199,6 @@ TEST_F(VideoProcessingModuleTest, PreprocessorLogic) {
// Disable temporal sampling (frame dropping). // Disable temporal sampling (frame dropping).
vpm_->EnableTemporalDecimation(false); vpm_->EnableTemporalDecimation(false);
int resolution = 100; int resolution = 100;
EXPECT_EQ(VPM_OK, vpm_->SetMaxFramerate(30));
EXPECT_EQ(VPM_OK, vpm_->SetTargetResolution(resolution, resolution, 15)); EXPECT_EQ(VPM_OK, vpm_->SetTargetResolution(resolution, resolution, 15));
EXPECT_EQ(VPM_OK, vpm_->SetTargetResolution(resolution, resolution, 30)); EXPECT_EQ(VPM_OK, vpm_->SetTargetResolution(resolution, resolution, 30));
// Disable spatial sampling. // Disable spatial sampling.