Close. YUV420 uses chroma-subsampling both vertically and horizontally. That means that the U & V chroma planes are 25% the size of the luma plane.I don't think that copying the whole YUV420 image will give you what you want. You should look at the Yuv420ToRgb function and work out which parts of the data you will need to copy into you inference image.
Looking at this:
https://stackoverflow.com/questions/278 ... ata-layout
It appears that the Y (grayscale) data is the first half of the data and the U and V components are the seconds half. I may be wrong.
Luma is therefore the first 2/3rds of the buffer as width x height x 8bpp. For I420/YU12 you then get a width/2 x height/2 x 8bpp for U, and the same again for V.
YUV422 only chroma subsamples horizontally, so the combined chroma planes are the same size as the luma.
YUV444 has no chroma-subsampling, so each chroma plane is the same size as the luma.
There are other YUV formats with different subsampling ratios, but those are the main 3.
Statistics: Posted by 6by9 — Tue Jul 23, 2024 11:10 am