Skip to content

Hdr improvements#6

Merged
hgaiser merged 5 commits intomainfrom
hdr-improvements
Mar 29, 2026
Merged

Hdr improvements#6
hgaiser merged 5 commits intomainfrom
hdr-improvements

Conversation

@hgaiser
Copy link
Copy Markdown
Owner

@hgaiser hgaiser commented Mar 29, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves HDR-related handling across the encoder and color converter by enabling runtime updates to stream color signaling (VUI/sequence header) and extending the converter’s HDR pipeline controls.

Changes:

  • Add Encoder::set_color_description() and codec-specific implementations that recreate Vulkan video session parameters with updated VUI/sequence header signaling.
  • Adjust encode fence lifecycle (create signaled; reset before submit) to support safe waiting when updating session parameters.
  • Extend the color converter with configurable SDR reference white (nits) for sRGB→BT.2020+PQ and switch YUV444 output to a 2-plane format to match expected layouts.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/encoder/resources.rs Create encode fence as signaled and reset fences before encode submission.
src/encoder/mod.rs Add public Encoder::set_color_description() API.
src/encoder/h265/mod.rs Cache H.265 profile_idc for session-parameter recreation.
src/encoder/h265/init.rs Persist profile_idc into the encoder struct during init.
src/encoder/h265/api.rs Implement H.265 set_color_description() by recreating VPS/SPS/PPS + session params.
src/encoder/h264/mod.rs Cache H.264 profile_idc and preferred entropy mode for recreation.
src/encoder/h264/init.rs Persist cached profile/entropy settings into the encoder struct.
src/encoder/h264/api.rs Implement H.264 set_color_description() by recreating SPS/PPS + session params.
src/encoder/av1/api.rs Implement AV1 set_color_description() by recreating the sequence header + session params.
src/converter/shader.rs Add sdr_white_nits push constant and use it in PQ normalization.
src/converter/pipeline.rs Increase push constant range size to account for the added parameter.
src/converter/mod.rs Add converter config for SDR reference white, add set_full_range, and update YUV444 to 2-plane format + copy regions + push constants.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hgaiser hgaiser force-pushed the hdr-improvements branch 2 times, most recently from 2873448 to 9163a7f Compare March 29, 2026 11:29
@hgaiser hgaiser requested a review from Copilot March 29, 2026 11:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Create the encode fence with SIGNALED_BIT so that set_color_description()
can safely wait on it before the first encode. Move reset_fences to just
before queue_submit so the fence remains signaled after wait_for_fences,
allowing subsequent set_color_description() calls to wait without deadlock.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

hgaiser added 4 commits March 29, 2026 14:27
The encoder expects G8_B8R8_2PLANE_444_UNORM (Y + interleaved UV) but the
converter was using G8_B8_R8_3PLANE_444_UNORM (separate Y, U, V planes).
Update the Vulkan format, buffer copy regions, and shader output to write
UV interleaved into a single plane.
Allows changing the color primaries, transfer characteristics, and matrix
coefficients at runtime. The encoder waits for in-flight work, rebuilds
session parameters with updated SPS/VPS/sequence header, and forces the
next frame to be an IDR. Implemented for H.264, H.265, and AV1.
Add sdr_reference_white_nits to ColorConverterConfig (default 203 nits per
ITU-R BT.2408). The value is passed to the compute shader via push constants,
replacing the previously hardcoded 203.0 nit reference.
@hgaiser hgaiser merged commit 8d39b58 into main Mar 29, 2026
6 checks passed
@hgaiser hgaiser deleted the hdr-improvements branch March 29, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants