cudacodec: fix black/white/uvWhite of BT2020/BT2020C#4076
Open
quink-black wants to merge 8 commits intoopencv:4.xfrom
Open
cudacodec: fix black/white/uvWhite of BT2020/BT2020C#4076quink-black wants to merge 8 commits intoopencv:4.xfrom
quink-black wants to merge 8 commits intoopencv:4.xfrom
Conversation
This patch addresses two critical issues in color conversion: - The previous implementation caused severe color shifts because uvWhite was handled as an 8-bit value while the luminance was processed as 10-bit P010. - Additionally, the code was hardcoded to Limited Range.
Contributor
|
cc @cudawarped |
Contributor
|
@quink-black Could you a simple test for the case? E.g. encode syntetic image as video, decode with the cudacodecs and check pixel colors? |
Move PARAM_TEST_CASE(YuvConverter) and CUDA_TEST_P(YuvConverter) and their INSTANTIATE to a dedicated HAVE_CUDA block, so YuvConverter tests run when CUDA is available even without NVCUVID/NVCUVENC. No functional changes.
Replace imread with a cv::randu-generated 64x128 BGR image to remove the dependency on external test data and make the test self-contained. No functional changes to the conversion logic.
…stImages For exception safety and clarity.
So that the Y row (i==0) uses the luma range (white-black)/max and the Cb/Cr rows (i!=0) use the chroma range (uvWhite-black)/max. Previously the column index was checked instead of the row index, which applied incorrect scaling when the luma and chroma ranges differ.
Author
Done. colorspace conversion doesn't need encoder/decoder. |
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.
This patch addresses two critical issues in color conversion:
The previous implementation caused severe color shifts because uvWhite was handled as an 8-bit value while the luminance was processed as 10-bit P010.
Additionally, the code was hardcoded to Limited Range.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.