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

yuv422 confusions? #146

Open
yamt opened this issue Oct 12, 2023 · 2 comments
Open

yuv422 confusions? #146

yamt opened this issue Oct 12, 2023 · 2 comments

Comments

@yamt
Copy link
Contributor

yamt commented Oct 12, 2023

this is about 0.10 branch as senpai is not buildable for me.

  1. nokhwa-bindings-macos seems to map both of kCMVideoCodecType_422YpCbCr8 and kCMPixelFormat_422YpCbCr8_yuvs to FrameFormat::YUYV.
    according to apple docs,
    kCMVideoCodecType_422YpCbCr8 is "ordered Cb Y'0 Cr Y'1" and kCMPixelFormat_422YpCbCr8_yuvs is "ordered Y'0 Cb Y'1 Cr."
    on the other hand, buf_yuyv422_to_rgb seems assuming the latter ordering.

  2. on my environment (MacBook Pro (15-inch, 2018)) the camera on the top of the display seems to report kCMPixelFormat_422YpCbCr8_yuvs. (confirmed by adding debug code in raw_fcc_to_frameformat)
    however, for some reasons, using the threaded-capture example, the buffers given to the callback actually seem to contain bytes in "Cb Y'0 Cr Y'1" order. (thus decoded wrong.)

cf.
https://developer.apple.com/documentation/coremedia/1564239-video_codec_constants/kcmvideocodectype_422ypcbcr8
https://developer.apple.com/documentation/coremedia/1564244-video_pixel_format_constants/kcmpixelformat_422ypcbcr8_yuvs

@l1npengtul
Copy link
Owner

Thank you for your comment, I did not see that when I originally wrote that code. I will fix this in the upcoming release.

@yamt
Copy link
Contributor Author

yamt commented Oct 17, 2023

on my environment (MacBook Pro (15-inch, 2018)) the camera on the top of the display seems to report kCMPixelFormat_422YpCbCr8_yuvs. (confirmed by adding debug code in raw_fcc_to_frameformat)
however, for some reasons, using the threaded-capture example, the buffers given to the callback actually seem to contain bytes in "Cb Y'0 Cr Y'1" order. (thus decoded wrong.)

#151 fixes this part.

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

2 participants