From e6624f3f9c5d9ad482104c39c008b5e80595db93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 13 Aug 2026 09:13:04 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(export):=20the=20GPU=20takes?= =?UTF-8?q?=20the=20HEVC=20export=20again?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The seat goes back to being the default, with the reason it was safe to make one restored rather than assumed: both HEVC seats code intra-only, so preferring the GPU changes how long an export takes and not what comes out of it -- and there is now a test that says so about the *pixels* (`a_1080p_hardware_export_leaves_a_decoder_with_nothing_to_say`) rather than about the frame count. Measured on this box's radeonsi/VCN before the flip, every export decoded by ffmpeg with an empty error channel: a 60 s span of a 1080p source at SSIM 0.976/0.965/0.983/0.971 over four spread frames, a 3840x1600 HDR film at 0.947 against the H.264 hardware export of the same span, a 2560x1440 capture -- whose height is not a coding tree multiple -- at 0.873/0.880/0.881, and the sub-384 picture still falling to `oxideav-h265`. --- crates/engine/src/export.rs | 15 ++++++++------- crates/engine/tests/hevc_export.rs | 19 +++++++++++-------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/crates/engine/src/export.rs b/crates/engine/src/export.rs index 6e1be6c..daa130b 100644 --- a/crates/engine/src/export.rs +++ b/crates/engine/src/export.rs @@ -496,13 +496,14 @@ fn hw_seat(meta: &VideoMeta, settings: &ExportSettings) -> Option { let (fps_num, fps_den) = crate::mux::frame_timing(meta.frame_rate).ok()?; let bitrate = bitrate_of(meta, settings); match settings.format { - // Both HEVC formats sit on the plugin's HEVC seat, and it is opt-in - // while its pixels are under repair: on real 1080p and 4K material the - // GPU's file decodes frame-for-frame and *looks* wrong -- a garbled - // band over flat green, one `CABAC_MAX_BIN` notice per frame. Until - // that is found and proven gone, the software intra encoder takes the - // file and `VE_HW_HEVC=1` is what asks for the GPU. - format if format.is_hevc() && !forced("VE_HW_HEVC") => None, + // Both HEVC formats sit on the plugin's HEVC seat, and it is the + // default again: what it codes is intra-only, the very file the + // software seat writes, so preferring the GPU changes how long an + // export takes and not what comes out of it. What made that untrue for + // one day was the vendored encoder's parameter sets promising coding + // tools the driver was not using; the pictures are now measured against + // their sources rather than counted + // (`hevc_export::a_1080p_hardware_export_leaves_a_decoder_with_nothing_to_say`). // `None` here is the plugin's own "no" -- no entrypoint, or a picture // under the driver's 384x384 floor -- and the software seat takes it. format if format.is_hevc() => { diff --git a/crates/engine/tests/hevc_export.rs b/crates/engine/tests/hevc_export.rs index b2f3a4e..b1c2bec 100644 --- a/crates/engine/tests/hevc_export.rs +++ b/crates/engine/tests/hevc_export.rs @@ -4,12 +4,15 @@ //! (the inter modes code 1080p at 0.81 fps across 12 cores; the intra path does //! 4.30 fps on the same picture). //! -//! Two things are under test here and neither of them is the encoder's picture -//! quality: that the *containers* say HEVC in the words their readers expect -//! (this project's own demuxer, and ffprobe where it is installed), and that a -//! picture whose height is not a multiple of the 16-sample coding tree block -- -//! 1080, the resolution -- comes back out at its own size, coded padded to 1088 -//! and cropped by the SPS conformance window. +//! Three things are under test here: that the *containers* say HEVC in the +//! words their readers expect (this project's own demuxer, and ffprobe where it +//! is installed); that a picture whose height is not a multiple of the 64-sample +//! coding tree block -- 1080, the resolution -- comes back out at its own size, +//! coded padded to 1088 and cropped by the SPS conformance window; and, for the +//! hardware seat only, that what it codes is the *picture that went in* rather +//! than a stream that merely decodes. That last one is not a nicety: a seat +//! whose parameter sets disagree with its coded syntax hands back the right +//! number of frames and the wrong pixels, and nothing else here would see it. //! //! ```text //! cargo test -p engine --release --test hevc_export -- --test-threads=1 @@ -210,7 +213,7 @@ fn an_hevc_export_decodes_back_into_pictures_through_edith() { /// parameter sets have to declare. The two-frame fixtures above are flat and /// pass either way, which is exactly how the defect got through. #[test] -#[ignore = "needs libengine_hw.so, VE_HW_HEVC=1 and a driver with an HEVC encode entrypoint"] +#[ignore = "needs libengine_hw.so and a driver with an HEVC encode entrypoint"] fn a_1080p_hardware_export_leaves_a_decoder_with_nothing_to_say() { let Some(source) = fixture_1080p() else { eprintln!("no ffmpeg: skipping the 1080p hardware twin"); @@ -224,7 +227,7 @@ fn a_1080p_hardware_export_leaves_a_decoder_with_nothing_to_say() { let planned = engine::export::planned_video(session.meta(), &settings); assert!( planned.is_some_and(|seat| seat.contains("HW encode")), - "this twin is the GPU's, and this box named {planned:?} (VE_HW_HEVC=1?)" + "this twin is the GPU's, and this box named {planned:?}" ); let out = out_path("1080p_hw", "mkv");