mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 767480 - Remove offset field from PlanarYCbCrImage::Data. r=roc
This commit is contained in:
parent
8a4fe6d605
commit
b6dc323f77
@ -218,18 +218,15 @@ VideoData* VideoData::Create(nsVideoInfo& aInfo,
|
||||
PlanarYCbCrImage* videoImage = static_cast<PlanarYCbCrImage*>(v->mImage.get());
|
||||
|
||||
PlanarYCbCrImage::Data data;
|
||||
data.mYChannel = Y.mData;
|
||||
data.mYChannel = Y.mData + Y.mOffset;
|
||||
data.mYSize = gfxIntSize(Y.mWidth, Y.mHeight);
|
||||
data.mYStride = Y.mStride;
|
||||
data.mYOffset = Y.mOffset;
|
||||
data.mYSkip = Y.mSkip;
|
||||
data.mCbChannel = Cb.mData;
|
||||
data.mCrChannel = Cr.mData;
|
||||
data.mCbChannel = Cb.mData + Cb.mOffset;
|
||||
data.mCrChannel = Cr.mData + Cr.mOffset;
|
||||
data.mCbCrSize = gfxIntSize(Cb.mWidth, Cb.mHeight);
|
||||
data.mCbCrStride = Cb.mStride;
|
||||
data.mCbOffset = Cb.mOffset;
|
||||
data.mCbSkip = Cb.mSkip;
|
||||
data.mCrOffset = Cr.mOffset;
|
||||
data.mCrSkip = Cr.mSkip;
|
||||
data.mPicX = aPicture.x;
|
||||
data.mPicY = aPicture.y;
|
||||
|
@ -413,31 +413,25 @@ PlanarYCbCrImage::AllocateBuffer(uint32_t aSize)
|
||||
|
||||
static void
|
||||
CopyPlane(uint8_t *aDst, uint8_t *aSrc,
|
||||
const gfxIntSize &aSize, int32_t aStride,
|
||||
int32_t aOffset, int32_t aSkip)
|
||||
const gfxIntSize &aSize, int32_t aStride, int32_t aSkip)
|
||||
{
|
||||
if (!aOffset && !aSkip) {
|
||||
if (!aSkip) {
|
||||
// Fast path: planar input.
|
||||
memcpy(aDst, aSrc, aSize.height * aStride);
|
||||
} else {
|
||||
int32_t height = aSize.height;
|
||||
int32_t width = aSize.width;
|
||||
for (int y = 0; y < height; ++y) {
|
||||
uint8_t *src = aSrc + aOffset;
|
||||
uint8_t *src = aSrc;
|
||||
uint8_t *dst = aDst;
|
||||
if (!aSkip) {
|
||||
// Fast path: offset only, no per-pixel skip.
|
||||
memcpy(dst, src, width);
|
||||
} else {
|
||||
// Slow path
|
||||
for (int x = 0; x < width; ++x) {
|
||||
*dst++ = *src++;
|
||||
src += aSkip;
|
||||
}
|
||||
// Slow path
|
||||
for (int x = 0; x < width; ++x) {
|
||||
*dst++ = *src++;
|
||||
src += aSkip;
|
||||
}
|
||||
aSrc += aStride;
|
||||
aDst += aStride;
|
||||
}
|
||||
aSrc += aStride;
|
||||
aDst += aStride;
|
||||
}
|
||||
}
|
||||
|
||||
@ -460,14 +454,11 @@ PlanarYCbCrImage::CopyData(const Data& aData)
|
||||
mData.mCrChannel = mData.mCbChannel + mData.mCbCrStride * mData.mCbCrSize.height;
|
||||
|
||||
CopyPlane(mData.mYChannel, aData.mYChannel,
|
||||
mData.mYSize, mData.mYStride,
|
||||
mData.mYOffset, mData.mYSkip);
|
||||
mData.mYSize, mData.mYStride, mData.mYSkip);
|
||||
CopyPlane(mData.mCbChannel, aData.mCbChannel,
|
||||
mData.mCbCrSize, mData.mCbCrStride,
|
||||
mData.mCbOffset, mData.mCbSkip);
|
||||
mData.mCbCrSize, mData.mCbCrStride, mData.mCbSkip);
|
||||
CopyPlane(mData.mCrChannel, aData.mCrChannel,
|
||||
mData.mCbCrSize, mData.mCbCrStride,
|
||||
mData.mCrOffset, mData.mCrSkip);
|
||||
mData.mCbCrSize, mData.mCbCrStride, mData.mCrSkip);
|
||||
|
||||
mSize = aData.mPicSize;
|
||||
}
|
||||
|
@ -609,10 +609,22 @@ private:
|
||||
* mPicX, mPicY and mPicSize. The size of the rendered image is
|
||||
* mPicSize, not mYSize or mCbCrSize.
|
||||
*
|
||||
* mYOffset, mYSkip, mCbOffset, mCbSkip, mCrOffset, mCrSkip are added
|
||||
* to support various output formats from hardware decoder. m*Offset
|
||||
* are the extra left stride and m*Skip are per-pixel skips in the
|
||||
* mYSkip, mCbSkip, mCrSkip are added to support various output
|
||||
* formats from hardware decoder. They are per-pixel skips in the
|
||||
* source image.
|
||||
*
|
||||
* For example when image width is 640, mYStride is 670, mYSkip is 3,
|
||||
* the mYChannel buffer looks like:
|
||||
*
|
||||
* |<----------------------- mYStride ----------------------------->|
|
||||
* |<----------------- mYSize.width --------------->|
|
||||
* 0 3 6 9 12 15 18 21 659 669
|
||||
* |----------------------------------------------------------------|
|
||||
* |Y___Y___Y___Y___Y___Y___Y___Y... |%%%%%%%%%|
|
||||
* |Y___Y___Y___Y___Y___Y___Y___Y... |%%%%%%%%%|
|
||||
* |Y___Y___Y___Y___Y___Y___Y___Y... |%%%%%%%%%|
|
||||
* | |<->|
|
||||
* mYSkip
|
||||
*/
|
||||
class THEBES_API PlanarYCbCrImage : public Image {
|
||||
public:
|
||||
@ -621,16 +633,13 @@ public:
|
||||
uint8_t* mYChannel;
|
||||
int32_t mYStride;
|
||||
gfxIntSize mYSize;
|
||||
int32_t mYOffset;
|
||||
int32_t mYSkip;
|
||||
// Chroma buffers
|
||||
uint8_t* mCbChannel;
|
||||
uint8_t* mCrChannel;
|
||||
int32_t mCbCrStride;
|
||||
gfxIntSize mCbCrSize;
|
||||
int32_t mCbOffset;
|
||||
int32_t mCbSkip;
|
||||
int32_t mCrOffset;
|
||||
int32_t mCrSkip;
|
||||
// Picture region
|
||||
uint32_t mPicX;
|
||||
|
Loading…
Reference in New Issue
Block a user