Skip to main content

level_quantizer

Function level_quantizer 

Source
pub const fn level_quantizer(
    codec: VideoCodec,
    level: QualityLevel,
) -> Option<u32>
Expand description

The constant quantizer a level resolves to for codec, where the engine has measured one.

H.264 only, on its 0-51 QP scale, which h264_vulkan, h264_nvenc and WebCodecs’ avc quantizer mode share. Each value is the QP at which h264_vulkan holds the level’s own PSNR-Y definition on the harder measured content at the size the levels are stated at (the colour clip at 1920x816: 32.5, 35.6, 38.4, 41.3 and 44.4 dB under the bitrate path), rounded toward the better picture. QP moves PSNR by 0.66 dB a step there and by about the same at 4K, so one QP per level serves every size. HEVC and AV1 encoders open a quantizer mode too, but what their QPs are worth has not been measured, so their levels stay bitrate-only rather than borrowing H.264’s; MPEG-4 Part 2’s encoder takes its quantizer per frame and not from the options a sink sets, so it has none either.