Too long to put in a comment...
This is how YUY2 is packed
- Y is luma
- Cb or U is the blue component
- Cr or V is the red component
I don't see you correctly indexing the chrome-planes above...
This loop in c (and SDL) sets all Cb pixels to value 0x80:
for (Uint32 i = 1; i < W * H * 2; i += 4) {
*(my_overlay->pixels[0] + i) = 0x80;
}
The allowed range for pixel-values are integers 0-255
(a lot more complex in reality thought). Program above seems to use normalized values between 0-1
. How are you performing the normalization?
Hope this helps, if not, drop me a comment.