Skip to content

Feature/12bit pixel format support#26

Open
roshan-ku wants to merge 10 commits into
OpenVisualCloud:mainfrom
roshan-ku:feature/12bit-pixel-format-support
Open

Feature/12bit pixel format support#26
roshan-ku wants to merge 10 commits into
OpenVisualCloud:mainfrom
roshan-ku:feature/12bit-pixel-format-support

Conversation

@roshan-ku
Copy link
Copy Markdown
Contributor

@roshan-ku roshan-ku commented Jun 1, 2026

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:

Format Chroma Color Space
yuv422p12le 4:2:2 YUV
yuv444p12le 4:4:4 YUV
gbrp12le 4:4:4 RGB

Checklist

Code Quality

  • Code follows project style guidelines
  • No unnecessary debug logs or commented-out code
  • No hardcoded values / secrets

Testing

  • Unit test added/modified accordingly
  • Perform manual basic sanity testing at system level

Review Readiness

  • PR title and description are clear and meaningful
  • Story/Task IDs are linked

Documentation

  • README or relevant docs updated (if applicable)

Security

  • No sensitive data exposed (keys, passwords, tokens)
  • Input validation added where needed

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes
  • Testing
  • Other... Please describe:

roshan-ku added 5 commits May 19, 2026 14:30
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
Comment thread src/mtl/mtl_tx.c Outdated
Comment thread src/util/config_reader.c Outdated
Comment thread src/util/config_reader.c Outdated
Comment thread src/util/config_reader.c Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
roshan-ku added 2 commits June 2, 2026 11:13
- 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
@roshan-ku roshan-ku requested a review from dmkarthi June 2, 2026 06:00
@roshan-ku roshan-ku marked this pull request as ready for review June 2, 2026 06:47
@dmkarthi dmkarthi requested a review from Copilot June 3, 2026 05:41
Copy link
Copy Markdown

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

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→AVPixelFormat mapping to accept yuv422p12le, yuv444p12le, and gbrp12le.
  • Extend MTL TX format mapping (AVPixelFormatst_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() allows video.fmt to be omitted (empty string), but load_and_apply_config() unconditionally strcmp()s config.fmt and errors out when it’s empty. This makes a config that omits fmt pass validation but fail to load. Consider treating empty fmt as the documented default (yuv422p10le) when applying the config (or make fmt required 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 cover get_transport_format(). Adding a simple test for the new get_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.

Comment thread tests/test_mtl_tx.c
Comment thread README.md
roshan-ku added 2 commits June 3, 2026 11:19
- 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.
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.

3 participants