It seems the code dealing with YV12 doesn't need to do a byte swapping dance

on sparc64.  So simplify the code.  Makes mplayer play video without weird
colors.

ok matthieu@
This commit is contained in:
kettenis
2010-12-05 20:25:26 +00:00
parent 8f32f2c9a6
commit 1e05eb448d

View File

@@ -1700,7 +1700,7 @@ Permedia2GetStill(ScrnInfoPtr pScrn,
}
static void
CopyYV12LE(CARD8 *Y, CARD32 *dst, int width, int height, int pitch)
CopyYV12(CARD8 *Y, CARD32 *dst, int width, int height, int pitch)
{
int Y_size = width * height;
CARD8 *V = Y + Y_size;
@@ -1722,33 +1722,6 @@ CopyYV12LE(CARD8 *Y, CARD32 *dst, int width, int height, int pitch)
}
}
#if X_BYTE_ORDER == X_BIG_ENDIAN
static void
CopyYV12BE(CARD8 *Y, CARD32 *dst, int width, int height, int pitch)
{
int Y_size = width * height;
CARD8 *V = Y + Y_size;
CARD8 *U = V + (Y_size >> 2);
int pad = (pitch >> 2) - (width >> 1);
int x;
width >>= 1;
for (height >>= 1; height > 0; height--) {
for (x = 0; x < width; Y += 2, x++)
*dst++ = V[x] + (Y[1] << 8) + (U[x] << 16) + (Y[0] << 24);
dst += pad;
for (x = 0; x < width; Y += 2, x++)
*dst++ = V[x] + (Y[1] << 8) + (U[x] << 16) + (Y[0] << 24);
dst += pad;
U += width;
V += width;
}
}
#endif /* X_BYTE_ORDER == X_BIG_ENDIAN */
static void
CopyFlat(CARD8 *src, CARD8 *dst, int width, int height, int pitch)
{
@@ -1845,17 +1818,8 @@ Permedia2PutImage(ScrnInfoPtr pScrn,
switch (id) {
case LE4CC('Y','V','1','2'):
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
CopyYV12LE(buf, (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0]),
CopyYV12(buf, (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0]),
width, height, pPPriv->BufferStride);
#else
if (pGlint->FBDev)
CopyYV12LE(buf, (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0]),
width, height, pPPriv->BufferStride);
else
CopyYV12BE(buf, (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0]),
width, height, pPPriv->BufferStride);
#endif
PutYUV(pPPriv, pPPriv->BufferBase[0], FORMAT_YUYV, 1, 0);
break;