I referred these two files in Qt 5.9 source code:
qvideoframeconversionhelper.cpp
qvideoframe.cpp
And find what I need
void QT_FASTCALL qt_convert_YUV420P_to_ARGB32(const QVideoFrame &frame, uchar *output)
But QVideoFrame
in 5.9 is different with 5.3, so this function needs some modifying:
void QT_FASTCALL qt_convert_YUV420P_to_ARGB32(const QVideoFrame &frame, uchar *output)
{
//FETCH_INFO_TRIPLANAR(frame) ← this's not provided in 5.3
// Add this ↓
const int width = frame.width();
const int height = frame.height();
int yStride = frame.bytesPerLine();
int uvStride = (frame.mappedBytes() - (yStride * height)) / height;
const uchar *plane1 = frame.bits();
const uchar *plane2 = plane1 + (yStride * height);
const uchar *plane3 = plane2 + (uvStride * height / 2);
int plane1Stride = yStride;
int plane2Stride = uvStride;
int plane3Stride = uvStride;
// Add this ↑
planarYUV420_to_ARGB32(plane1, plane1Stride,
plane2, plane2Stride,
plane3, plane3Stride,
1,
reinterpret_cast<quint32*>(output),
width, height);
}