PSA: Changes to VideoEncoder::ScalingSettings

150 views
Skip to first unread message

Niels Moller

unread,
Feb 8, 2018, 7:55:47 AM2/8/18
to discuss...@googlegroups.com
In webrtc, "quality scaling" is the mechanism to automatically scale
down video frames before encoding, if the quantization selected by the
encoder gets too coarse, resulting in severe compression artifacts on
decoding. Coarse quantization, in turn, is usually caused by low bit
rate.

The api/video_encoder header file declares a struct
VideoEncoder::ScalingSettings. Typical use is that encoders return it
from the GetScalingSettings() method, and webrtc configures quality
scaling based on these settings.

The struct currently consists of a flag to enable quality scaling, and
optional thresholds for qp values. It is then possible to enable
scaling, but omit values for the thresholds, and in this case, the
webrtc quality scaler uses default codec-specific thresholds.

In cl https://webrtc-review.googlesource.com/c/src/+/46622, which I
intend to land in two weeks time, those defaults are deleted from the
quality scaler, and it replaces ScalingSettings constructors so that
scaling is enabled if and only if thresholds are provided. This means
that an encoder that wants to enable quality scaling must use one of
the following new constructors:

ScalingSettings(int low, int high);
ScalingSettings(int low, int high, int min_pixels);

To disable quality scaling, use the constant

ScalingSettings::kOff

The default implementation, for encoders not overriding
GetScalingSettings(), returns this constant (no behavior change
there).

The android java interfaces will be updated accordingly. Cl
https://webrtc-review.googlesource.com/c/src/+/49062, which I plan to
land shortly, adds new constructors to the java ScalingSettings class,
and deprecates the old constructors. In the java api, enabling quality
scaling without supplying thresholds is deprecated but still
supported. The default thresholds are implemented in the jni glue.
Deletion of the deprecated constructor will happen later.

The objc encoder api is unchanged, since providing thresholds is
already required there.

Regards,
/Niels
Reply all
Reply to author
Forward
0 new messages