Change forced software encoder fallback for VP8 to be only based on resolution and not bitrate.
Switches from VP8 HW to VP8 SW for resolutions <= max_pixels. |<- min_pixels VP8 SW max_pixels ->| VP8 HW | Bug: webrtc:6634 Change-Id: Ib324df2b8418659c29d999259c0ed47448310696 Reviewed-on: https://webrtc-review.googlesource.com/7362 Commit-Queue: Åsa Persson <asapersson@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20646}
This commit is contained in:
@ -104,36 +104,6 @@ TEST_F(VideoProcessorIntegrationTestMediaCodec,
|
||||
kNoVisualizationParams);
|
||||
}
|
||||
|
||||
TEST_F(VideoProcessorIntegrationTestMediaCodec,
|
||||
Foreman240p100kbpsVp8WithForcedSwFallback) {
|
||||
ScopedFieldTrials override_field_trials(
|
||||
"WebRTC-VP8-Forced-Fallback-Encoder/Enabled-150,175,10000,1/");
|
||||
|
||||
config_.filename = "foreman_320x240";
|
||||
config_.input_filename = ResourcePath(config_.filename, "yuv");
|
||||
config_.sw_fallback_encoder = true;
|
||||
config_.SetCodecSettings(kVideoCodecVP8, 1, false, false, false, false, false,
|
||||
320, 240);
|
||||
|
||||
std::vector<RateProfile> rate_profiles = {
|
||||
{100, 10, 80}, // Start below |low_kbps|.
|
||||
{100, 10, 200}, // Fallback in this bucket.
|
||||
{200, 10, kForemanNumFrames + 1}}; // Switch back here.
|
||||
|
||||
// The thresholds below may have to be tweaked to let even poor MediaCodec
|
||||
// implementations pass. If this test fails on the bots, disable it and
|
||||
// ping brandtr@.
|
||||
std::vector<RateControlThresholds> rc_thresholds = {{0, 50, 75, 70, 10, 0, 1},
|
||||
{0, 50, 25, 12, 60, 0, 1},
|
||||
{0, 65, 15, 5, 5, 0, 1}};
|
||||
|
||||
QualityThresholds quality_thresholds(33.0, 30.0, 0.90, 0.85);
|
||||
|
||||
ProcessFramesAndMaybeVerify(rate_profiles, &rc_thresholds,
|
||||
&quality_thresholds, nullptr,
|
||||
kNoVisualizationParams);
|
||||
}
|
||||
|
||||
#endif // defined(WEBRTC_ANDROID)
|
||||
|
||||
} // namespace test
|
||||
|
||||
@ -295,7 +295,8 @@ std::vector<TemporalLayers::FrameConfig> GetTemporalPattern(size_t num_layers) {
|
||||
// deregistred when deleted by SW codec (tl factory might not exist, owned by
|
||||
// SimulcastRateAllocator).
|
||||
bool ExcludeOnTemporalLayersCreated(int num_temporal_layers) {
|
||||
return webrtc::field_trial::IsEnabled("WebRTC-VP8-Forced-Fallback-Encoder") &&
|
||||
return webrtc::field_trial::IsEnabled(
|
||||
"WebRTC-VP8-Forced-Fallback-Encoder-v2") &&
|
||||
num_temporal_layers == 1;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@ -35,7 +35,6 @@ constexpr int64_t kInitialTimestampMs = 789;
|
||||
constexpr uint32_t kTimestampIncrement = 3000;
|
||||
constexpr int kNumCores = 1;
|
||||
constexpr size_t kMaxPayloadSize = 1440;
|
||||
constexpr int kMinPixelsPerFrame = 12345;
|
||||
constexpr int kDefaultMinPixelsPerFrame = 320 * 180;
|
||||
constexpr int kWidth = 172;
|
||||
constexpr int kHeight = 144;
|
||||
@ -504,22 +503,4 @@ TEST_F(TestVp8Impl, ScalingEnabledIfAutomaticResizeOn) {
|
||||
EXPECT_EQ(kDefaultMinPixelsPerFrame, settings.min_pixels_per_frame);
|
||||
}
|
||||
|
||||
class TestVp8ImplWithForcedFallbackEnabled : public TestVp8Impl {
|
||||
public:
|
||||
TestVp8ImplWithForcedFallbackEnabled()
|
||||
: TestVp8Impl("WebRTC-VP8-Forced-Fallback-Encoder/Enabled-1,2,3," +
|
||||
std::to_string(kMinPixelsPerFrame) + "/") {}
|
||||
};
|
||||
|
||||
TEST_F(TestVp8ImplWithForcedFallbackEnabled, MinPixelsPerFrameConfigured) {
|
||||
codec_settings_.VP8()->frameDroppingOn = true;
|
||||
codec_settings_.VP8()->automaticResizeOn = true;
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
encoder_->InitEncode(&codec_settings_, kNumCores, kMaxPayloadSize));
|
||||
|
||||
VideoEncoder::ScalingSettings settings = encoder_->GetScalingSettings();
|
||||
EXPECT_TRUE(settings.enabled);
|
||||
EXPECT_EQ(kMinPixelsPerFrame, settings.min_pixels_per_frame);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -42,8 +42,6 @@ namespace {
|
||||
|
||||
const char kVp8PostProcArmFieldTrial[] = "WebRTC-VP8-Postproc-Config-Arm";
|
||||
const char kVp8GfBoostFieldTrial[] = "WebRTC-VP8-GfBoost";
|
||||
const char kVp8ForceFallbackEncoderFieldTrial[] =
|
||||
"WebRTC-VP8-Forced-Fallback-Encoder";
|
||||
|
||||
const int kTokenPartitions = VP8_ONE_TOKENPARTITION;
|
||||
enum { kVp8ErrorPropagationTh = 30 };
|
||||
@ -127,31 +125,6 @@ int NumStreamsDisabled(const std::vector<bool>& streams) {
|
||||
return num_disabled;
|
||||
}
|
||||
|
||||
rtc::Optional<int> GetForcedFallbackMinPixelsFromFieldTrialGroup() {
|
||||
if (!webrtc::field_trial::IsEnabled(kVp8ForceFallbackEncoderFieldTrial))
|
||||
return rtc::Optional<int>();
|
||||
|
||||
std::string group =
|
||||
webrtc::field_trial::FindFullName(kVp8ForceFallbackEncoderFieldTrial);
|
||||
if (group.empty())
|
||||
return rtc::Optional<int>();
|
||||
|
||||
int low_kbps;
|
||||
int high_kbps;
|
||||
int min_low_ms;
|
||||
int min_pixels;
|
||||
if (sscanf(group.c_str(), "Enabled-%d,%d,%d,%d", &low_kbps, &high_kbps,
|
||||
&min_low_ms, &min_pixels) != 4) {
|
||||
return rtc::Optional<int>();
|
||||
}
|
||||
|
||||
if (min_low_ms <= 0 || min_pixels <= 0 || low_kbps <= 0 ||
|
||||
high_kbps <= low_kbps) {
|
||||
return rtc::Optional<int>();
|
||||
}
|
||||
return rtc::Optional<int>(min_pixels);
|
||||
}
|
||||
|
||||
bool GetGfBoostPercentageFromFieldTrialGroup(int* boost_percentage) {
|
||||
std::string group = webrtc::field_trial::FindFullName(kVp8GfBoostFieldTrial);
|
||||
if (group.empty())
|
||||
@ -223,7 +196,6 @@ vpx_enc_frame_flags_t VP8EncoderImpl::EncodeFlags(
|
||||
|
||||
VP8EncoderImpl::VP8EncoderImpl()
|
||||
: use_gf_boost_(webrtc::field_trial::IsEnabled(kVp8GfBoostFieldTrial)),
|
||||
min_pixels_per_frame_(GetForcedFallbackMinPixelsFromFieldTrialGroup()),
|
||||
encoded_complete_callback_(nullptr),
|
||||
inited_(false),
|
||||
timestamp_(0),
|
||||
@ -999,10 +971,6 @@ VideoEncoder::ScalingSettings VP8EncoderImpl::GetScalingSettings() const {
|
||||
const bool enable_scaling = encoders_.size() == 1 &&
|
||||
configurations_[0].rc_dropframe_thresh > 0 &&
|
||||
codec_.VP8().automaticResizeOn;
|
||||
if (enable_scaling && min_pixels_per_frame_) {
|
||||
return VideoEncoder::ScalingSettings(enable_scaling,
|
||||
*min_pixels_per_frame_);
|
||||
}
|
||||
return VideoEncoder::ScalingSettings(enable_scaling);
|
||||
}
|
||||
|
||||
|
||||
@ -94,7 +94,6 @@ class VP8EncoderImpl : public VP8Encoder {
|
||||
uint32_t MaxIntraTarget(uint32_t optimal_buffer_size);
|
||||
|
||||
const bool use_gf_boost_;
|
||||
const rtc::Optional<int> min_pixels_per_frame_;
|
||||
|
||||
EncodedImageCallback* encoded_complete_callback_;
|
||||
VideoCodec codec_;
|
||||
|
||||
Reference in New Issue
Block a user