export: HDR encoder scaffolding — 10-bit HEVC + BT.2020/PQ/HLG tags (Stage B pt 1)
Settings + encoder side of HDR video export (frame data still SDR until pt 2):
- core: HdrExportMode {Sdr (default), Pq, Hlg} on VideoExportSettings (serde
default), with transfer-name helpers.
- setup_video_encoder takes the mode: HDR → YUV420P10LE, BT.2020 NCL matrix,
limited range, color_primaries=bt2020, color_trc=smpte2084/arib-std-b67,
profile=main10. SDR path unchanged (8-bit full-range BT.709).
- run_video_encoder forces HEVC when HDR is selected (the only 10-bit codec wired
up). encode_frame is parameterized by pixel format and now copies planes
row-by-row honoring stride (10-bit / non-aligned widths can have row padding).
Dormant: no UI exposes the mode yet and the frame data is still 8-bit SDR, so
selecting HDR is not yet wired. The render→PQ/HLG 10-bit frame path is pt 2.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
28b14b2ad0
commit
41e4f3b12b
@@ -288,6 +288,38 @@ impl ColorRange {
|
||||
}
|
||||
}
|
||||
|
||||
/// HDR output mode for video export. SDR encodes BT.709 8-bit as before; the HDR modes encode
|
||||
/// 10-bit BT.2020 with the PQ (HDR10) or HLG transfer, preserving super-white highlights from the
|
||||
/// linear compositor. HDR requires a 10-bit codec (HEVC Main10) — the exporter forces H.265.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
|
||||
pub enum HdrExportMode {
|
||||
#[default]
|
||||
Sdr,
|
||||
/// PQ (SMPTE ST 2084) — HDR10. Graphics white at 203 nits (matches the compositor convention).
|
||||
Pq,
|
||||
/// HLG (ARIB STD-B67) — broadcast HDR, also displayable as SDR.
|
||||
Hlg,
|
||||
}
|
||||
|
||||
impl HdrExportMode {
|
||||
pub fn is_hdr(&self) -> bool { !matches!(self, HdrExportMode::Sdr) }
|
||||
pub fn name(&self) -> &'static str {
|
||||
match self {
|
||||
HdrExportMode::Sdr => "SDR (BT.709, 8-bit)",
|
||||
HdrExportMode::Pq => "HDR10 / PQ (BT.2020, 10-bit)",
|
||||
HdrExportMode::Hlg => "HLG (BT.2020, 10-bit)",
|
||||
}
|
||||
}
|
||||
/// FFmpeg transfer-characteristic name for the color tags.
|
||||
pub fn transfer_name(&self) -> &'static str {
|
||||
match self {
|
||||
HdrExportMode::Sdr => "bt709",
|
||||
HdrExportMode::Pq => "smpte2084",
|
||||
HdrExportMode::Hlg => "arib-std-b67",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Video quality presets
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum VideoQuality {
|
||||
@@ -349,6 +381,10 @@ pub struct VideoExportSettings {
|
||||
#[serde(default)]
|
||||
pub color_range: ColorRange,
|
||||
|
||||
/// HDR output mode. HDR forces 10-bit HEVC (BT.2020 + PQ/HLG); SDR is the default.
|
||||
#[serde(default)]
|
||||
pub hdr: HdrExportMode,
|
||||
|
||||
/// Audio settings (None = no audio)
|
||||
pub audio: Option<AudioExportSettings>,
|
||||
|
||||
@@ -368,6 +404,7 @@ impl Default for VideoExportSettings {
|
||||
framerate: 60.0,
|
||||
quality: VideoQuality::High,
|
||||
color_range: ColorRange::Limited,
|
||||
hdr: HdrExportMode::Sdr,
|
||||
audio: Some(AudioExportSettings::high_quality_aac()),
|
||||
start_time: 0.0,
|
||||
end_time: 60.0,
|
||||
|
||||
Reference in New Issue
Block a user