Skip to main content

Module rd_knee

Module rd_knee 

Source
Expand description

Fixed-frame R-D curve parameterization with corner-based angles.

Every encode lives in a triangle: the worst corner (max bpp, zero quality) is the origin, and the angle from that corner describes position on the rate-distortion tradeoff. This is comparable across codecs, corpora, and resolutions because the frame is fixed by the metric scales and a practical bpp ceiling.

§Fixed frame (web targeting)

AxisMinMaxNotes
bpp04.0Practical web ceiling
s20100SSIMULACRA2 scale
ba015Butteraugli practical floor (inverted)

§Corner angle

θ = atan2(quality_norm * aspect, 1.0 - bpp_norm)

The aspect ratio is calibrated from the reference codec knee (mozjpeg 4:2:0 on CID22) so that the knee lands at exactly 45°.

  • θ < 0° → worse than the worst corner (negative quality)
  • θ = 0° → worst corner (max bpp, zero quality)
  • θ < 45° → compression-efficient (below the knee)
  • θ = 45° → reference knee (balanced tradeoff)
  • θ ≈ 52° → ideal diagonal (zero bpp, perfect quality)
  • θ > 52° → quality-dominated (spending bits for diminishing returns)
  • θ = 90° → no compression (max bpp, max quality)
  • θ > 90° → over-budget (bpp exceeds frame ceiling)

The knee (45° tangent on the corpus-aggregate curve) is a landmark within this system, not the origin. Its angle tells you where the “balanced tradeoff” falls for a given codec.

§Dual-metric angles

SSIMULACRA2 and Butteraugli produce different angles for the same encode. Comparing theta_s2 and theta_ba reveals what kind of artifacts the codec configuration produces at that operating point.

Modules§

defaults
Measured defaults from corpus calibration runs (2026-02-03).

Structs§

AngleBin
A single angular bin.
AxisRange
Range for normalizing an axis to [0, 1].
BinScheme
Defines how the [0°, 90°] range is divided into bins.
CodecConfig
The full set of tuning knobs that produced a particular encode.
ConfiguredParetoFront
Pareto frontier with angular binning.
ConfiguredRDPoint
A point on the configuration-aware Pareto frontier.
CorpusAggregate
Aggregated R-D data from a corpus.
DualAngleBin
Dual-metric bin.
EncodeResult
A single encode result from one image at one quality level.
FixedFrame
Fixed normalization frame for web-targeted R-D analysis.
NormalizationContext
Normalization context for knee detection (uses per-curve observed ranges).
RDCalibration
Dual-metric calibration with knee landmarks in the fixed frame.
RDKnee
The 45° tangent point on a corpus-aggregate R-D curve.
RDPosition
An encode’s position in the fixed-frame corner coordinate system.

Enums§

ParamValue
A single tuning parameter value.
QualityDirection
Direction of a quality metric.

Functions§

plot_rd_svg
Generate an SVG plot of the R-D curve with corner angle grid and knee markers.