Feature/12bit pixel format support#26
Open
roshan-ku wants to merge 10 commits into
Open
Conversation
Add support for 12-bit pixel depth variants: - yuv422p12le (ST_FRAME_FMT_YUV422PLANAR12LE / ST20_FMT_YUV_422_12BIT) - yuv420p12le (ST20_FMT_YUV_420_12BIT transport format) - yuv444p12le (ST_FRAME_FMT_YUV444PLANAR12LE / ST20_FMT_YUV_444_12BIT) - gbrp12le (ST_FRAME_FMT_GBRPLANAR12LE / ST20_FMT_RGB_12BIT) Updated: - config_reader: validation whitelist and AVPixelFormat mapping - mtl_tx: get_input_format() and get_transport_format() switch cases - tests: config_reader and mtl_tx test coverage for new formats
config/tx_1session_12bit.json: 1920x1080 30fps yuv444p12le config using test_12bit_yuv444p12le.mkv as source video.
The upstream FFmpeg mtl_st20p TX muxer only supports YUV422P10LE, Y210LE, and RGB24. This patch adds support for all formats used by dvledtx: - YUV420P (8-bit 4:2:0) - YUV444P10LE, GBRP10LE (10-bit 4:4:4 / RGB) - YUV422P12LE, YUV420P12LE, YUV444P12LE, GBRP12LE (12-bit) On a new setup, apply with: ./scripts/apply-ffmpeg-12bit-patch.sh [FFMPEG_SRC_DIR] Then rebuild FFmpeg: make -j$(nproc) && sudo make install && sudo ldconfig
- Add 12-bit formats to Supported Formats table - Update config fmt field to reference the formats section - Add 'FFmpeg MTL Plugin Patch' section with apply instructions
dmkarthi
reviewed
Jun 2, 2026
- Remove yuv420p12le from transport format mapping, config validation, and format assignment - Remove associated unit test for yuv420p12le - Remove 'FFmpeg MTL Plugin Patch' section from README (no patches provided) - Update supported formats documentation
There was a problem hiding this comment.
Pull request overview
Adds 12-bit pixel format support end-to-end (config validation/parsing, MTL mapping, docs, and unit tests) so dvledtx can transmit higher bit-depth video over ST 2110-20 via MTL.
Changes:
- Extend config reader validation and string→
AVPixelFormatmapping to acceptyuv422p12le,yuv444p12le, andgbrp12le. - Extend MTL TX format mapping (
AVPixelFormat→st_frame_fmt/st20_fmt) for 12-bit planar formats. - Update unit tests and README supported-format documentation accordingly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_mtl_tx.c |
Adds unit tests for new 12-bit transport-format mappings (and should also cover input-format mappings). |
tests/test_config_reader.c |
Extends supported-format validation test coverage to include the new 12-bit format strings. |
src/util/config_reader.c |
Adds new 12-bit formats to validation and applies them into app->fmt during config load. |
src/mtl/mtl_tx.c |
Adds 12-bit mappings for MTL input/transport formats. |
README.md |
Reworks supported formats into a table and adds 12-bit format entries. |
Comments suppressed due to low confidence (2)
src/util/config_reader.c:604
validate_tx_config()allowsvideo.fmtto be omitted (empty string), butload_and_apply_config()unconditionallystrcmp()sconfig.fmtand errors out when it’s empty. This makes a config that omitsfmtpass validation but fail to load. Consider treating emptyfmtas the documented default (yuv422p10le) when applying the config (or makefmtrequired in validation).
if (strcmp(config.fmt, "yuv422p10le") == 0) app->fmt = AV_PIX_FMT_YUV422P10LE;
else if (strcmp(config.fmt, "yuv420") == 0) app->fmt = AV_PIX_FMT_YUV420P;
else if (strcmp(config.fmt, "yuv444p10le") == 0) app->fmt = AV_PIX_FMT_YUV444P10LE;
else if (strcmp(config.fmt, "gbrp10le") == 0) app->fmt = AV_PIX_FMT_GBRP10LE;
else if (strcmp(config.fmt, "yuv422p12le") == 0) app->fmt = AV_PIX_FMT_YUV422P12LE;
else if (strcmp(config.fmt, "yuv444p12le") == 0) app->fmt = AV_PIX_FMT_YUV444P12LE;
else if (strcmp(config.fmt, "gbrp12le") == 0) app->fmt = AV_PIX_FMT_GBRP12LE;
else {
LOG_ERROR("Unsupported pixel format '%s'", config.fmt);
return -1;
}
tests/test_mtl_tx.c:100
- New 12-bit support updates
get_input_format()as well, but the unit tests added here only coverget_transport_format(). Adding a simple test for the newget_input_format()mappings would prevent regressions (and makes test header comments about covered formats accurate).
static void test_get_transport_format_gbrp12le(void **state)
{
(void)state;
assert_int_equal(get_transport_format(AV_PIX_FMT_GBRP12LE),
ST20_FMT_RGB_12BIT);
}
static void test_get_transport_format_unknown_returns_error(void **state)
{
(void)state;
/* AV_PIX_FMT_NONE hits the default branch → error (-1) */
assert_int_equal((int)get_transport_format(AV_PIX_FMT_NONE), -1);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Make 'frame' pointer const in st20p_tx_thread (session_manager.c) - Update ffmpeg_tx_send_yuv_frame to accept const AVFrame* src - Make 'app' pointer const in open_shared_ffmpeg (ffmpeg_decoder.c) - Update test mock signature to match
Register test_get_input_format_yuv422p12le, test_get_input_format_yuv444p12le, and test_get_input_format_gbrp12le in the test runner to ensure coverage of the 12-bit input format mapping paths. Addresses Copilot review comment on PR OpenVisualCloud#26.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds support for 12-bit pixel formats in the dvledtx transmitter, enabling higher bit-depth video transmission over ST 2110-20 via MTL.
Supported 12-bit Formats:
Checklist
Code Quality
Testing
Review Readiness
Documentation
Security
PR Type
What kind of change does this PR introduce?