summaryrefslogtreecommitdiffstats
path: root/src/multimedia/video
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-04-04 17:16:18 +0200
committerLars Knoll <lars.knoll@qt.io>2021-04-08 12:18:55 +0000
commit74c7dc45ed4b79843260e4e16d808987de1aacc8 (patch)
tree14d43c3bb5bc65d9a4ace58a310caa0dd3de4e7d /src/multimedia/video
parentccb7398c3d839f36fcbdcad1e3c9fc13f387713f (diff)
Remove endian specific surface formats
For 16bit data, we only support the platforms native endianness. Change-Id: Ic04097125622715e6847d568551d572cd317b674 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/multimedia/video')
-rw-r--r--src/multimedia/video/qvideoframe.cpp12
-rw-r--r--src/multimedia/video/qvideoframeconversionhelper.cpp20
-rw-r--r--src/multimedia/video/qvideosurfaceformat.cpp18
-rw-r--r--src/multimedia/video/qvideosurfaceformat.h6
-rw-r--r--src/multimedia/video/qvideotexturehelper.cpp35
5 files changed, 24 insertions, 67 deletions
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp
index 720a7948b..81cb62611 100644
--- a/src/multimedia/video/qvideoframe.cpp
+++ b/src/multimedia/video/qvideoframe.cpp
@@ -85,10 +85,8 @@ static bool pixelFormatHasAlpha[QVideoSurfaceFormat::NPixelFormats] =
false, //Format_Y8,
false, //Format_Y16,
- false, //Format_P010LE,
- false, //Format_P010BE,
- false, //Format_P016LE,
- false, //Format_P016BE,
+ false, //Format_P010,
+ false, //Format_P016,
false, //Format_Jpeg,
@@ -609,10 +607,8 @@ bool QVideoFrame::map(QVideoFrame::MapMode mode)
case QVideoSurfaceFormat::Format_NV21:
case QVideoSurfaceFormat::Format_IMC2:
case QVideoSurfaceFormat::Format_IMC4:
- case QVideoSurfaceFormat::Format_P010BE:
- case QVideoSurfaceFormat::Format_P010LE:
- case QVideoSurfaceFormat::Format_P016BE:
- case QVideoSurfaceFormat::Format_P016LE: {
+ case QVideoSurfaceFormat::Format_P010:
+ case QVideoSurfaceFormat::Format_P016: {
// Semi planar, Full resolution Y plane with interleaved subsampled U and V planes.
d->mapData.nPlanes = 2;
d->mapData.bytesPerLine[1] = d->mapData.bytesPerLine[0];
diff --git a/src/multimedia/video/qvideoframeconversionhelper.cpp b/src/multimedia/video/qvideoframeconversionhelper.cpp
index bd1c21f24..672b83a03 100644
--- a/src/multimedia/video/qvideoframeconversionhelper.cpp
+++ b/src/multimedia/video/qvideoframeconversionhelper.cpp
@@ -511,7 +511,7 @@ static inline void planarYUV420_16bit_to_ARGB32(const uchar *y, int yStride,
}
}
-static void QT_FASTCALL qt_convert_P016LE_to_ARGB32(const QVideoFrame &frame, uchar *output)
+static void QT_FASTCALL qt_convert_P016_to_ARGB32(const QVideoFrame &frame, uchar *output)
{
FETCH_INFO_BIPLANAR(frame)
planarYUV420_16bit_to_ARGB32(plane1 + 1, plane1Stride,
@@ -523,18 +523,6 @@ static void QT_FASTCALL qt_convert_P016LE_to_ARGB32(const QVideoFrame &frame, uc
}
-static void QT_FASTCALL qt_convert_P016BE_to_ARGB32(const QVideoFrame &frame, uchar *output)
-{
- FETCH_INFO_BIPLANAR(frame)
- planarYUV420_16bit_to_ARGB32(plane1, plane1Stride,
- plane2, plane2Stride,
- plane2 + 2, plane2Stride,
- 4,
- reinterpret_cast<quint32*>(output),
- width, height);
-
-}
-
static VideoFrameConvertFunc qConvertFuncs[QVideoSurfaceFormat::NPixelFormats] = {
/* Format_Invalid */ nullptr, // Not needed
/* Format_ARGB32 */ nullptr, // Not needed
@@ -563,10 +551,8 @@ static VideoFrameConvertFunc qConvertFuncs[QVideoSurfaceFormat::NPixelFormats] =
/* Format_IMC4 */ qt_convert_IMC4_to_ARGB32,
/* Format_Y8 */ nullptr, // Not needed
/* Format_Y16 */ nullptr, // Not needed
- /* Format_P010LE */ qt_convert_P016LE_to_ARGB32,
- /* Format_P010BE */ qt_convert_P016BE_to_ARGB32,
- /* Format_P016LE */ qt_convert_P016LE_to_ARGB32,
- /* Format_P016BE */ qt_convert_P016BE_to_ARGB32,
+ /* Format_P010 */ qt_convert_P016_to_ARGB32,
+ /* Format_P016 */ qt_convert_P016_to_ARGB32,
/* Format_Jpeg */ nullptr, // Not needed
};
diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp
index 8c562c2b8..c0b27c428 100644
--- a/src/multimedia/video/qvideosurfaceformat.cpp
+++ b/src/multimedia/video/qvideosurfaceformat.cpp
@@ -486,10 +486,8 @@ QImage::Format QVideoSurfaceFormat::imageFormatFromPixelFormat(QVideoSurfaceForm
case QVideoSurfaceFormat::Format_IMC2:
case QVideoSurfaceFormat::Format_IMC3:
case QVideoSurfaceFormat::Format_IMC4:
- case QVideoSurfaceFormat::Format_P010LE:
- case QVideoSurfaceFormat::Format_P010BE:
- case QVideoSurfaceFormat::Format_P016LE:
- case QVideoSurfaceFormat::Format_P016BE:
+ case QVideoSurfaceFormat::Format_P010:
+ case QVideoSurfaceFormat::Format_P016:
case QVideoSurfaceFormat::Format_Jpeg:
case QVideoSurfaceFormat::Format_Invalid:
return QImage::Format_Invalid;
@@ -617,14 +615,10 @@ QDebug operator<<(QDebug dbg, QVideoSurfaceFormat::PixelFormat pf)
return dbg << "Format_Y8";
case QVideoSurfaceFormat::Format_Y16:
return dbg << "Format_Y16";
- case QVideoSurfaceFormat::Format_P010LE:
- return dbg << "Format_P010LE";
- case QVideoSurfaceFormat::Format_P010BE:
- return dbg << "Format_P010BE";
- case QVideoSurfaceFormat::Format_P016LE:
- return dbg << "Format_P016LE";
- case QVideoSurfaceFormat::Format_P016BE:
- return dbg << "Format_P016BE";
+ case QVideoSurfaceFormat::Format_P010:
+ return dbg << "Format_P010";
+ case QVideoSurfaceFormat::Format_P016:
+ return dbg << "Format_P016";
case QVideoSurfaceFormat::Format_Jpeg:
return dbg << "Format_Jpeg";
diff --git a/src/multimedia/video/qvideosurfaceformat.h b/src/multimedia/video/qvideosurfaceformat.h
index 6e231125f..8f601e4c2 100644
--- a/src/multimedia/video/qvideosurfaceformat.h
+++ b/src/multimedia/video/qvideosurfaceformat.h
@@ -90,10 +90,8 @@ public:
Format_Y8,
Format_Y16,
- Format_P010LE,
- Format_P010BE,
- Format_P016LE,
- Format_P016BE,
+ Format_P010,
+ Format_P016,
Format_Jpeg,
};
diff --git a/src/multimedia/video/qvideotexturehelper.cpp b/src/multimedia/video/qvideotexturehelper.cpp
index 1eed562aa..ed3742b47 100644
--- a/src/multimedia/video/qvideotexturehelper.cpp
+++ b/src/multimedia/video/qvideotexturehelper.cpp
@@ -181,26 +181,16 @@ static const TextureDescription descriptions[QVideoSurfaceFormat::NPixelFormats]
{ { 1, 1 }, { 1, 1 }, { 1, 1 } }
},
- // Format_P010LE
+ // Format_P010
{ 2,
{ QRhiTexture::R16, QRhiTexture::RG16, QRhiTexture::UnknownFormat },
{ { 1, 1 }, { 2, 2 }, { 1, 1 } }
},
- // Format_P010BE
- { 2,
- { QRhiTexture::RG8, QRhiTexture::BGRA8, QRhiTexture::UnknownFormat },
- { { 1, 1 }, { 2, 2 }, { 1, 1 } }
- },
- // Format_P016LE
+ // Format_P016
{ 2,
{ QRhiTexture::R16, QRhiTexture::RG16, QRhiTexture::UnknownFormat },
{ { 1, 1 }, { 2, 2 }, { 1, 1 } }
},
- // Format_P016BE
- { 2,
- { QRhiTexture::RG8, QRhiTexture::BGRA8, QRhiTexture::UnknownFormat },
- { { 1, 1 }, { 2, 2 }, { 1, 1 } }
- },
// Format_Jpeg
{ 1,
@@ -252,10 +242,8 @@ QString vertexShaderFileName(QVideoSurfaceFormat::PixelFormat format)
case QVideoSurfaceFormat::Format_YUYV:
case QVideoSurfaceFormat::Format_NV12:
case QVideoSurfaceFormat::Format_NV21:
- case QVideoSurfaceFormat::Format_P010LE:
- case QVideoSurfaceFormat::Format_P010BE:
- case QVideoSurfaceFormat::Format_P016LE:
- case QVideoSurfaceFormat::Format_P016BE:
+ case QVideoSurfaceFormat::Format_P010:
+ case QVideoSurfaceFormat::Format_P016:
return QStringLiteral(":/qt-project.org/multimedia/shaders/yuv.vert.qsb");
}
}
@@ -302,12 +290,9 @@ QString fragmentShaderFileName(QVideoSurfaceFormat::PixelFormat format)
return QStringLiteral(":/qt-project.org/multimedia/shaders/nv12.frag.qsb");
case QVideoSurfaceFormat::Format_NV21:
return QStringLiteral(":/qt-project.org/multimedia/shaders/nv21.frag.qsb");
- case QVideoSurfaceFormat::Format_P010LE:
- case QVideoSurfaceFormat::Format_P016LE:
- return QStringLiteral(":/qt-project.org/multimedia/shaders/p010le.frag.qsb");
- case QVideoSurfaceFormat::Format_P010BE:
- case QVideoSurfaceFormat::Format_P016BE:
- return QStringLiteral(":/qt-project.org/multimedia/shaders/p010be.frag.qsb");
+ case QVideoSurfaceFormat::Format_P010:
+ case QVideoSurfaceFormat::Format_P016:
+ return QStringLiteral(":/qt-project.org/multimedia/shaders/p010.frag.qsb");
}
}
@@ -394,10 +379,8 @@ QByteArray uniformData(const QVideoSurfaceFormat &format, const QMatrix4x4 &tran
}
case QVideoSurfaceFormat::Format_NV12:
case QVideoSurfaceFormat::Format_NV21:
- case QVideoSurfaceFormat::Format_P010LE:
- case QVideoSurfaceFormat::Format_P010BE:
- case QVideoSurfaceFormat::Format_P016LE:
- case QVideoSurfaceFormat::Format_P016BE: {
+ case QVideoSurfaceFormat::Format_P010:
+ case QVideoSurfaceFormat::Format_P016: {
static constexpr float pw[] = { 1, 1, 0 };
planeWidth = pw;
break;