Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qvideoframeconversionhelper.cpp File Reference

(3ac997f0b34a28af2e754fccdb8671d89ebe22d9)

#include "qvideoframeconversionhelper_p.h"
#include "qrgb.h"
#include <mutex>
+ Include dependency graph for qvideoframeconversionhelper.cpp:

Go to the source code of this file.

Macros

#define CLAMP(n)   (n > 255 ? 255 : (n < 0 ? 0 : n))
 
#define EXPAND_UV(u, v)
 

Functions

static quint32 qYUVToARGB32 (int y, int rv, int guv, int bu, int a=0xff)
 
static void planarYUV420_to_ARGB32 (const uchar *y, int yStride, const uchar *u, int uStride, const uchar *v, int vStride, int uvPixelStride, quint32 *rgb, int width, int height)
 
static void planarYUV422_to_ARGB32 (const uchar *y, int yStride, const uchar *u, int uStride, const uchar *v, int vStride, int uvPixelStride, quint32 *rgb, int width, int height)
 
static void QT_FASTCALL qt_convert_YUV420P_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
static void QT_FASTCALL qt_convert_YUV422P_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
static void QT_FASTCALL qt_convert_YV12_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
static void QT_FASTCALL qt_convert_AYUV_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
static void QT_FASTCALL qt_convert_AYUV_Premultiplied_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
static void QT_FASTCALL qt_convert_UYVY_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
static void QT_FASTCALL qt_convert_YUYV_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
static void QT_FASTCALL qt_convert_NV12_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
static void QT_FASTCALL qt_convert_NV21_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
static void QT_FASTCALL qt_convert_IMC1_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
static void QT_FASTCALL qt_convert_IMC2_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
static void QT_FASTCALL qt_convert_IMC3_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
static void QT_FASTCALL qt_convert_IMC4_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
template<typename Pixel >
static void QT_FASTCALL qt_convert_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
template<typename Pixel >
static void QT_FASTCALL qt_convert_premultiplied_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
static void planarYUV420_16bit_to_ARGB32 (const uchar *y, int yStride, const uchar *u, int uStride, const uchar *v, int vStride, int uvPixelStride, quint32 *rgb, int width, int height)
 
static void QT_FASTCALL qt_convert_P016_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
template<typename Y >
static void QT_FASTCALL qt_convert_Y_to_ARGB32 (const QVideoFrame &frame, uchar *output)
 
template<typename Pixel >
static void QT_FASTCALL qt_copy_pixels_with_mask (Pixel *dst, const Pixel *src, size_t size, Pixel mask)
 
static void qInitFuncsAsm ()
 
VideoFrameConvertFunc qConverterForFormat (QVideoFrameFormat::PixelFormat format)
 
void Q_MULTIMEDIA_EXPORT qCopyPixelsWithAlphaMask (uint32_t *dst, const uint32_t *src, size_t pixCount, QVideoFrameFormat::PixelFormat format, bool srcAlphaVaries)
 
void qCopyPixelsWithMask (uint32_t *dst, const uint32_t *src, size_t size, uint32_t mask)
 
uint32_t qAlphaMask (QVideoFrameFormat::PixelFormat format)
 

Variables

static VideoFrameConvertFunc qConvertFuncs [QVideoFrameFormat::NPixelFormats]
 
static PixelsCopyFunc qPixelsCopyFunc = qt_copy_pixels_with_mask<uint32_t>
 
static std::once_flag InitFuncsAsmFlag
 

Macro Definition Documentation

◆ CLAMP

#define CLAMP ( n)    (n > 255 ? 255 : (n < 0 ? 0 : n))

Definition at line 11 of file qvideoframeconversionhelper.cpp.

Referenced by qYUVToARGB32().

◆ EXPAND_UV

#define EXPAND_UV ( u,
v )
Value:
int uu = u - 128; \
int vv = v - 128; \
int rv = 409 * vv + 128; \
int guv = 100 * uu + 208 * vv + 128; \
int bu = 516 * uu + 128; \
GLsizei const GLfloat * v
[13]

Definition at line 13 of file qvideoframeconversionhelper.cpp.

Referenced by planarYUV420_16bit_to_ARGB32(), planarYUV420_to_ARGB32(), planarYUV422_to_ARGB32(), qt_convert_AYUV_Premultiplied_to_ARGB32(), qt_convert_AYUV_to_ARGB32(), qt_convert_UYVY_to_ARGB32(), and qt_convert_YUYV_to_ARGB32().

Function Documentation

◆ planarYUV420_16bit_to_ARGB32()

static void planarYUV420_16bit_to_ARGB32 ( const uchar * y,
int yStride,
const uchar * u,
int uStride,
const uchar * v,
int vStride,
int uvPixelStride,
quint32 * rgb,
int width,
int height )
inlinestatic

Definition at line 378 of file qvideoframeconversionhelper.cpp.

References EXPAND_UV, i, j, qYUVToARGB32(), and rgb.

Referenced by qt_convert_P016_to_ARGB32().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ planarYUV420_to_ARGB32()

static void planarYUV420_to_ARGB32 ( const uchar * y,
int yStride,
const uchar * u,
int uStride,
const uchar * v,
int vStride,
int uvPixelStride,
quint32 * rgb,
int width,
int height )
inlinestatic

Definition at line 29 of file qvideoframeconversionhelper.cpp.

References EXPAND_UV, i, j, qYUVToARGB32(), and rgb.

Referenced by qt_convert_IMC1_to_ARGB32(), qt_convert_IMC2_to_ARGB32(), qt_convert_IMC3_to_ARGB32(), qt_convert_IMC4_to_ARGB32(), qt_convert_NV12_to_ARGB32(), qt_convert_NV21_to_ARGB32(), qt_convert_YUV420P_to_ARGB32(), and qt_convert_YV12_to_ARGB32().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ planarYUV422_to_ARGB32()

static void planarYUV422_to_ARGB32 ( const uchar * y,
int yStride,
const uchar * u,
int uStride,
const uchar * v,
int vStride,
int uvPixelStride,
quint32 * rgb,
int width,
int height )
inlinestatic

Definition at line 65 of file qvideoframeconversionhelper.cpp.

References EXPAND_UV, i, j, qYUVToARGB32(), and rgb.

Referenced by qt_convert_YUV422P_to_ARGB32().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qAlphaMask()

◆ qConverterForFormat()

VideoFrameConvertFunc qConverterForFormat ( QVideoFrameFormat::PixelFormat format)

Definition at line 574 of file qvideoframeconversionhelper.cpp.

References convert(), InitFuncsAsmFlag, qConvertFuncs, and qInitFuncsAsm().

Referenced by convertCPU().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qCopyPixelsWithAlphaMask()

void Q_MULTIMEDIA_EXPORT qCopyPixelsWithAlphaMask ( uint32_t * dst,
const uint32_t * src,
size_t pixCount,
QVideoFrameFormat::PixelFormat format,
bool srcAlphaVaries )

Definition at line 582 of file qvideoframeconversionhelper.cpp.

References qAlphaMask(), and qCopyPixelsWithMask().

Referenced by QX11SurfaceCapture::Grabber::grabFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qCopyPixelsWithMask()

void qCopyPixelsWithMask ( uint32_t * dst,
const uint32_t * src,
size_t size,
uint32_t mask )

Definition at line 599 of file qvideoframeconversionhelper.cpp.

References InitFuncsAsmFlag, qInitFuncsAsm(), and qPixelsCopyFunc.

Referenced by qCopyPixelsWithAlphaMask().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qInitFuncsAsm()

◆ qt_convert_AYUV_Premultiplied_to_ARGB32()

static void QT_FASTCALL qt_convert_AYUV_Premultiplied_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 156 of file qvideoframeconversionhelper.cpp.

References EXPAND_UV, FETCH_INFO_PACKED, frame, i, j, MERGE_LOOPS, output, qYUVToARGB32(), and rgb.

+ Here is the call graph for this function:

◆ qt_convert_AYUV_to_ARGB32()

static void QT_FASTCALL qt_convert_AYUV_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 131 of file qvideoframeconversionhelper.cpp.

References EXPAND_UV, FETCH_INFO_PACKED, frame, i, j, MERGE_LOOPS, output, qPremultiply(), qYUVToARGB32(), and rgb.

+ Here is the call graph for this function:

◆ qt_convert_IMC1_to_ARGB32()

static void QT_FASTCALL qt_convert_IMC1_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 255 of file qvideoframeconversionhelper.cpp.

References FETCH_INFO_TRIPLANAR, frame, output, planarYUV420_to_ARGB32(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ qt_convert_IMC2_to_ARGB32()

static void QT_FASTCALL qt_convert_IMC2_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 269 of file qvideoframeconversionhelper.cpp.

References FETCH_INFO_BIPLANAR, frame, output, planarYUV420_to_ARGB32(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ qt_convert_IMC3_to_ARGB32()

static void QT_FASTCALL qt_convert_IMC3_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 282 of file qvideoframeconversionhelper.cpp.

References FETCH_INFO_TRIPLANAR, frame, output, planarYUV420_to_ARGB32(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ qt_convert_IMC4_to_ARGB32()

static void QT_FASTCALL qt_convert_IMC4_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 296 of file qvideoframeconversionhelper.cpp.

References FETCH_INFO_BIPLANAR, frame, output, planarYUV420_to_ARGB32(), and Q_ASSERT.

+ Here is the call graph for this function:

◆ qt_convert_NV12_to_ARGB32()

static void QT_FASTCALL qt_convert_NV12_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 233 of file qvideoframeconversionhelper.cpp.

References FETCH_INFO_BIPLANAR, frame, output, and planarYUV420_to_ARGB32().

+ Here is the call graph for this function:

◆ qt_convert_NV21_to_ARGB32()

static void QT_FASTCALL qt_convert_NV21_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 244 of file qvideoframeconversionhelper.cpp.

References FETCH_INFO_BIPLANAR, frame, output, and planarYUV420_to_ARGB32().

+ Here is the call graph for this function:

◆ qt_convert_P016_to_ARGB32()

static void QT_FASTCALL qt_convert_P016_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 418 of file qvideoframeconversionhelper.cpp.

References FETCH_INFO_BIPLANAR, frame, output, and planarYUV420_16bit_to_ARGB32().

+ Here is the call graph for this function:

◆ qt_convert_premultiplied_to_ARGB32()

template<typename Pixel >
static void QT_FASTCALL qt_convert_premultiplied_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 345 of file qvideoframeconversionhelper.cpp.

References FETCH_INFO_PACKED, frame, MERGE_LOOPS, output, and Pixel.

◆ qt_convert_to_ARGB32()

template<typename Pixel >
static void QT_FASTCALL qt_convert_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 311 of file qvideoframeconversionhelper.cpp.

References convert(), FETCH_INFO_PACKED, frame, MERGE_LOOPS, output, Pixel, and qPremultiply().

+ Here is the call graph for this function:

◆ qt_convert_UYVY_to_ARGB32()

static void QT_FASTCALL qt_convert_UYVY_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 181 of file qvideoframeconversionhelper.cpp.

References EXPAND_UV, FETCH_INFO_PACKED, frame, i, j, MERGE_LOOPS, output, qYUVToARGB32(), and rgb.

+ Here is the call graph for this function:

◆ qt_convert_Y_to_ARGB32()

template<typename Y >
static void QT_FASTCALL qt_convert_Y_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 431 of file qvideoframeconversionhelper.cpp.

References FETCH_INFO_PACKED, frame, MERGE_LOOPS, output, and Pixel.

◆ qt_convert_YUV420P_to_ARGB32()

static void QT_FASTCALL qt_convert_YUV420P_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 97 of file qvideoframeconversionhelper.cpp.

References FETCH_INFO_TRIPLANAR, frame, output, and planarYUV420_to_ARGB32().

+ Here is the call graph for this function:

◆ qt_convert_YUV422P_to_ARGB32()

static void QT_FASTCALL qt_convert_YUV422P_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 108 of file qvideoframeconversionhelper.cpp.

References FETCH_INFO_TRIPLANAR, frame, output, and planarYUV422_to_ARGB32().

+ Here is the call graph for this function:

◆ qt_convert_YUYV_to_ARGB32()

static void QT_FASTCALL qt_convert_YUYV_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 207 of file qvideoframeconversionhelper.cpp.

References EXPAND_UV, FETCH_INFO_PACKED, frame, i, j, MERGE_LOOPS, output, qYUVToARGB32(), and rgb.

+ Here is the call graph for this function:

◆ qt_convert_YV12_to_ARGB32()

static void QT_FASTCALL qt_convert_YV12_to_ARGB32 ( const QVideoFrame & frame,
uchar * output )
static

Definition at line 120 of file qvideoframeconversionhelper.cpp.

References FETCH_INFO_TRIPLANAR, frame, output, and planarYUV420_to_ARGB32().

+ Here is the call graph for this function:

◆ qt_copy_pixels_with_mask()

template<typename Pixel >
static void QT_FASTCALL qt_copy_pixels_with_mask ( Pixel * dst,
const Pixel * src,
size_t size,
Pixel mask )
static

Definition at line 466 of file qvideoframeconversionhelper.cpp.

◆ qYUVToARGB32()

static quint32 qYUVToARGB32 ( int y,
int rv,
int guv,
int bu,
int a = 0xff )
inlinestatic

Definition at line 20 of file qvideoframeconversionhelper.cpp.

References CLAMP.

Referenced by planarYUV420_16bit_to_ARGB32(), planarYUV420_to_ARGB32(), planarYUV422_to_ARGB32(), qt_convert_AYUV_Premultiplied_to_ARGB32(), qt_convert_AYUV_to_ARGB32(), qt_convert_UYVY_to_ARGB32(), and qt_convert_YUYV_to_ARGB32().

+ Here is the caller graph for this function:

Variable Documentation

◆ InitFuncsAsmFlag

std::once_flag InitFuncsAsmFlag
static

Definition at line 507 of file qvideoframeconversionhelper.cpp.

Referenced by qConverterForFormat(), and qCopyPixelsWithMask().

◆ qConvertFuncs

VideoFrameConvertFunc qConvertFuncs[QVideoFrameFormat::NPixelFormats]
static

Definition at line 473 of file qvideoframeconversionhelper.cpp.

Referenced by qConverterForFormat(), and qInitFuncsAsm().

◆ qPixelsCopyFunc

PixelsCopyFunc qPixelsCopyFunc = qt_copy_pixels_with_mask<uint32_t>
static

Definition at line 505 of file qvideoframeconversionhelper.cpp.

Referenced by qCopyPixelsWithMask(), and qInitFuncsAsm().