Move default thresholds from QualityScaler to encoders.
Overriding implementations of VideoEncoder::GetScalingSettings that want to enable quality scaling must now provide the thresholds. Bug: webrtc:8830 Change-Id: I75c47cb56ac1b9cf77401684980b3167e485f51c Reviewed-on: https://webrtc-review.googlesource.com/46622 Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Reviewed-by: Åsa Persson <asapersson@webrtc.org> Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22172}
This commit is contained in:
@ -31,6 +31,10 @@ namespace {
|
||||
|
||||
const bool kOpenH264EncoderDetailedLogging = false;
|
||||
|
||||
// QP scaling thresholds.
|
||||
static const int kLowH264QpThreshold = 24;
|
||||
static const int kHighH264QpThreshold = 37;
|
||||
|
||||
// Used by histograms. Values of entries should not be changed.
|
||||
enum H264EncoderImplEvent {
|
||||
kH264EncoderEventInit = 0,
|
||||
@ -503,7 +507,8 @@ int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) {
|
||||
}
|
||||
|
||||
VideoEncoder::ScalingSettings H264EncoderImpl::GetScalingSettings() const {
|
||||
return VideoEncoder::ScalingSettings(true);
|
||||
return VideoEncoder::ScalingSettings(kLowH264QpThreshold,
|
||||
kHighH264QpThreshold);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -487,7 +487,7 @@ TEST_F(TestVp8Impl, ScalingDisabledIfAutomaticResizeOff) {
|
||||
encoder_->InitEncode(&codec_settings_, kNumCores, kMaxPayloadSize));
|
||||
|
||||
VideoEncoder::ScalingSettings settings = encoder_->GetScalingSettings();
|
||||
EXPECT_FALSE(settings.enabled);
|
||||
EXPECT_FALSE(settings.thresholds.has_value());
|
||||
}
|
||||
|
||||
TEST_F(TestVp8Impl, ScalingEnabledIfAutomaticResizeOn) {
|
||||
@ -497,7 +497,7 @@ TEST_F(TestVp8Impl, ScalingEnabledIfAutomaticResizeOn) {
|
||||
encoder_->InitEncode(&codec_settings_, kNumCores, kMaxPayloadSize));
|
||||
|
||||
VideoEncoder::ScalingSettings settings = encoder_->GetScalingSettings();
|
||||
EXPECT_TRUE(settings.enabled);
|
||||
EXPECT_TRUE(settings.thresholds.has_value());
|
||||
EXPECT_EQ(kDefaultMinPixelsPerFrame, settings.min_pixels_per_frame);
|
||||
}
|
||||
|
||||
|
||||
@ -42,6 +42,11 @@ namespace {
|
||||
const char kVp8PostProcArmFieldTrial[] = "WebRTC-VP8-Postproc-Config-Arm";
|
||||
const char kVp8GfBoostFieldTrial[] = "WebRTC-VP8-GfBoost";
|
||||
|
||||
// QP is obtained from VP8-bitstream for HW, so the QP corresponds to the
|
||||
// bitstream range of [0, 127] and not the user-level range of [0,63].
|
||||
static const int kLowVp8QpThreshold = 29;
|
||||
static const int kHighVp8QpThreshold = 95;
|
||||
|
||||
const int kTokenPartitions = VP8_ONE_TOKENPARTITION;
|
||||
enum { kVp8ErrorPropagationTh = 30 };
|
||||
enum { kVp832ByteAlign = 32 };
|
||||
@ -1010,7 +1015,9 @@ VideoEncoder::ScalingSettings VP8EncoderImpl::GetScalingSettings() const {
|
||||
const bool enable_scaling = encoders_.size() == 1 &&
|
||||
configurations_[0].rc_dropframe_thresh > 0 &&
|
||||
codec_.VP8().automaticResizeOn;
|
||||
return VideoEncoder::ScalingSettings(enable_scaling);
|
||||
return enable_scaling ? VideoEncoder::ScalingSettings(kLowVp8QpThreshold,
|
||||
kHighVp8QpThreshold)
|
||||
: VideoEncoder::ScalingSettings::kOff;
|
||||
}
|
||||
|
||||
int VP8EncoderImpl::SetChannelParameters(uint32_t packetLoss, int64_t rtt) {
|
||||
|
||||
Reference in New Issue
Block a user