Bug 590735 - D3D9/OGL Image layers need to round up on uneven sized YCbCr images r=joe, a=blocking2.0

This commit is contained in:
Matt Woodrow 2010-09-03 15:50:42 +12:00
Родитель 47a5284310
Коммит b5fb6a703c
4 изменённых файлов: 28 добавлений и 1 удалений

Просмотреть файл

@ -269,23 +269,35 @@ PlanarYCbCrImageD3D9::SetData(const PlanarYCbCrImage::Data &aData)
// YV24 format
width_shift = 0;
height_shift = 0;
mType = gfx::YV24;
} else if (aData.mYSize.width / 2 == aData.mCbCrSize.width &&
aData.mYSize.height == aData.mCbCrSize.height) {
// YV16 format
width_shift = 1;
height_shift = 0;
mType = gfx::YV16;
} else if (aData.mYSize.width / 2 == aData.mCbCrSize.width &&
aData.mYSize.height / 2 == aData.mCbCrSize.height ) {
// YV12 format
width_shift = 1;
height_shift = 1;
mType = gfx::YV12;
} else {
NS_ERROR("YCbCr format not supported");
}
mData = aData;
mData.mCbCrStride = mData.mCbCrSize.width = aData.mPicSize.width >> width_shift;
// Round up the values for width and height to make sure we sample enough data
// for the last pixel - See bug 590735
if (width_shift && (aData.mPicSize.width & 1)) {
mData.mCbCrStride++;
mData.mCbCrSize.width++;
}
mData.mCbCrSize.height = aData.mPicSize.height >> height_shift;
if (height_shift && (aData.mPicSize.height & 1)) {
mData.mCbCrSize.height++;
}
mData.mYSize = aData.mPicSize;
mData.mYStride = mData.mYSize.width;
@ -458,7 +470,7 @@ PlanarYCbCrImageD3D9::GetAsSurface()
mData.mYStride,
mData.mCbCrStride,
imageSurface->Stride(),
gfx::YV12);
mType);
return imageSurface.forget().get();
}

Просмотреть файл

@ -129,6 +129,7 @@ public:
nsRefPtr<IDirect3DTexture9> mCrTexture;
nsRefPtr<IDirect3DTexture9> mCbTexture;
PRPackedBool mHasData;
gfx::YUVType mType;
};

Просмотреть файл

@ -489,23 +489,35 @@ PlanarYCbCrImageOGL::SetData(const PlanarYCbCrImage::Data &aData)
// YV24 format
width_shift = 0;
height_shift = 0;
mType = gfx::YV24;
} else if (aData.mYSize.width / 2 == aData.mCbCrSize.width &&
aData.mYSize.height == aData.mCbCrSize.height) {
// YV16 format
width_shift = 1;
height_shift = 0;
mType = gfx::YV16;
} else if (aData.mYSize.width / 2 == aData.mCbCrSize.width &&
aData.mYSize.height / 2 == aData.mCbCrSize.height ) {
// YV12 format
width_shift = 1;
height_shift = 1;
mType = gfx::YV16;
} else {
NS_ERROR("YCbCr format not supported");
}
mData = aData;
mData.mCbCrStride = mData.mCbCrSize.width = aData.mPicSize.width >> width_shift;
// Round up the values for width and height to make sure we sample enough data
// for the last pixel - See bug 590735
if (width_shift && (aData.mPicSize.width & 1)) {
mData.mCbCrStride++;
mData.mCbCrSize.width++;
}
mData.mCbCrSize.height = aData.mPicSize.height >> height_shift;
if (height_shift && (aData.mPicSize.height & 1)) {
mData.mCbCrSize.height++;
}
mData.mYSize = aData.mPicSize;
mData.mYStride = mData.mYSize.width;

Просмотреть файл

@ -40,6 +40,7 @@
#include "LayerManagerOGL.h"
#include "ImageLayers.h"
#include "yuv_convert.h"
#include "mozilla/Mutex.h"
namespace mozilla {
@ -213,6 +214,7 @@ public:
Data mData;
gfxIntSize mSize;
PRPackedBool mHasData;
gfx::YUVType mType;
};