-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add support for YU12 #281
base: master
Are you sure you want to change the base?
Add support for YU12 #281
Conversation
Thanks for this! I don't have any hardware I can test it with but doesn't look like it should affect anything else so will get this merged in when I get a minute! |
This probably works for ov5640 in allwinner |
@fcharron work well thank you and @jacksonliam thank you too |
Can we get this merged? |
@fcharron hello there, I want to add nv12 4:2:0 support, I noticed with this you add yuv12, I was wondering if with your PR the nv12 can be interpreted or do I need additional conversion? |
Hi @beckmx, while YV12/YU12 (https://www.kernel.org/doc/html/v4.9/media/uapi/v4l/pixfmt-yuv420.html) and NV12/NV21 (https://www.kernel.org/doc/html/v4.9/media/uapi/v4l/pixfmt-nv12.html) contain the exact same data, it is not organized in the same order in memory. As such, you would need an additional conversion to go from one to the other, but it should be a pretty simple one. |
@ssotangkur I don't see any problem with it. I figure if anyone else confirms it works as expected, the project owner would be satisfied that it works fine. Seems like a couple of people already did confirm it worked... @jacksonliam ? |
@fcharron to be honest with u, I read the docs and also understood the same, but I am not that good on these topics |
@fcharron I forked from your repo and added nv12, it worked, or kinda, if you have sometime to checkout, looks like the color of the image looks pink 🥲 |
@beckmx - where's your branch? I have an oak-d that exposes NV12, so could have a look. |
@PyroSA https://github.com/beckmx/vita-streamer there u go, I created a yt video in case u want to see the problem |
I think your colour conversion is incomplete.
That was enough to get mine looking accurate. (Fixed focus lens, yellow-blue-red at bottom) And boom - @alex-luxonis's uvc output becomes an http stream - love it! |
@PyroSA awesome, I could easily port this to openwrt :) |
Inspired by https://github.com/pranjalv123/mjpg-streamer-yu12, I added YU12 (Planar YUV420) support.
More info about the YU12 format at https://www.kernel.org/doc/html/v4.9/media/uapi/v4l/pixfmt-yuv420.html.
In summary, all Y's of the frame are located at the beginning of the buffer, followed by all U's, then all V's. Besides that special buffer format, the configuration (number and display location of Y, U and V components) is exactly the same as regular YUV.
Tested on latest official Octopi (https://github.com/guysoft/OctoPi)