Repository navigation
[LTX-2.5] Add ACEScct colour transforms and HLG/EXR export for the SDR-To-HDR IC-LoRA - #14966
christopher5106 wants to merge 1 commit into
Conversation
…-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>
eb74db4 to
57f0bad
Compare
|
Follow-up stacked on this PR: #14974 adds the LTX-2.5 SDR-To-HDR path to |
|
Hi @christopher5106, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Please note that PRs without a linked issue are likely to be automatically closed 10 days after this notice. Once the PR links an issue (or gets the |
|
Closing for now, as asked: I should have opened an issue first. The scope and structure are in #14981, and I'll reopen in whatever shape you prefer there. Thanks for the patience. |
What does this PR do?
Lightricks' LTX-2.5 SDR-To-HDR IC-LoRA works in ACEScct rather than LogC3. The SDR clip is mapped to ACEScct before VAE encoding, and the decoded ACEScct is expanded back to scene-linear ACEScg / Rec.709. Its reference export writes a BT.2020 HLG 10-bit HEVC master plus half-float EXR frames.
Today diffusers'
LTX2VideoHDRProcessoronly implements the LTX-2.3 LogC3 decode, with no input transform: sRGB white enters the VAE as +1.0 where the reference uses +0.1096. Andencode_hdr_tensor_to_mp4is an 8-bit SDR preview. This PR adds the colour and export building blocks only. There are no pipeline or model changes; those come in follow-ups (below).Added
pipelines/ltx2/image_processor.py, ported from Lightricks'ltx_core.hdr/ltx_core.color:srgb_gamma/srgb/acescg/acescct→ ACEScct, and ACEScct → ACEScg or Rec.709 linearLTX2VideoHDRProcessor(hdr_transform="acescct")withinput_colorspace/output_colorspace."logc3"stays the default and its code path is unchanged.encode_hdr_tensor_to_hlg_mp4:hvc1tag and full colour tagssave_exr_frame/export_to_exr_sequence: half-float, ZIP, RGB,chromaticities+colorSpaceheader, behind a new optionalis_openexr_available()guard.OpenEXRbinding (≥ 3.3) writes equivalent files (only OpenImageIO'scapDateattribute differs) at about a quarter of the wheel size.Faithfulness
Checked against the reference code itself (Lightricks/LTX-2
9ec55f9f):einsumTests
tests/pipelines/ltx2/test_ltx2_hdr_color.py, 40 tests:hvc1, colour tags, fps, frame count, and diffuse-white luma. Odd frame sizes are rejected. Skipped without libx265.make fix-copies,check_dummies,check_forward_call_docstrings, ruff and doc-builder style are clean.Follow-ups
LTX2HDRPipeline: the ACEScct input transform on the reference, a video-only context fed by the LoRA's precomputedvideo_context/audio_contextembeddings with no text encoder, fp32 VAE, distilled sigmas, and reflect-pad to /32 with crop-back.type_emb, joint keyframe-plane attention), coordinated with [LTX-2.5] Refactor LTX-2.5 Diffusion Decoder Forward Methods #14694.Before submitting
Who can review?
@DN6 @sayakpaul @yiyixuxu
🤖 Generated with Claude Code