1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Pure byte-math helpers for the AMD AMF session: [`VideoEncoderConfig`] → `EncoderConfig`
//! field conversions. No `shiguredo_amf` types here so these stay testable independent of
//! any real AMF library / AMD driver being present — see
//! [ADR-0002](../../adr/amf/0002-amf-linux-shiguredo-amf-h264-cpu-upload.md).
use crateEncodeError;
use ;
/// Whether this backend's video encode path accepts `codec` (H.264 / HEVC / AV1 — see
/// [ADR-0003](../../adr/amf/0003-amf-linux-hevc-av1-codec-dispatch.md)). VP9 stays
/// unsupported: `shiguredo_amf`'s own `CodecConfig` has no VP9 variant to dispatch to (ADR-0003
/// § Context), not a Mediaway-side restriction.
pub const
/// `EncoderConfig::framerate_num`/`framerate_den` from a seconds-per-tick [`Rational`]
/// timebase — framerate is the reciprocal of a seconds-per-tick timebase, so
/// `framerate_num = time_base.den`, `framerate_den = time_base.num` (ADR-0002 § Research).
/// [`Rational::den`] is already `u32`, used directly; [`Rational::num`] is `u64` and
/// saturates to `u32::MAX` on overflow (timebases in practice fit comfortably in `u32` —
/// this only guards the type conversion).
pub
/// Bits-per-second → `EncoderConfig::target_kbps`/`ReconfigureParams::target_kbps` (`bps /
/// 1000`), `0` bps mapping to `0` kbps (caller decides whether that means "unset").
pub const
/// VBV buffer size in bytes → an approximate `max_kbps` ceiling (`bytes * 8 / 1000`,
/// i.e. treat the byte count as a peak burst size measured in kilobits) — the same
/// bytes-to-bits convention this crate's D3D12/Vulkan backends already use for
/// `RateControlConfig::vbv_buffer_size_bytes` (see `windows/d3d12_video_encode/setup.rs`'s
/// `cbr_from_config`), not a driver-specific AMF unit. `shiguredo_amf` gives no documented
/// alternative conversion for this field — ADR-0002 flags this as a "TBD in the
/// implementation PR" candidate; this is that implementation's chosen, honest
/// approximation, not a confirmed AMF semantic.
pub
/// Tightly-packed NV12 byte size for `width x height` (`width * height * 3 / 2`).
pub