-
Notifications
You must be signed in to change notification settings - Fork 27
feat(encoder): Added support for mastering display color volume and c… #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ontent light level metadata Signed-off-by: Dawid Kozinski <[email protected]>
|
I guess you're trying to support HDR information, which is a part of metadata not encoding part. You need to create metadata related MDCV and CLL, after that you can add it to frame data. |
|
Yes, I am indeed trying to support HDR information (There is a request from library users to add the ability to pass metadata to the APV stream: GitHub Issue #167). The liboapv library includes an API for adding metadata, and the header file oapv.h provides an interface for the metadata container. I used the function
This function requires passing the metadata type (type definitions are in the public header oapv.h, in our case The file oapv_metadata.h already contains definitions for the appropriate structures for MDCV and CLL: However, oapv_metadata.h is not a public header, and these types are not accessible to library users. In PR#168, I added the appropriate fields (those from the structures oapv_md_mdcv and oapv_md_cll defined in oapv_metadata.h) to the oapv_param structure. What can we do?
What's your thoughts? |
|
I am thinking that the metadata embedding doesn't need to have xxx_parse() function. |
- Responsibility for HDR metadata preparation moved from the library to the application side - Used the liboapv metadata container API to pass the prepared metadata to the library Signed-off-by: Dawid Kozinski <[email protected]>
|
Still, the encoder of OpenAPV needs to support commandline argument for setting max-cll and mdcv? |
|
Currently there are no changes in the encoder implementation regarding support for HDR-related metadata; it does not include handling for master-display and max-cll parameters via the command line. PR #168 only adds support for the master-display and max-cll parameters to the reference application (request from library users to add the ability to pass metadata to the APV stream: GitHub issue #167). This is solely a change in the reference application to support HDR, not in the encoder. The user can pass mastering display color volume metadata and content light level information metadata to the reference application. Then the reference application passes this data to the metadata container using the public liboapv API (oapvm_set_all()). |
|
@dkozinski |
Signed-off-by: Dawid Kozinski <[email protected]>
- Detected platform endianness (Big/Little Endian) in CMake configuration - Added conditional compilation for endianness-specific byte order conversion in oapv_app_enc.c - Introduced helper macros (bswap16, bswap32, bswap64) and endian conversion functions (be2ne, le2ne, ne2be, ne2le) in oapv_app_util.h - Updated metadata serialization functions to use new byte order conversion utilities for consistent cross-platform behavior Signed-off-by: Dawid Kozinski <[email protected]>
@kpchoi |
I think your patch is not the usual way of video codec area even though the results are similar. |
Signed-off-by: [email protected] <[email protected]>
Signed-off-by: [email protected] <[email protected]>
|
@dkozinski Please check the latest commits from me. |
|
@kpchoi I’ll check your latest changes and run the tests as soon as possible this morning |
Signed-off-by: [email protected] <[email protected]>
src/oapv_metadata.c
Outdated
| } | ||
| for(i = 0; i < 3; i++) { | ||
| t = mdcv->primary_chromaticity_y[i]; | ||
| oapv_assert_rv(t >=0 && t < (2^16), OAPV_ERR_INVALID_ARGUMENT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(2^16) =>(1<<16)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mistake, It is changed to 0xFFFF
src/oapv_metadata.c
Outdated
| oapv_bsw_write(&bs, t, 16); | ||
| } | ||
| t = mdcv->white_point_chromaticity_x; | ||
| oapv_assert_rv(t >=0 && t < (2^16), OAPV_ERR_INVALID_ARGUMENT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(2^16) =>(1<<16)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mistake, It is changed to 0xFFFF
src/oapv_metadata.c
Outdated
| oapv_bsw_write(&bs, t, 16); | ||
|
|
||
| t = mdcv->white_point_chromaticity_y; | ||
| oapv_assert_rv(t >=0 && t < (2^16), OAPV_ERR_INVALID_ARGUMENT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(2^16) =>(1<<16)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mistake, It is changed to 0xFFFF
src/oapv_metadata.c
Outdated
| oapv_assert_rv(t >=0 && t < (2^16), OAPV_ERR_INVALID_ARGUMENT); | ||
| oapv_bsw_write(&bs, t, 16); | ||
|
|
||
| oapv_assert_rv(mdcv->max_mastering_luminance < (2^32), OAPV_ERR_INVALID_ARGUMENT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The result of 2^32 using the bitwise XOR operator (^) in C is 2 XOR 32 = 34, not the intended exponentiation result of 4,294,967,296
Please change (2^32) to (1ULL << 32)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mistake, It is changed to 0xFFFFFFFF
src/oapv_metadata.c
Outdated
| tu32 = mdcv->max_mastering_luminance; | ||
| oapv_bsw_write(&bs, tu32, 32); | ||
|
|
||
| oapv_assert_rv(mdcv->min_mastering_luminance < (2^32), OAPV_ERR_INVALID_ARGUMENT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(2^32) to (1ULL << 32)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mistake, It is changed to 0xFFFFFFFF
src/oapv_metadata.c
Outdated
| oapv_bsw_init(&bs, data, 4, NULL); // CLL payload has 4 bytes | ||
|
|
||
| t = cll->max_cll; | ||
| oapv_assert_rv(t >=0 && t < (2^16), OAPV_ERR_INVALID_ARGUMENT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(2^16) =>(1<<16)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mistake, It is changed to 0xFFFF
src/oapv_metadata.c
Outdated
| oapv_bsw_write(&bs, t, 16); | ||
|
|
||
| t = cll->max_fall; | ||
| oapv_assert_rv(t >=0 && t < (2^16), OAPV_ERR_INVALID_ARGUMENT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(2^16) =>(1<<16)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mistake, It is changed to 0xFFFF
app/oapv_app_enc.c
Outdated
|
|
||
| static int update_metadata(args_var_t *vars, oapvm_t mid) | ||
| { | ||
| int ret, size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ret is not initialized at the start of the function, so if everything succeeds, the function returns an undefined value. Please initialize ret to a default value (0 for success).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ret is still not initialized causes the function to return an invalid value on success.
static int update_metadata(args_var_t *vars, oapvm_t mid)
{
int ret = 0, size;
Signed-off-by: [email protected] <[email protected]>
Signed-off-by: [email protected] <[email protected]>
|
@dkozinski |
dkozinski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some changes are still needed
app/oapv_app_enc.c
Outdated
|
|
||
| static int update_metadata(args_var_t *vars, oapvm_t mid) | ||
| { | ||
| int ret, size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ret is still not initialized causes the function to return an invalid value on success.
static int update_metadata(args_var_t *vars, oapvm_t mid)
{
int ret = 0, size;
|
@dkozinski plesae test the current code again. |
- Swapped the order of primary chromaticity coordinates in 'parse_master_display' function to ensure correct assignment - Refactor writing primary chromaticity x and y coordinates in 'oapvm_write_mdcv' function to ensure correct order Signed-off-by: Dawid Kozinski <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commit 9108e20 Looks good
…ontent light level metadata