diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-03-25 18:04:03 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-04-07 14:51:17 +0000 |
commit | f66c18bc51989ae5388b333c2b2804dd7b6e3f1a (patch) | |
tree | 537f8ed94945053648f44160c4cbcdd0c7963eac /src/multimedia | |
parent | 0ce875a4e302afc5b67ec63d35051d90e486db79 (diff) |
Use the infra in QVideoSurfaceFormat to get shaders and uniforms
frame mapping is still done in qtmultimediaquicktools, but once
that's moved as well, we can radically simplify the rendering
code there.
Change-Id: Ia56c8b62c5726f1bfea0b0c4c46a81e103141e9e
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/multimedia')
-rw-r--r-- | src/multimedia/video/qvideosurfaceformat.cpp | 15 | ||||
-rw-r--r-- | src/multimedia/video/qvideosurfaceformat.h | 2 |
2 files changed, 7 insertions, 10 deletions
diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp index 774a72c30..5271a12db 100644 --- a/src/multimedia/video/qvideosurfaceformat.cpp +++ b/src/multimedia/video/qvideosurfaceformat.cpp @@ -486,7 +486,7 @@ QString QVideoSurfaceFormat::vertexShaderFileName() const } } -QString QVideoSurfaceFormat::pixelShaderFileName() const +QString QVideoSurfaceFormat::fragmentShaderFileName() const { switch (d->pixelFormat) { case Format_Invalid: @@ -608,17 +608,13 @@ QByteArray QVideoSurfaceFormat::uniformData(const QMatrix4x4 &transform, float o QByteArray buf(16*4 + 4, Qt::Uninitialized); char *data = buf.data(); memcpy(data, transform.constData(), 64); - memcpy(data + 64, colorMatrix(d->ycbcrColorSpace).constData(), 64); - memcpy(data + 64 + 64, &opacity, 4); - memcpy(data + 64 + 64, &opacity, 4); - memcpy(data + 64 + 64, &opacity, 4); - memcpy(data + 64 + 64, &opacity, 4); + memcpy(data + 64, &opacity, 4); return buf; } case Format_YUV420P: case Format_YUV422P: case Format_YV12: { - static constexpr float pw[] = { 1, 1, 0 }; + static constexpr float pw[] = { 1, 1, 1 }; planeWidth = pw; break; } @@ -643,8 +639,9 @@ QByteArray QVideoSurfaceFormat::uniformData(const QMatrix4x4 &transform, float o QByteArray buf(64*2 + 4 + 3*4, Qt::Uninitialized); char *data = buf.data(); memcpy(data, transform.constData(), 64); - memcpy(data + 64, &opacity, 4); - memcpy(data + 64 + 4, planeWidth, 3*4); + memcpy(data + 64, colorMatrix(d->ycbcrColorSpace).constData(), 64); + memcpy(data + 64 + 64, &opacity, 4); + memcpy(data + 64 + 64 + 4, planeWidth, 3*4); return buf; } diff --git a/src/multimedia/video/qvideosurfaceformat.h b/src/multimedia/video/qvideosurfaceformat.h index c81416945..41b5c8292 100644 --- a/src/multimedia/video/qvideosurfaceformat.h +++ b/src/multimedia/video/qvideosurfaceformat.h @@ -165,7 +165,7 @@ public: QSize sizeHint() const; QString vertexShaderFileName() const; - QString pixelShaderFileName() const; + QString fragmentShaderFileName() const; QByteArray uniformData(const QMatrix4x4 &transform, float opacity) const; static PixelFormat pixelFormatFromImageFormat(QImage::Format format); |