The GPU takes the HEVC export again
Browse files at this commite6624f3f9c5d9ad482104c39c008b5e80595db93Parent: 85641e4- feat
- the GPU takes the HEVC export again
2 changed files +19 -15
crates/engine/src/export.rsmodified+8 -7
| @@ -496,13 +496,14 @@ fn hw_seat(meta: &VideoMeta, settings: &ExportSettings) -> Option<HwEncoder> { | |||
| 496 | let (fps_num, fps_den) = crate::mux::frame_timing(meta.frame_rate).ok()?; | 496 | let (fps_num, fps_den) = crate::mux::frame_timing(meta.frame_rate).ok()?; |
| 497 | let bitrate = bitrate_of(meta, settings); | 497 | let bitrate = bitrate_of(meta, settings); |
| 498 | match settings.format { | 498 | match settings.format { |
| 499 | - // Both HEVC formats sit on the plugin's HEVC seat, and it is opt-in | 499 | + // Both HEVC formats sit on the plugin's HEVC seat, and it is the |
| 500 | - // while its pixels are under repair: on real 1080p and 4K material the | 500 | + // default again: what it codes is intra-only, the very file the |
| 501 | - // GPU's file decodes frame-for-frame and *looks* wrong -- a garbled | 501 | + // software seat writes, so preferring the GPU changes how long an |
| 502 | - // band over flat green, one `CABAC_MAX_BIN` notice per frame. Until | 502 | + // export takes and not what comes out of it. What made that untrue for |
| 503 | - // that is found and proven gone, the software intra encoder takes the | 503 | + // one day was the vendored encoder's parameter sets promising coding |
| 504 | - // file and `VE_HW_HEVC=1` is what asks for the GPU. | 504 | + // tools the driver was not using; the pictures are now measured against |
| 505 | - format if format.is_hevc() && !forced("VE_HW_HEVC") => None, | 505 | + // their sources rather than counted |
| 506 | + // (`hevc_export::a_1080p_hardware_export_leaves_a_decoder_with_nothing_to_say`). | ||
| 506 | // `None` here is the plugin's own "no" -- no entrypoint, or a picture | 507 | // `None` here is the plugin's own "no" -- no entrypoint, or a picture |
| 507 | // under the driver's 384x384 floor -- and the software seat takes it. | 508 | // under the driver's 384x384 floor -- and the software seat takes it. |
| 508 | format if format.is_hevc() => { | 509 | format if format.is_hevc() => { |
crates/engine/tests/hevc_export.rsmodified+11 -8
| @@ -4,12 +4,15 @@ | |||
| 4 | //! (the inter modes code 1080p at 0.81 fps across 12 cores; the intra path does | 4 | //! (the inter modes code 1080p at 0.81 fps across 12 cores; the intra path does |
| 5 | //! 4.30 fps on the same picture). | 5 | //! 4.30 fps on the same picture). |
| 6 | //! | 6 | //! |
| 7 | -//! Two things are under test here and neither of them is the encoder's picture | 7 | +//! Three things are under test here: that the *containers* say HEVC in the |
| 8 | -//! quality: that the *containers* say HEVC in the words their readers expect | 8 | +//! words their readers expect (this project's own demuxer, and ffprobe where it |
| 9 | -//! (this project's own demuxer, and ffprobe where it is installed), and that a | 9 | +//! is installed); that a picture whose height is not a multiple of the 64-sample |
| 10 | -//! picture whose height is not a multiple of the 16-sample coding tree block -- | 10 | +//! coding tree block -- 1080, the resolution -- comes back out at its own size, |
| 11 | -//! 1080, the resolution -- comes back out at its own size, coded padded to 1088 | 11 | +//! coded padded to 1088 and cropped by the SPS conformance window; and, for the |
| 12 | -//! and cropped by the SPS conformance window. | 12 | +//! hardware seat only, that what it codes is the *picture that went in* rather |
| 13 | +//! than a stream that merely decodes. That last one is not a nicety: a seat | ||
| 14 | +//! whose parameter sets disagree with its coded syntax hands back the right | ||
| 15 | +//! number of frames and the wrong pixels, and nothing else here would see it. | ||
| 13 | //! | 16 | //! |
| 14 | //! ```text | 17 | //! ```text |
| 15 | //! cargo test -p engine --release --test hevc_export -- --test-threads=1 | 18 | //! 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() { | |||
| 210 | /// parameter sets have to declare. The two-frame fixtures above are flat and | 213 | /// parameter sets have to declare. The two-frame fixtures above are flat and |
| 211 | /// pass either way, which is exactly how the defect got through. | 214 | /// pass either way, which is exactly how the defect got through. |
| 212 | #[test] | 215 | #[test] |
| 213 | -#[ignore = "needs libengine_hw.so, VE_HW_HEVC=1 and a driver with an HEVC encode entrypoint"] | 216 | +#[ignore = "needs libengine_hw.so and a driver with an HEVC encode entrypoint"] |
| 214 | fn a_1080p_hardware_export_leaves_a_decoder_with_nothing_to_say() { | 217 | fn a_1080p_hardware_export_leaves_a_decoder_with_nothing_to_say() { |
| 215 | let Some(source) = fixture_1080p() else { | 218 | let Some(source) = fixture_1080p() else { |
| 216 | eprintln!("no ffmpeg: skipping the 1080p hardware twin"); | 219 | eprintln!("no ffmpeg: skipping the 1080p hardware twin"); |
| @@ -224,7 +227,7 @@ fn a_1080p_hardware_export_leaves_a_decoder_with_nothing_to_say() { | |||
| 224 | let planned = engine::export::planned_video(session.meta(), &settings); | 227 | let planned = engine::export::planned_video(session.meta(), &settings); |
| 225 | assert!( | 228 | assert!( |
| 226 | planned.is_some_and(|seat| seat.contains("HW encode")), | 229 | planned.is_some_and(|seat| seat.contains("HW encode")), |
| 227 | - "this twin is the GPU's, and this box named {planned:?} (VE_HW_HEVC=1?)" | 230 | + "this twin is the GPU's, and this box named {planned:?}" |
| 228 | ); | 231 | ); |
| 229 | 232 | ||
| 230 | let out = out_path("1080p_hw", "mkv"); | 233 | let out = out_path("1080p_hw", "mkv"); |