No need for byteswapping in YV12 decoding on BE machines

The hardware seems to do the proper thing already, so always use the same
code on both little-endian and big-endian machines.  Fixes xv YV12 on a
TechSource Raptor GFX aka Sun PGX32.

Signed-off-by: Mark Kettenis <[email protected]>
---
 src/pm2_video.c |   40 ++--------------------------------------
 1 files changed, 2 insertions(+), 38 deletions(-)

diff --git a/src/pm2_video.c b/src/pm2_video.c
index 0c47d16..e26e42a 100644
--- a/src/pm2_video.c
+++ b/src/pm2_video.c
@@ -1696,7 +1696,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;
@@ -1718,33 +1718,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)
 {
@@ -1841,17 +1814,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;
 
-- 
1.7.3.2

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to