Skip to content

expose GenerateConfig via JSON C API#394

Merged
quietvoid merged 1 commit into
quietvoid:mainfrom
pannal:generate-p81-rpu
Apr 12, 2026
Merged

expose GenerateConfig via JSON C API#394
quietvoid merged 1 commit into
quietvoid:mainfrom
pannal:generate-p81-rpu

Conversation

@pannal
Copy link
Copy Markdown
Contributor

@pannal pannal commented Apr 11, 2026

Per discussion: single function that takes a JSON string, deserializes to GenerateConfig, generates RPUs, returns RpuOpaqueList. Same return type as dovi_parse_rpu_bin_file.

const char* json = "{\"profile\": \"8.1\", \"cm_version\": \"V40\", ...}";
const DoviRpuOpaqueList* list = dovi_generate_from_json(json);

Gated on capi + serde features. serde_json dependency was already there.

Our use case (HDR10+ to P8.1, RPU writer code from cpm/avdvplus): build the JSON config per frame with L1 values from HDR10+ conversion, generate one RPU, write it. Replaces ~280 lines of hand-written RPU bitstream in C++.

@pannal pannal force-pushed the generate-p81-rpu branch from 752303c to dd0d6f2 Compare April 11, 2026 13:27
Comment thread dolby_vision/src/capi.rs Outdated
Comment thread dolby_vision/src/rpu/dovi_rpu.rs Outdated
@pannal pannal force-pushed the generate-p81-rpu branch from dd0d6f2 to 5852a8d Compare April 11, 2026 15:00
@pannal pannal changed the title add dovi_generate_p81_rpu for HDR10+ to DV P8.1 conversion expose GenerateConfig via C API for RPU generation Apr 11, 2026
Comment thread dolby_vision/src/capi.rs Outdated
Takes a JSON-serialized GenerateConfig, deserializes it, generates
RPUs via generate_rpu_list, and returns an RpuOpaqueList.

Gated on capi + serde features. Follows the same pattern as
dovi_parse_rpu_bin_file for the return type.
@pannal pannal force-pushed the generate-p81-rpu branch from 5852a8d to 21b8b63 Compare April 12, 2026 01:35
@pannal pannal changed the title expose GenerateConfig via C API for RPU generation expose GenerateConfig via JSON C API Apr 12, 2026
@quietvoid
Copy link
Copy Markdown
Owner

Looks good to me, might do some refactor after.

Our use case (HDR10+ to P8.1, RPU writer code from cpm/avdvplus): build the JSON config per frame with L1 values from HDR10+ conversion, generate one RPU, write it.

FYI there will most likely be a C API function for creating a single RPU from a HDR10+ SEI payload.

This new generate function isn't ideal for a single RPU.

@quietvoid quietvoid merged commit 21b8b63 into quietvoid:main Apr 12, 2026
1 check passed
@quietvoid
Copy link
Copy Markdown
Owner

I think I'll have to force all the features for C API building by default so that packaging is easier.
It doesn't increase the file size that much.

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