Bug 1215089 - P1: Properly use frame dimensions to determine planes divisors. r?jgilbert
There's no guarantee that the stride of the uv planes is twice as wide as the y plane's stride. This relationship is only true between the planes' width.
MozReview-Commit-ID: JInge1c86Z1
--- a/gfx/gl/GLBlitHelper.cpp
+++ b/gfx/gl/GLBlitHelper.cpp
@@ -696,25 +696,23 @@ GLBlitHelper::BlitImage(layers::PlanarYC
<< yuvData->mYSize.height << ", "
<< yuvData->mCbCrSize.width << ","
<< yuvData->mCbCrSize.height << ", "
<< yuvData->mYStride << ","
<< yuvData->mCbCrStride;
return false;
}
- const gfx::IntSize yTexSize(yuvData->mYStride, yuvData->mYSize.height);
- const gfx::IntSize uvTexSize(yuvData->mCbCrStride, yuvData->mCbCrSize.height);
gfx::IntSize divisors;
- if (!GuessDivisors(yTexSize, uvTexSize, &divisors)) {
+ if (!GuessDivisors(yuvData->mYSize, yuvData->mCbCrSize, &divisors)) {
gfxCriticalError() << "GuessDivisors failed:"
- << yTexSize.width << ","
- << yTexSize.height << ", "
- << uvTexSize.width << ","
- << uvTexSize.height;
+ << yuvData->mYSize.width << ","
+ << yuvData->mYSize.height << ", "
+ << yuvData->mCbCrSize.width << ","
+ << yuvData->mCbCrSize.height;
return false;
}
// --
// RED textures aren't valid in GLES2, and ALPHA textures are not valid in desktop GL Core Profiles.
// So use R8 textures on GL3.0+ and GLES3.0+, but LUMINANCE/LUMINANCE/UNSIGNED_BYTE otherwise.
GLenum internalFormat;
@@ -728,16 +726,18 @@ GLBlitHelper::BlitImage(layers::PlanarYC
internalFormat = LOCAL_GL_LUMINANCE;
unpackFormat = LOCAL_GL_LUMINANCE;
}
// --
const ScopedSaveMultiTex saveTex(mGL, 3, LOCAL_GL_TEXTURE_2D);
const ResetUnpackState reset(mGL);
+ const gfx::IntSize yTexSize(yuvData->mYStride, yuvData->mYSize.height);
+ const gfx::IntSize uvTexSize(yuvData->mCbCrStride, yuvData->mCbCrSize.height);
if (yTexSize != mYuvUploads_YSize ||
uvTexSize != mYuvUploads_UVSize)
{
mYuvUploads_YSize = yTexSize;
mYuvUploads_UVSize = uvTexSize;
mGL->fActiveTexture(LOCAL_GL_TEXTURE0);