Say I have an NV12 frame in memory as an array of bytes. I know:
- its Width and Height
- its Stride (total width of a line including padding), which is the same for Y and UV components as per NV12 specification
- I know where Y begins, U begins at Y + (Stride * Height), and V begins at U + 1 (interleaved with U).
Now this is what I have so far:
SwsContext* context = sws_getContext(frameWidth, frameHeight, AV_PIX_FMT_NV12, frameWidth, frameHeight, AV_PIX_FMT_RGB32, 0, nullptr, nullptr, nullptr);
sws_scale(context,
So I don't know what the parameters to sws_scale should be:
- srcSlice : a pointer to the array of bytes? It should apparently be a pointer to a pointer, but what I have is just a single-dimensional array of bytes.
- srcStride : apparently expects an array of strides, but I have just one stride for the entire file. Should I pass an array with just one element?
- srcSliceY : an offset to the first byte I guess? Should be 0 then.
- srcSliceH : the frame height I guess
- dst : once again, pointer to a pointer, but my destination output is actually just another array of bytes...
- dstStride : Width * 4 I guess?
Any help appreciated.