Skip to content

[LTX-2.5] SDR-To-HDR in LTX2HDRPipeline (fix branch, not to be merged) - #7

Open
christopher5106 wants to merge 2 commits into
mainfrom
fix_ltx2_hdr_sdr_to_hdr
Open

christopher5106 wants to merge 2 commits into
mainfrom
fix_ltx2_hdr_sdr_to_hdr

Conversation

@christopher5106

Copy link
Copy Markdown

Tracking PR for fix_ltx2_hdr_sdr_to_hdr, opened against main (the upstream mirror). It is never merged here.

Upstream PR: huggingface#14974, stacked on huggingface#14966 (tracked in #5).

Adds the LTX-2.5 SDR-To-HDR IC-LoRA path to LTX2HDRPipeline (hdr_transform="acescct"): ACEScct input, reflect pad and crop, fp32 VAE, video-only video_context conditioning, audio isolation, distilled schedule, RoPE fps cap, optional diffusion_decoder. Matches Lightricks' reference on real weights: final latent 50 dB, output 38.4 dB. Tests: tests/pipelines/ltx2/test_ltx2_hdr_sdr_to_hdr.py (30).

When upstream merges it: delete this branch, close this PR, sync main, and rebase scenario to drop the cherry-pick.

christopher5106 and others added 2 commits October 6, 2026 17:44
…-HDR

Port the colour pipeline of the LTX-2.5 SDR-To-HDR IC-LoRA from the Lightricks
LTX-2 reference (ltx_core.hdr, ltx_core.color, ltx_pipelines media_io):

- image_processor: sRGB EOTF, Bradford Rec.709/AP1/Rec.2020 matrices, ACEScct
  encode/decode, the srgb_gamma/srgb/acescg/acescct input transforms and the
  ACEScct -> ACEScg/Rec.709 linear output transform, as pure torch functions.
  LTX2VideoHDRProcessor gains hdr_transform="acescct" with input_colorspace /
  output_colorspace options; the LogC3 default is unchanged.
- export_utils: encode_hdr_tensor_to_hlg_mp4 (BT.2020 HLG 10-bit HEVC via
  PyAV/libx265) and save_exr_frame / export_to_exr_sequence (half-float ZIP
  EXR with chromaticities and colorSpace), behind a new optional
  is_openexr_available() guard.
- tests: exact values computed with colour-science, round trips, HLG stream
  properties and EXR read-back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Run the Lightricks LTX-2.5 SDR-To-HDR IC-LoRA (ltx_pipelines.hdr_ic_lora.HDRICLoraPipeline,
without its optional seam keyframes) when the pipeline is built with hdr_transform="acescct":

- the reference video goes through the ACEScct input transform (new `input_colorspace`, default
  "srgb_gamma"), is reflect-padded up to a multiple of the VAE spatial compression ratio and
  VAE-encoded in float32; the decoded video is cropped back to height x width;
- conditioning comes from precomputed `connector_video_embeds` only (a 2D `video_context` is
  accepted): no prompt, no text encoder call, `connector_audio_embeds` optional;
- video-only denoising: `isolate_modalities=True` with a single placeholder audio token, so the
  audio stream cannot reach the video;
- the distilled schedule used verbatim (DISTILLED_SIGMA_VALUES, no mu shift), no CFG/STG/modality
  guidance, RoPE frame rate capped at 30 fps, first target latent frame marked for the keyframe
  position embedding;
- decoding in float32 with the optional `diffusion_decoder` component (LTX-2.5) or the VAE, then
  `postprocess_hdr_video(output_colorspace=...)` (new argument, default "rec709").

`hdr_transform` is now registered in the pipeline config so it survives save/load. The LogC3
(LTX-2.3) path is unchanged: its outputs are bit-identical to the parent commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant