Conversation
There was a problem hiding this comment.
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.
2873448 to
9163a7f
Compare
There was a problem hiding this comment.
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.
9163a7f to
a641b52
Compare
There was a problem hiding this comment.
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.
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.
a641b52 to
feb5825
Compare
No description provided.