forge
Explore
Log in

Don't you dare go Hollow

The software H264 export codes Main-profile CABAC, 8x8 off

Browse files at this commit

02e230833375a87538ff92d30ace4c05ebda5c6bAhmet Kaan GümüşParent: 17b5566
  • perf
    • the software H264 export codes Main-profile CABAC, 8x8 off
Show full message
⚡ perf(engine): the software H264 export codes Main-profile CABAC, 8x8 off

Measured at the swap, 720p, all cores: the 8x8 transform is half the pure
encode (35.1 ms/frame against 17.2), worth at most 0.7 dB BD-PSNR the
Constrained-Baseline seat it replaced never had; CABAC stays (faster than
CAVLC here -- fewer tokens to code -- and smaller). Export wall on a
300-frame 720p window, hardware decode both sides, idle machine: rusty
65.2 fps against ec-h264 57.6 -- 0.877x as re-measured by review
(0.884x in-lane), still short of the 0.9x gate and reported as such; the rest of the delta is the encoder's sub-pel motion
and CABAC decision cost, which is the encoder lane's to reclaim, not a
knob left unpulled here (threads swept 4/6/8/12, CABAC/CAVLC, both
presets' cheaper arm already picked).

Quality at the seat's ~2.7 Mbps CBR, 300-frame window
(reviewer-reproduced, both seats driven directly, ffmpeg-decoded):
PSNR-Y 41.58 against rusty's 40.51, SSIM 0.9903 against 0.9842, ~2%
fewer bits and tighter rate fidelity (rusty overshot to 3.0 Mbps on hard
content).
crates/engine/src/export.rsmodified+8 -1
@@ -3909,11 +3909,18 @@ impl Enc {
3909 true => 1,3909 true => 1,
3910 false => (meta.frame_rate * 2.0).round().max(1.0) as u32,3910 false => (meta.frame_rate * 2.0).round().max(1.0) as u32,
3911 };3911 };
3912- cfg.bframes = 0;
3913 // Fast, the rung a fallback is allowed to cost -- the cheaper arm of3912 // Fast, the rung a fallback is allowed to cost -- the cheaper arm of
3914 // the preset ladder, the one the old seat's own S1 also picked when its3913 // the preset ladder, the one the old seat's own S1 also picked when its
3915 // Balanced rung halved the rate for the same bitrate.3914 // Balanced rung halved the rate for the same bitrate.
3916 cfg.preset = Preset::Fast;3915 cfg.preset = Preset::Fast;
3916+ // 8x8 transform off. At this rung it is half the pure-encode cost
3917+ // (17.2 ms/frame against 35.1 at 720p across all cores, measured at
3918+ // the swap) for at most 0.7 dB BD-PSNR -- against an old seat that ran
3919+ // Constrained Baseline and never had the transform in the first
3920+ // place. The export stays Main-profile CABAC, which is where the
3921+ // quality over the old seat lives; a constant-QP mode would be the
3922+ // place to revisit the rung whole.
3923+ cfg.transform_8x8 = false;
3917 let encoder = Encoder::new(cfg).map_err(|e| format!("software encoder: {e}"))?;3924 let encoder = Encoder::new(cfg).map_err(|e| format!("software encoder: {e}"))?;
3918 Ok(Self::Sw {3925 Ok(Self::Sw {
3919 encoder,3926 encoder,