summaryrefslogtreecommitdiffstats
path: root/src/multimedia
diff options
context:
space:
mode:
authorDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2010-03-12 05:03:58 (GMT)
committerDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2010-03-12 05:03:58 (GMT)
commita3e2e9efd4ed4baed3b5ca71cf518b3d3fda4716 (patch)
treeca5de2c8edbe400a255ab2b855bf4959fa728bb6 /src/multimedia
parentf2fb317c1ed1b2e7ed46cf80dee474ebe1fa4ce7 (diff)
downloadQt-a3e2e9efd4ed4baed3b5ca71cf518b3d3fda4716.zip
Qt-a3e2e9efd4ed4baed3b5ca71cf518b3d3fda4716.tar.gz
Qt-a3e2e9efd4ed4baed3b5ca71cf518b3d3fda4716.tar.bz2
QPainterVideoSurface: assume yuv 420p and YV12 lines are 4 byte aligned.
Reviewed-by: Andrew den Exter
Diffstat (limited to 'src/multimedia')
-rw-r--r--src/multimedia/base/qpaintervideosurface.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/multimedia/base/qpaintervideosurface.cpp b/src/multimedia/base/qpaintervideosurface.cpp
index fc3d493..ed93fad 100644
--- a/src/multimedia/base/qpaintervideosurface.cpp
+++ b/src/multimedia/base/qpaintervideosurface.cpp
@@ -434,6 +434,9 @@ void QVideoSurfaceGLPainter::initRgbTextureInfo(
void QVideoSurfaceGLPainter::initYuv420PTextureInfo(const QSize &size)
{
+ int w = (size.width() + 3) & ~3;
+ int w2 = (size.width()/2 + 3) & ~3;
+
m_yuv = true;
m_textureInternalFormat = GL_LUMINANCE;
m_textureFormat = GL_LUMINANCE;
@@ -444,14 +447,17 @@ void QVideoSurfaceGLPainter::initYuv420PTextureInfo(const QSize &size)
m_textureOffsets[0] = 0;
m_textureWidths[1] = size.width() / 2;
m_textureHeights[1] = size.height() / 2;
- m_textureOffsets[1] = size.width() * size.height();
+ m_textureOffsets[1] = w * size.height();
m_textureWidths[2] = size.width() / 2;
m_textureHeights[2] = size.height() / 2;
- m_textureOffsets[2] = size.width() * size.height() * 5 / 4;
+ m_textureOffsets[2] = w * size.height() + w2 * (size.height() / 2);
}
void QVideoSurfaceGLPainter::initYv12TextureInfo(const QSize &size)
{
+ int w = (size.width() + 3) & ~3;
+ int w2 = (size.width()/2 + 3) & ~3;
+
m_yuv = true;
m_textureInternalFormat = GL_LUMINANCE;
m_textureFormat = GL_LUMINANCE;
@@ -462,10 +468,10 @@ void QVideoSurfaceGLPainter::initYv12TextureInfo(const QSize &size)
m_textureOffsets[0] = 0;
m_textureWidths[1] = size.width() / 2;
m_textureHeights[1] = size.height() / 2;
- m_textureOffsets[1] = size.width() * size.height() * 5 / 4;
+ m_textureOffsets[1] = w * size.height() + w2 * (size.height() / 2);
m_textureWidths[2] = size.width() / 2;
m_textureHeights[2] = size.height() / 2;
- m_textureOffsets[2] = size.width() * size.height();
+ m_textureOffsets[2] = w * size.height();
}
#ifndef QT_OPENGL_ES