feat(encoder): Added support for mastering display color volume and c…#168
feat(encoder): Added support for mastering display color volume and c…#168
Conversation
…ontent light level metadata Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
|
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 <d.kozinski@samsung.com>
|
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 <d.kozinski@samsung.com>
- 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 <d.kozinski@samsung.com>
@kpchoi |
I think your patch is not the usual way of video codec area even though the results are similar. |
Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com>
Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com>
Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com>
|
@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: kp5.choi@samsung.com <kp5.choi@samsung.com>
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.
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.
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.
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.
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.
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.
(2^32) to (1ULL << 32)
There was a problem hiding this comment.
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.
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.
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.
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.
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: kp5.choi@samsung.com <kp5.choi@samsung.com>
|
@dkozinski |
dkozinski
left a comment
There was a problem hiding this comment.
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.
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 <d.kozinski@samsung.com>
…ontent light level metadata