From 66c339928cde3e582d75ef8350d91f3359dd86a5 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 6 Apr 2021 14:24:13 +0200 Subject: Remove 16bit RGB pixel formats We can't handle them efficiently on old OpenGL 2 based hardware. As YUV formats are usually preferred, we should not have problems simply removing those. Change-Id: Ibee483302cdada9d4d46c18196c6cee5d9945ae2 Reviewed-by: Doris Verria Reviewed-by: Lars Knoll --- src/multimedia/video/qvideoframe.cpp | 22 --------- .../video/qvideoframeconversionhelper.cpp | 56 ---------------------- .../video/qvideoframeconversionhelper_p.h | 16 ------- src/multimedia/video/qvideosurfaceformat.cpp | 18 ------- src/multimedia/video/qvideosurfaceformat.h | 4 -- src/multimedia/video/qvideotexturehelper.cpp | 31 ------------ 6 files changed, 147 deletions(-) (limited to 'src/multimedia/video') diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp index 81cb62611..28516c60a 100644 --- a/src/multimedia/video/qvideoframe.cpp +++ b/src/multimedia/video/qvideoframe.cpp @@ -60,14 +60,10 @@ static bool pixelFormatHasAlpha[QVideoSurfaceFormat::NPixelFormats] = true, //Format_ARGB32, true, //Format_ARGB32_Premultiplied, false, //Format_RGB32, - false, //Format_RGB565, - false, //Format_RGB555, true, //Format_BGRA32, true, //Format_BGRA32_Premultiplied, true, //Format_ABGR32, false, //Format_BGR32, - false, //Format_BGR565, - false, //Format_BGR555, true, //Format_AYUV444, true, //Format_AYUV444_Premultiplied, @@ -172,14 +168,6 @@ private: The frame stored using a 32-bit RGB format (0xffRRGGBB). This is equivalent to QImage::Format_RGB32 - \value Format_RGB565 - The frame is stored using a 16-bit RGB format (5-6-5). This is equivalent to - QImage::Format_RGB16. - - \value Format_RGB555 - The frame is stored using a 16-bit RGB format (5-5-5). This is equivalent to - QImage::Format_RGB555. - \value Format_BGRA32 The frame is stored using a 32-bit BGRA format (0xBBGGRRAA). @@ -192,12 +180,6 @@ private: \value Format_BGR32 The frame is stored using a 32-bit BGR format (0xBBGGRRff). - \value Format_BGR565 - The frame is stored using a 16-bit BGR format (5-6-5). - - \value Format_BGR555 - The frame is stored using a 16-bit BGR format (5-5-5). - \value Format_AYUV444 The frame is stored using a packed 32-bit AYUV format (0xAAYYUUVV). @@ -566,14 +548,10 @@ bool QVideoFrame::map(QVideoFrame::MapMode mode) case QVideoSurfaceFormat::Format_ARGB32: case QVideoSurfaceFormat::Format_ARGB32_Premultiplied: case QVideoSurfaceFormat::Format_RGB32: - case QVideoSurfaceFormat::Format_RGB565: - case QVideoSurfaceFormat::Format_RGB555: case QVideoSurfaceFormat::Format_BGRA32: case QVideoSurfaceFormat::Format_BGRA32_Premultiplied: case QVideoSurfaceFormat::Format_ABGR32: case QVideoSurfaceFormat::Format_BGR32: - case QVideoSurfaceFormat::Format_BGR565: - case QVideoSurfaceFormat::Format_BGR555: case QVideoSurfaceFormat::Format_AYUV444: case QVideoSurfaceFormat::Format_AYUV444_Premultiplied: case QVideoSurfaceFormat::Format_UYVY: diff --git a/src/multimedia/video/qvideoframeconversionhelper.cpp b/src/multimedia/video/qvideoframeconversionhelper.cpp index 672b83a03..346880a29 100644 --- a/src/multimedia/video/qvideoframeconversionhelper.cpp +++ b/src/multimedia/video/qvideoframeconversionhelper.cpp @@ -420,58 +420,6 @@ static void QT_FASTCALL qt_convert_ABGR32_to_ARGB32(const QVideoFrame &frame, uc } } -static void QT_FASTCALL qt_convert_BGR565_to_ARGB32(const QVideoFrame &frame, uchar *output) -{ - FETCH_INFO_PACKED(frame) - MERGE_LOOPS(width, height, stride, 2) - - quint32 *argb = reinterpret_cast(output); - - for (int y = 0; y < height; ++y) { - const quint16 *bgr = reinterpret_cast(src); - - int x = 0; - for (; x < width - 3; x += 4) { - *argb++ = qConvertBGR565ToARGB32(*bgr++); - *argb++ = qConvertBGR565ToARGB32(*bgr++); - *argb++ = qConvertBGR565ToARGB32(*bgr++); - *argb++ = qConvertBGR565ToARGB32(*bgr++); - } - - // leftovers - for (; x < width; ++x) - *argb++ = qConvertBGR565ToARGB32(*bgr++); - - src += stride; - } -} - -static void QT_FASTCALL qt_convert_BGR555_to_ARGB32(const QVideoFrame &frame, uchar *output) -{ - FETCH_INFO_PACKED(frame) - MERGE_LOOPS(width, height, stride, 2) - - quint32 *argb = reinterpret_cast(output); - - for (int y = 0; y < height; ++y) { - const quint16 *bgr = reinterpret_cast(src); - - int x = 0; - for (; x < width - 3; x += 4) { - *argb++ = qConvertBGR555ToARGB32(*bgr++); - *argb++ = qConvertBGR555ToARGB32(*bgr++); - *argb++ = qConvertBGR555ToARGB32(*bgr++); - *argb++ = qConvertBGR555ToARGB32(*bgr++); - } - - // leftovers - for (; x < width; ++x) - *argb++ = qConvertBGR555ToARGB32(*bgr++); - - src += stride; - } -} - static inline void planarYUV420_16bit_to_ARGB32(const uchar *y, int yStride, const uchar *u, int uStride, const uchar *v, int vStride, @@ -528,14 +476,10 @@ static VideoFrameConvertFunc qConvertFuncs[QVideoSurfaceFormat::NPixelFormats] = /* Format_ARGB32 */ nullptr, // Not needed /* Format_ARGB32_Premultiplied */ nullptr, // Not needed /* Format_RGB32 */ nullptr, // Not needed - /* Format_RGB565 */ nullptr, // Not needed - /* Format_RGB555 */ nullptr, // Not needed /* Format_BGRA32 */ qt_convert_BGRA32_to_ARGB32, /* Format_BGRA32_Premultiplied */ qt_convert_BGRA32_Premultiplied_to_ARGB32, /* Format_ABGR32 */ qt_convert_ABGR32_to_ARGB32, /* Format_BGR32 */ qt_convert_BGRA32_Premultiplied_to_ARGB32, - /* Format_BGR565 */ qt_convert_BGR565_to_ARGB32, - /* Format_BGR555 */ qt_convert_BGR555_to_ARGB32, /* Format_AYUV444 */ qt_convert_AYUV444_to_ARGB32, /* Format_AYUV444_Premultiplied */ qt_convert_AYUV444_Premultiplied_to_ARGB32, /* Format_YUV420P */ qt_convert_YUV420P_to_ARGB32, diff --git a/src/multimedia/video/qvideoframeconversionhelper_p.h b/src/multimedia/video/qvideoframeconversionhelper_p.h index 1d633995c..5ec919d9f 100644 --- a/src/multimedia/video/qvideoframeconversionhelper_p.h +++ b/src/multimedia/video/qvideoframeconversionhelper_p.h @@ -80,22 +80,6 @@ inline quint32 qConvertBGR24ToARGB32(const uchar *bgr) return 0xFF000000 | bgr[0] | bgr[1] << 8 | bgr[2] << 16; } -inline quint32 qConvertBGR565ToARGB32(quint16 bgr) -{ - return 0xff000000 - | ((((bgr) >> 8) & 0xf8) | (((bgr) >> 13) & 0x7)) - | ((((bgr) << 5) & 0xfc00) | (((bgr) >> 1) & 0x300)) - | ((((bgr) << 19) & 0xf80000) | (((bgr) << 14) & 0x70000)); -} - -inline quint32 qConvertBGR555ToARGB32(quint16 bgr) -{ - return 0xff000000 - | ((((bgr) >> 7) & 0xf8) | (((bgr) >> 12) & 0x7)) - | ((((bgr) << 6) & 0xf800) | (((bgr) << 1) & 0x700)) - | ((((bgr) << 19) & 0xf80000) | (((bgr) << 11) & 0x70000)); -} - #define FETCH_INFO_PACKED(frame) \ const uchar *src = frame.bits(); \ int stride = frame.bytesPerLine(); \ diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp index c0b27c428..6177ba0a6 100644 --- a/src/multimedia/video/qvideosurfaceformat.cpp +++ b/src/multimedia/video/qvideosurfaceformat.cpp @@ -430,10 +430,6 @@ QVideoSurfaceFormat::PixelFormat QVideoSurfaceFormat::pixelFormatFromImageFormat case QImage::Format_ARGB32_Premultiplied: case QImage::Format_RGBA8888_Premultiplied: return QVideoSurfaceFormat::Format_ARGB32_Premultiplied; - case QImage::Format_RGB16: - return QVideoSurfaceFormat::Format_RGB565; - case QImage::Format_RGB555: - return QVideoSurfaceFormat::Format_RGB555; case QImage::Format_Grayscale8: return QVideoSurfaceFormat::Format_Y8; case QImage::Format_Grayscale16: @@ -459,10 +455,6 @@ QImage::Format QVideoSurfaceFormat::imageFormatFromPixelFormat(QVideoSurfaceForm return QImage::Format_ARGB32_Premultiplied; case QVideoSurfaceFormat::Format_RGB32: return QImage::Format_RGB32; - case QVideoSurfaceFormat::Format_RGB565: - return QImage::Format_RGB16; - case QVideoSurfaceFormat::Format_RGB555: - return QImage::Format_RGB555; case QVideoSurfaceFormat::Format_Y8: return QImage::Format_Grayscale8; case QVideoSurfaceFormat::Format_Y16: @@ -471,8 +463,6 @@ QImage::Format QVideoSurfaceFormat::imageFormatFromPixelFormat(QVideoSurfaceForm case QVideoSurfaceFormat::Format_BGRA32: case QVideoSurfaceFormat::Format_BGRA32_Premultiplied: case QVideoSurfaceFormat::Format_BGR32: - case QVideoSurfaceFormat::Format_BGR565: - case QVideoSurfaceFormat::Format_BGR555: case QVideoSurfaceFormat::Format_AYUV444: case QVideoSurfaceFormat::Format_AYUV444_Premultiplied: case QVideoSurfaceFormat::Format_YUV420P: @@ -569,10 +559,6 @@ QDebug operator<<(QDebug dbg, QVideoSurfaceFormat::PixelFormat pf) return dbg << "Format_ARGB32_Premultiplied"; case QVideoSurfaceFormat::Format_RGB32: return dbg << "Format_RGB32"; - case QVideoSurfaceFormat::Format_RGB565: - return dbg << "Format_RGB565"; - case QVideoSurfaceFormat::Format_RGB555: - return dbg << "Format_RGB555"; case QVideoSurfaceFormat::Format_BGRA32: return dbg << "Format_BGRA32"; case QVideoSurfaceFormat::Format_BGRA32_Premultiplied: @@ -581,10 +567,6 @@ QDebug operator<<(QDebug dbg, QVideoSurfaceFormat::PixelFormat pf) return dbg << "Format_ABGR32"; case QVideoSurfaceFormat::Format_BGR32: return dbg << "Format_BGR32"; - case QVideoSurfaceFormat::Format_BGR565: - return dbg << "Format_BGR565"; - case QVideoSurfaceFormat::Format_BGR555: - return dbg << "Format_BGR555"; case QVideoSurfaceFormat::Format_AYUV444: return dbg << "Format_AYUV444"; case QVideoSurfaceFormat::Format_AYUV444_Premultiplied: diff --git a/src/multimedia/video/qvideosurfaceformat.h b/src/multimedia/video/qvideosurfaceformat.h index 8f601e4c2..e3551501a 100644 --- a/src/multimedia/video/qvideosurfaceformat.h +++ b/src/multimedia/video/qvideosurfaceformat.h @@ -65,14 +65,10 @@ public: Format_ARGB32, Format_ARGB32_Premultiplied, Format_RGB32, - Format_RGB565, - Format_RGB555, Format_BGRA32, Format_BGRA32_Premultiplied, Format_ABGR32, Format_BGR32, - Format_BGR565, - Format_BGR555, Format_AYUV444, Format_AYUV444_Premultiplied, diff --git a/src/multimedia/video/qvideotexturehelper.cpp b/src/multimedia/video/qvideotexturehelper.cpp index 2d7832020..56282445d 100644 --- a/src/multimedia/video/qvideotexturehelper.cpp +++ b/src/multimedia/video/qvideotexturehelper.cpp @@ -64,16 +64,6 @@ static const TextureDescription descriptions[QVideoSurfaceFormat::NPixelFormats] { QRhiTexture::BGRA8, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 1 }, { 1, 1 } } }, - // Format_RGB565 - { 1, - { QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, - { { 1, 1 }, { 1, 1 }, { 1, 1 } } - }, - // Format_RGB555 - { 1, - { QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, - { { 1, 1 }, { 1, 1 }, { 1, 1 } } - }, // Format_BGRA32 { 1, { QRhiTexture::BGRA8, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, @@ -94,16 +84,6 @@ static const TextureDescription descriptions[QVideoSurfaceFormat::NPixelFormats] { QRhiTexture::BGRA8, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 1 }, { 1, 1 } } }, - // Format_BGR565 - { 1, - { QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, - { { 1, 1 }, { 1, 1 }, { 1, 1 } } - }, - // Format_BGR555 - { 1, - { QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, - { { 1, 1 }, { 1, 1 }, { 1, 1 } } - }, // Format_AYUV444 { 1, @@ -215,12 +195,6 @@ QString fragmentShaderFileName(QVideoSurfaceFormat::PixelFormat format) switch (format) { case QVideoSurfaceFormat::Format_Invalid: case QVideoSurfaceFormat::Format_Jpeg: - - case QVideoSurfaceFormat::Format_RGB565: - case QVideoSurfaceFormat::Format_RGB555: - case QVideoSurfaceFormat::Format_BGR565: - case QVideoSurfaceFormat::Format_BGR555: - return QString(); case QVideoSurfaceFormat::Format_Y8: @@ -296,11 +270,6 @@ QByteArray uniformData(const QVideoSurfaceFormat &format, const QMatrix4x4 &tran switch (format.pixelFormat()) { case QVideoSurfaceFormat::Format_Invalid: case QVideoSurfaceFormat::Format_Jpeg: - - case QVideoSurfaceFormat::Format_RGB565: - case QVideoSurfaceFormat::Format_RGB555: - case QVideoSurfaceFormat::Format_BGR565: - case QVideoSurfaceFormat::Format_BGR555: return QByteArray(); case QVideoSurfaceFormat::Format_ARGB32: -- cgit v1.2.3