Skip to content
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

Underflow in YUV to RGB conversion #8

Open
Memotech-Bill opened this issue Jun 16, 2023 · 0 comments
Open

Underflow in YUV to RGB conversion #8

Memotech-Bill opened this issue Jun 16, 2023 · 0 comments

Comments

@Memotech-Bill
Copy link

Memotech-Bill commented Jun 16, 2023

In routine parse_im (file "video_capture.c") you protect against the calculated values of RGB being greater than 255, and clip them to this maximum value. However you do not protect against them going negative (which can happen in dark areas of the image).

The code needs to be extended as:

        if(B > UCHAR_MAX){
            B = UCHAR_MAX;
        } else if(B < 0){
            B = 0;
        }
        if(G > UCHAR_MAX){
            G = UCHAR_MAX;
        } else if(G < 0){
            G = 0;
        }
        if(R > UCHAR_MAX){
            R = UCHAR_MAX;
        } else if(R < 0){
            R = 0;
        }
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

No branches or pull requests

1 participant