Hi,

I think something went wrong when the YUV444P patch was applied, the
A/Bop_next/prev seem to be swapped around?

Also Nils, I am attaching a patch that restores the DSPF_AYUV fixes that
you applied while handmerging my (A)VYU patch when the mailing list was
broken and mails got lost.

And since I had been waiting for you to apply the YUV444P and ARGB8565
patches before sending a rebased up to date version of the DSPF_(A)VYU
patch, here it comes.

Plus commit fc5d3705b4c9e1b3a61607d2b662d28b1c25b4b7 (generic: Fixed
Bop_PFI_StoK_Aop_PFI) missed out the new pixelformats



Cheers,
Andre'

>From 0cad4823a633d4bcc0e6dbda970c38f878efd2c5 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Andr=C3=A9=20Draszik?= <andre.dras...@st.com>
Date: Sun, 19 Jul 2009 16:27:28 +0100
Subject: [PATCH 1/5] pixelformats: fixes for DSPF_YUV444P
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Signed-off-by: André Draszik <andre.dras...@st.com>
---
 src/gfx/convert.c         |    5 ++++
 src/gfx/generic/generic.c |   48 ++++++++++++++++++++++----------------------
 2 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/src/gfx/convert.c b/src/gfx/convert.c
index da19713..b398275 100644
--- a/src/gfx/convert.c
+++ b/src/gfx/convert.c
@@ -1526,8 +1526,13 @@ dfb_convert_to_rgb24( DFBSurfacePixelFormat  format,
                     const u8 * __restrict cr = src + 2 * surface_height * spitch;
 
                     for (n=0, n3=0; n<width; n++, n3+=3) {
+#ifdef WORDS_BIGENDIAN
                          YCBCR_TO_RGB (*y++, *cb++, *cr++,
                                        dst[n3+0], dst[n3+1], dst[n3+2]);
+#else
+                         YCBCR_TO_RGB (*y++, *cb++, *cr++,
+                                       dst[n3+2], dst[n3+1], dst[n3+0]);
+#endif
                     }
 
                     src += spitch;
diff --git a/src/gfx/generic/generic.c b/src/gfx/generic/generic.c
index ba984a3..b389821 100644
--- a/src/gfx/generic/generic.c
+++ b/src/gfx/generic/generic.c
@@ -9971,17 +9971,17 @@ static void Aop_next( GenefxState *gfxs )
           else if (gfxs->dst_format == DSPF_YUV444P) {
                if (gfxs->dst_caps & DSCAPS_SEPARATED) {
                     if (gfxs->Aop_field & 1) {
-                         gfxs->Aop[1] += gfxs->dst_field_offset - pitch;
-                         gfxs->Aop[2] += gfxs->dst_field_offset - pitch;
+                         gfxs->Aop[1] += gfxs->dst_field_offset;
+                         gfxs->Aop[2] += gfxs->dst_field_offset;
                     }
                     else {
-                         gfxs->Aop[1] -= gfxs->dst_field_offset;
-                         gfxs->Aop[2] -= gfxs->dst_field_offset;
+                         gfxs->Aop[1] += pitch - gfxs->dst_field_offset;
+                         gfxs->Aop[2] += pitch - gfxs->dst_field_offset;
                     }
                }
                else {
-                    gfxs->Aop[1] -= pitch;
-                    gfxs->Aop[2] -= pitch;
+                    gfxs->Aop[1] += pitch;
+                    gfxs->Aop[2] += pitch;
                }
           }
           else { /* NV16 */
@@ -10050,17 +10050,17 @@ static void Aop_prev( GenefxState *gfxs )
           else if (gfxs->dst_format == DSPF_YUV444P) {
                if (gfxs->dst_caps & DSCAPS_SEPARATED) {
                     if (gfxs->Aop_field & 1) {
-                         gfxs->Aop[1] += gfxs->dst_field_offset;
-                         gfxs->Aop[2] += gfxs->dst_field_offset;
+                         gfxs->Aop[1] += gfxs->dst_field_offset - pitch;
+                         gfxs->Aop[2] += gfxs->dst_field_offset - pitch;
                     }
                     else {
-                         gfxs->Aop[1] += pitch - gfxs->dst_field_offset;
-                         gfxs->Aop[2] += pitch - gfxs->dst_field_offset;
+                         gfxs->Aop[1] -= gfxs->dst_field_offset;
+                         gfxs->Aop[2] -= gfxs->dst_field_offset;
                     }
                }
                else {
-                    gfxs->Aop[1] += pitch;
-                    gfxs->Aop[2] += pitch;
+                    gfxs->Aop[1] -= pitch;
+                    gfxs->Aop[2] -= pitch;
                }
           }
           else { /* NV16 */
@@ -10185,17 +10185,17 @@ static void Bop_next( GenefxState *gfxs )
           else if (gfxs->src_format == DSPF_YUV444P) {
                if (gfxs->src_caps & DSCAPS_SEPARATED) {
                     if (gfxs->Bop_field & 1) {
-                         gfxs->Bop[1] += gfxs->src_field_offset - pitch;
-                         gfxs->Bop[2] += gfxs->src_field_offset - pitch;
+                         gfxs->Bop[1] += gfxs->src_field_offset;
+                         gfxs->Bop[2] += gfxs->src_field_offset;
                     }
                     else {
-                         gfxs->Bop[1] -= gfxs->src_field_offset;
-                         gfxs->Bop[2] -= gfxs->src_field_offset;
+                         gfxs->Bop[1] += pitch - gfxs->src_field_offset;
+                         gfxs->Bop[2] += pitch - gfxs->src_field_offset;
                     }
                }
                else {
-                    gfxs->Bop[1] -= pitch;
-                    gfxs->Bop[2] -= pitch;
+                    gfxs->Bop[1] += pitch;
+                    gfxs->Bop[2] += pitch;
                }
           }
           else { /* NV16 */
@@ -10264,17 +10264,17 @@ static void Bop_prev( GenefxState *gfxs )
           else if (gfxs->src_format == DSPF_YUV444P) {
                if (gfxs->src_caps & DSCAPS_SEPARATED) {
                     if (gfxs->Bop_field & 1) {
-                         gfxs->Bop[1] += gfxs->src_field_offset;
-                         gfxs->Bop[2] += gfxs->src_field_offset;
+                         gfxs->Bop[1] += gfxs->src_field_offset - pitch;
+                         gfxs->Bop[2] += gfxs->src_field_offset - pitch;
                     }
                     else {
-                         gfxs->Bop[1] += pitch - gfxs->src_field_offset;
-                         gfxs->Bop[2] += pitch - gfxs->src_field_offset;
+                         gfxs->Bop[1] -= gfxs->src_field_offset;
+                         gfxs->Bop[2] -= gfxs->src_field_offset;
                     }
                }
                else {
-                    gfxs->Bop[1] += pitch;
-                    gfxs->Bop[2] += pitch;
+                    gfxs->Bop[1] -= pitch;
+                    gfxs->Bop[2] -= pitch;
                }
           }
           else { /* NV16 */
-- 
1.6.3.3

>From e9e8b27e3d49182a87dbd3c469b6789b31ae487e Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Andr=C3=A9=20Draszik?= <andre.dras...@st.com>
Date: Mon, 5 Oct 2009 21:20:13 -0400
Subject: [PATCH 2/5] pixelformats: some DSPF_AYUV fixes
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Signed-off-by: André Draszik <andre.dras...@st.com>
---
 src/core/surface_buffer.c |    1 +
 src/gfx/convert.c         |   24 ++++++++++++++++++++++++
 src/gfx/convert.h         |    4 ++--
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/core/surface_buffer.c b/src/core/surface_buffer.c
index 63c63cc..a61760a 100644
--- a/src/core/surface_buffer.c
+++ b/src/core/surface_buffer.c
@@ -708,6 +708,7 @@ dfb_surface_buffer_dump( CoreSurfaceBuffer *buffer,
           case DSPF_ARGB4444:
           case DSPF_AiRGB:
           case DSPF_ARGB8565:
+          case DSPF_AYUV:
           case DSPF_AVYU:
                alpha = true;
 
diff --git a/src/gfx/convert.c b/src/gfx/convert.c
index b398275..8b257d3 100644
--- a/src/gfx/convert.c
+++ b/src/gfx/convert.c
@@ -1405,6 +1405,28 @@ dfb_convert_to_rgb24( DFBSurfacePixelFormat  format,
                     dst += dpitch;
                }
                break;
+          case DSPF_AYUV:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (n=0, n3=0; n<width; n++, n3+=3) {
+                         u32 y, cb, cr;
+                         y  = (src32[n] & 0xff0000) >> 16;
+                         cb = (src32[n] & 0x00ff00) >>  8;
+                         cr = (src32[n] & 0x0000ff) >>  0;
+#ifdef WORDS_BIGENDIAN
+                         YCBCR_TO_RGB (y, cb, cr,
+                                       dst[n3+0], dst[n3+1], dst[n3+2]);
+#else
+                         YCBCR_TO_RGB (y, cb, cr,
+                                       dst[n3+2], dst[n3+1], dst[n3+0]);
+#endif
+                    }
+
+                    src += spitch;
+                    dst += dpitch;
+               }
+               break;
           case DSPF_AVYU:
                while (height--) {
                     const u32 * __restrict src32 = src;
@@ -1580,6 +1602,7 @@ dfb_convert_to_a8( DFBSurfacePixelFormat  format,
                }
                break;
           case DSPF_ARGB:
+          case DSPF_AYUV:
           case DSPF_AVYU:
                while (height--) {
                     const u32 *src32 = src;
@@ -1771,6 +1794,7 @@ dfb_convert_to_a4( DFBSurfacePixelFormat  format,
                break;
 
           case DSPF_ARGB:
+          case DSPF_AYUV:
           case DSPF_AVYU:
                while (height--) {
                     const u32 *src32 = src;
diff --git a/src/gfx/convert.h b/src/gfx/convert.h
index 8404bd9..d0c8a83 100644
--- a/src/gfx/convert.h
+++ b/src/gfx/convert.h
@@ -455,8 +455,8 @@ dfb_color_to_argb( const DFBColor *color )
 static inline u32
 dfb_color_to_aycbcr( const DFBColor *color )
 {
-    u32 y,cb,cr;
-    RGB_TO_YCBCR( color->r, color->g, color->b, y, cb, cr );
+     u32 y, cb, cr;
+     RGB_TO_YCBCR( color->r, color->g, color->b, y, cb, cr );
 
      return (color->a << 24) | (y << 16) | (cb << 8) | cr;
 }
-- 
1.6.3.3

>From d9bd1870471fde88b6ab83fcf05212cd9a5db366 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Andr=C3=A9=20Draszik?= <andre.dras...@st.com>
Date: Sat, 14 Feb 2009 13:19:18 +0000
Subject: [PATCH 3/5] pixelformats: fixes for DSPF_AVYU and DSPF_VYU
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Signed-off-by: André Draszik <andre.dras...@st.com>
---
 src/gfx/convert.c         |  128 ++++++++++++++++++++++++++++++++++++++++-
 src/gfx/convert.h         |    2 +-
 src/gfx/generic/generic.c |  143 +++++++++++++++++++++++++++++++--------------
 src/misc/gfx_util.c       |    6 ++
 4 files changed, 233 insertions(+), 46 deletions(-)

diff --git a/src/gfx/convert.c b/src/gfx/convert.c
index 8b257d3..d65ad67 100644
--- a/src/gfx/convert.c
+++ b/src/gfx/convert.c
@@ -446,7 +446,6 @@ dfb_convert_to_rgb16( DFBSurfacePixelFormat  format,
                }
                break;
 
-
           case DSPF_VYU:
                while (height--) {
                     const u8 *src8 = src;
@@ -698,6 +697,44 @@ dfb_convert_to_rgb555( DFBSurfacePixelFormat  format,
                }
                break;
 
+          case DSPF_AVYU:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (x=0; x<width; x++) {
+                         int r, g, b;
+
+                         YCBCR_TO_RGB( (src32[x] >> 8) & 0xff, src32[x] & 0xff, (src32[x] >> 16) & 0xff, r, g, b );
+
+                         dst[x] = PIXEL_RGB555( r, g, b );
+                    }
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
+          case DSPF_VYU:
+               while (height--) {
+                    const u8 *src8 = src;
+
+                    for (x=0; x<width; x++) {
+                         int r, g, b;
+
+#ifdef WORDS_BIGENDIAN
+                         YCBCR_TO_RGB( src8[x*3+1], src8[x*3+2], src8[x*3], r, g, b );
+#else
+                         YCBCR_TO_RGB( src8[x*3+1], src8[x*3], src8[x*3+2], r, g, b );
+#endif
+
+                         dst[x] = PIXEL_RGB555( r, g, b );
+                    }
+
+                    src += spitch;
+                    dst += dp2;
+               }
+               break;
+
           default:
                D_ONCE( "unsupported format" );
      }
@@ -908,6 +945,44 @@ dfb_convert_to_rgb32( DFBSurfacePixelFormat  format,
                }
                break;
 
+          case DSPF_AVYU:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (x=0; x<width; x++) {
+                         int r, g, b;
+
+                         YCBCR_TO_RGB( (src32[x] >> 8) & 0xff, src32[x] & 0xff, (src32[x] >> 16) & 0xff, r, g, b );
+
+                         dst[x] = PIXEL_RGB32( r, g, b );
+                    }
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_VYU:
+               while (height--) {
+                    const u8 *src8 = src;
+
+                    for (x=0; x<width; x++) {
+                         int r, g, b;
+
+#ifdef WORDS_BIGENDIAN
+                         YCBCR_TO_RGB( src8[x*3+1], src8[x*3+2], src8[x*3], r, g, b );
+#else
+                         YCBCR_TO_RGB( src8[x*3+1], src8[x*3], src8[x*3+2], r, g, b );
+#endif
+
+                         dst[x] = PIXEL_RGB32( r, g, b );
+                    }
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
           default:
                D_ONCE( "unsupported format" );
      }
@@ -1161,6 +1236,44 @@ dfb_convert_to_argb( DFBSurfacePixelFormat  format,
                }
                break;
 
+          case DSPF_AVYU:
+               while (height--) {
+                    const u32 *src32 = src;
+
+                    for (x=0; x<width; x++) {
+                         int r, g, b;
+
+                         YCBCR_TO_RGB( (src32[x] >> 8) & 0xff, src32[x] & 0xff, (src32[x] >> 16) & 0xff, r, g, b );
+
+                         dst[x] = PIXEL_ARGB( (src32[x] >> 24), r, g, b );
+                    }
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
+          case DSPF_VYU:
+               while (height--) {
+                    const u8 *src8 = src;
+
+                    for (x=0; x<width; x++) {
+                         int r, g, b;
+
+#ifdef WORDS_BIGENDIAN
+                         YCBCR_TO_RGB( src8[x*3+1], src8[x*3+2], src8[x*3], r, g, b );
+#else
+                         YCBCR_TO_RGB( src8[x*3+1], src8[x*3], src8[x*3+2], r, g, b );
+#endif
+
+                         dst[x] = PIXEL_ARGB( 0xff, r, g, b );
+                    }
+
+                    src += spitch;
+                    dst += dp4;
+               }
+               break;
+
           default:
                D_ONCE( "unsupported format" );
      }
@@ -1436,8 +1549,13 @@ dfb_convert_to_rgb24( DFBSurfacePixelFormat  format,
                          cr = (src32[n] & 0xff0000) >> 16;
                          y  = (src32[n] & 0x00ff00) >>  8;
                          cb = (src32[n] & 0x0000ff) >>  0;
+#ifdef WORDS_BIGENDIAN
                          YCBCR_TO_RGB (y, cb, cr,
                                        dst[n3+0], dst[n3+1], dst[n3+2]);
+#else
+                         YCBCR_TO_RGB (y, cb, cr,
+                                       dst[n3+2], dst[n3+1], dst[n3+0]);
+#endif
                     }
 
                     src += spitch;
@@ -1450,11 +1568,19 @@ dfb_convert_to_rgb24( DFBSurfacePixelFormat  format,
 
                     for (n=0, n3=0; n<width; n++, n3+=3) {
                          register u32 y, cb, cr;
+#ifdef WORDS_BIGENDIAN
                          cr = src8[n3+0];
                          y  = src8[n3+1];
                          cb = src8[n3+2];
                          YCBCR_TO_RGB (y, cb, cr,
                                        dst[n3+0], dst[n3+1], dst[n3+2]);
+#else
+                         cr = src8[n3+2];
+                         y  = src8[n3+1];
+                         cb = src8[n3+0];
+                         YCBCR_TO_RGB (y, cb, cr,
+                                       dst[n3+2], dst[n3+1], dst[n3+0]);
+#endif
                     }
 
                     src += spitch;
diff --git a/src/gfx/convert.h b/src/gfx/convert.h
index d0c8a83..80bab0d 100644
--- a/src/gfx/convert.h
+++ b/src/gfx/convert.h
@@ -464,7 +464,7 @@ dfb_color_to_aycbcr( const DFBColor *color )
 static inline u32
 dfb_color_to_acrycb( const DFBColor *color )
 {
-     u32 y,cb,cr;
+     u32 y, cb, cr;
      RGB_TO_YCBCR( color->r, color->g, color->b, y, cb, cr );
 
      return (color->a << 24) | (cr << 16) | (y << 8) | cb;
diff --git a/src/gfx/generic/generic.c b/src/gfx/generic/generic.c
index b389821..b2ff93e 100644
--- a/src/gfx/generic/generic.c
+++ b/src/gfx/generic/generic.c
@@ -470,16 +470,21 @@ static void Cop_to_Aop_24( GenefxState *gfxs )
 
 static void Cop_to_Aop_vyu( GenefxState *gfxs )
 {
-     int   w  = gfxs->length;
+     int   w  = gfxs->length + 1;
      u8   *D  = gfxs->Aop[0];
 
-     while (w) {
+     while (--w) {
+#ifdef BIG_ENDIAN
           D[0] = gfxs->CrCop;
           D[1] = gfxs->YCop;
           D[2] = gfxs->CbCop;
+#else
+          D[0] = gfxs->CbCop;
+          D[1] = gfxs->YCop;
+          D[2] = gfxs->CrCop;
+#endif
 
           D += 3;
-          --w;
      }
 }
 
@@ -766,12 +771,12 @@ static void Cop_toK_Aop_yuv444p( GenefxState *gfxs )
 
 static void Cop_toK_Aop_avyu( GenefxState *gfxs )
 {
-     int l = gfxs->length;
+     int l = gfxs->length + 1;
      u32 *D = gfxs->Aop[0];
      u32 Dkey = gfxs->Dkey;
      u32 Cop = gfxs->Cop;
 
-     while (l--) {
+     while (--l) {
           if ((*D & 0x00ffffff) == Dkey)
                *D = Cop;
 
@@ -1689,7 +1694,7 @@ static void Bop_vyu_KtoK_Aop( GenefxState *gfxs )
           u32 d = D[0] << 16 | D[1] << 8 | D[2];
 #else
           u32 s = S[2] << 16 | S[1] << 8 | S[0];
-          u32 d = S[2] << 16 | D[1] << 8 | D[0];
+          u32 d = D[2] << 16 | D[1] << 8 | D[0];
 #endif
 
           if (Skey != s && Dkey == d) {
@@ -3031,14 +3036,14 @@ static void Sop_yuv444p_Sto_Dacc( GenefxState *gfxs )
 
 static void Sop_avyu_Sto_Dacc( GenefxState *gfxs )
 {
-     int w     = gfxs->length;
+     int w     = gfxs->length + 1;
      int i     = gfxs->Xphase;
      int SperD = gfxs->SperD;
 
      GenefxAccumulator *D = gfxs->Dacc;
      u32               *S = gfxs->Sop[0];
 
-     while (w--) {
+     while (--w) {
           u32 s = S[i>>16];
 
           D->YUV.a = (s >> 24);
@@ -3588,14 +3593,14 @@ static void Sop_yuv444p_SKto_Dacc( GenefxState *gfxs )
 
 static void Sop_avyu_SKto_Dacc( GenefxState *gfxs )
 {
-     int l = gfxs->length;
+     int l = gfxs->length + 1;
      int i = gfxs->Xphase;
      int SperD = gfxs->SperD;
      u32 *S = gfxs->Sop[0];
      GenefxAccumulator *D = gfxs->Dacc;
      u32 Skey = gfxs->Skey;
 
-     while (l--) {
+     while (--l) {
           u32 s = S[i>>16];
 
           if ((s & 0x00ffffff) != Skey) {
@@ -3640,9 +3645,9 @@ static void Sop_vyu_SKto_Dacc( GenefxState *gfxs )
                D->YUV.u = S[pixelstart+2];
 #else
                D->YUV.a = 0xff;
-               D->YUV.u = S[pixelstart+2];
+               D->YUV.v = S[pixelstart+2];
                D->YUV.y = S[pixelstart+1];
-               D->YUV.v = S[pixelstart+0];
+               D->YUV.u = S[pixelstart+0];
 #endif
           }
           else
@@ -4079,11 +4084,11 @@ static void Sop_yuv444p_to_Dacc( GenefxState *gfxs )
 
 static void Sop_avyu_to_Dacc( GenefxState *gfxs )
 {
-     int                w = gfxs->length;
+     int                w = gfxs->length + 1;
      GenefxAccumulator *D = gfxs->Dacc;
      u32               *S = gfxs->Sop[0];
 
-     while (w--) {
+     while (--w) {
           u32 s = *S++;
 
           D->YUV.a = (s >> 24);
@@ -4097,16 +4102,23 @@ static void Sop_avyu_to_Dacc( GenefxState *gfxs )
 
 static void Sop_vyu_to_Dacc( GenefxState *gfxs )
 {
-     int                w = gfxs->length;
-
+     int                w = gfxs->length + 1;
      GenefxAccumulator *D = gfxs->Dacc;
      const u8          *S = gfxs->Sop[0];
 
-     while (w--) {
+     while (--w) {
+
+#ifdef WORDS_BIGENDIAN
           D->YUV.a = 0xff;
           D->YUV.v = S[0];
           D->YUV.y = S[1];
           D->YUV.u = S[2];
+#else
+          D->YUV.a = 0xff;
+          D->YUV.v = S[2];
+          D->YUV.y = S[1];
+          D->YUV.u = S[0];
+#endif
 
           S += 3;
           D++;
@@ -4589,12 +4601,12 @@ static void Sop_yuv444p_Kto_Dacc( GenefxState *gfxs )
 
 static void Sop_avyu_Kto_Dacc( GenefxState *gfxs )
 {
-     int l = gfxs->length;
+     int l = gfxs->length + 1;
      u32 *S = gfxs->Sop[0];
      GenefxAccumulator *D = gfxs->Dacc;
      u32 Skey = gfxs->Skey;
 
-     while (l--) {
+     while (--l) {
           u32 s = *S++;
 
           if ((s & 0x00ffffff) != Skey) {
@@ -4754,7 +4766,7 @@ static void Sacc_to_Aop_rgb18( GenefxState *gfxs )
 
 static void Sacc_to_Aop_argb8565( GenefxState *gfxs )
 {
-     int                w    = gfxs->length + 1;
+     int                w = gfxs->length + 1;
      GenefxAccumulator *S = gfxs->Sacc;
      u8                *D = gfxs->Aop[0];
 
@@ -5168,11 +5180,11 @@ static void Sacc_to_Aop_ayuv( GenefxState *gfxs )
 
 static void Sacc_to_Aop_avyu( GenefxState *gfxs )
 {
-     int                w = gfxs->length;
+     int                w = gfxs->length + 1;
      GenefxAccumulator *S = gfxs->Sacc;
      u32               *D = gfxs->Aop[0];
 
-     while (w--) {
+     while (--w) {
           if (!(S->YUV.a & 0xF000)) {
                *D = PIXEL_AVYU( (S->YUV.a & 0xFF00) ? 0xFF : S->YUV.a,
                                 (S->YUV.y & 0xFF00) ? 0xFF : S->YUV.y,
@@ -5245,9 +5257,15 @@ static void Sacc_to_Aop_vyu( GenefxState *gfxs )
                u8 u = (S->YUV.u & 0xFF00) ? 0xFF : S->YUV.u;
                u8 v = (S->YUV.v & 0xFF00) ? 0xFF : S->YUV.v;
 
+#ifdef WORDS_BIGENDIAN
                D[0] = v;
                D[1] = y;
                D[2] = u;
+#else
+               D[0] = u;
+               D[1] = y;
+               D[2] = v;
+#endif
           }
 
           D += 3;
@@ -5877,13 +5895,13 @@ static void Sacc_Sto_Aop_yuv444p( GenefxState *gfxs )
 
 static void Sacc_Sto_Aop_avyu( GenefxState *gfxs )
 {
-     int                w     = gfxs->length;
+     int                w     = gfxs->length + 1;
      int                i     = gfxs->Xphase;
      GenefxAccumulator *Sacc  = gfxs->Sacc;
      u32               *D     = gfxs->Aop[0];
      int                SperD = gfxs->SperD;
 
-     while (w--) {
+     while (--w) {
           GenefxAccumulator *S = &Sacc[i>>16];
 
           if (!(S->YUV.a & 0xF000)) {
@@ -5910,13 +5928,19 @@ static void Sacc_Sto_Aop_vyu( GenefxState *gfxs )
           GenefxAccumulator *S = &Sacc[i>>16];
 
           if (!(S->YUV.a & 0xF000)) {
-               u32 pixel = PIXEL_VYU( (S->YUV.y & 0xFF00) ? 0xFF : S->YUV.y,
-                                      (S->YUV.u & 0xFF00) ? 0xFF : S->YUV.u,
-                                      (S->YUV.v & 0xFF00) ? 0xFF : S->YUV.v );
+               u8 y = (S->YUV.y & 0xFF00) ? 0xFF : S->YUV.y;
+               u8 u = (S->YUV.u & 0xFF00) ? 0xFF : S->YUV.u;
+               u8 v = (S->YUV.v & 0xFF00) ? 0xFF : S->YUV.v;
 
-               D[0] = (pixel >> 16) & 0xff;
-               D[1] = (pixel >>  8) & 0xff;
-               D[2] = (pixel >>  0) & 0xff;
+#ifdef BIG_ENDIAN
+               D[0] = v;
+               D[1] = y;
+               D[2] = u;
+#else
+               D[0] = u;
+               D[1] = y;
+               D[2] = v;
+#endif
           }
 
           D += 3;
@@ -6370,13 +6394,19 @@ static void Sacc_toK_Aop_vyu( GenefxState *gfxs )
 #endif
 
           if (!(S->YUV.a & 0xF000) && Dkey == d) {
-               u32 pixel = PIXEL_VYU( (S->YUV.y & 0xFF00) ? 0xFF : S->YUV.y,
-                                      (S->YUV.u & 0xFF00) ? 0xFF : S->YUV.u,
-                                      (S->YUV.v & 0xFF00) ? 0xFF : S->YUV.v );
+               u8 y = (S->YUV.y & 0xFF00) ? 0xFF : S->YUV.y;
+               u8 u = (S->YUV.u & 0xFF00) ? 0xFF : S->YUV.u;
+               u8 v = (S->YUV.v & 0xFF00) ? 0xFF : S->YUV.v;
 
-               D[0] = (pixel >> 16) & 0xff;
-               D[1] = (pixel >>  8) & 0xff;
-               D[2] = (pixel >>  0) & 0xff;
+#ifdef WORDS_BIGENDIAN
+               D[0] = v;
+               D[1] = y;
+               D[2] = u;
+#else
+               D[0] = u;
+               D[1] = y;
+               D[2] = v;
+#endif
           }
 
           D += 3;
@@ -6495,14 +6525,14 @@ static void Sacc_StoK_Aop_yuv444p( GenefxState *gfxs )
 
 static void Sacc_StoK_Aop_avyu( GenefxState *gfxs )
 {
-     int l = gfxs->length;
+     int l = gfxs->length + 1;
      int i = gfxs->Xphase;
      int SperD = gfxs->SperD;
      GenefxAccumulator *Sacc = gfxs->Sacc;
      u32 *D = gfxs->Aop[0];
      u32 Dkey = gfxs->Dkey;
 
-     while (l--) {
+     while (--l) {
           GenefxAccumulator *S = &Sacc[i>>16];
 
           if (!(S->YUV.a & 0xF000) && (*D & 0x00ffffff) == Dkey)
@@ -6535,13 +6565,19 @@ static void Sacc_StoK_Aop_vyu( GenefxState *gfxs )
 #endif
 
           if (!(S->YUV.a & 0xF000) && Dkey == d) {
-               u32 pixel = PIXEL_VYU( (S->YUV.y & 0xFF00) ? 0xFF : S->YUV.y,
-                                      (S->YUV.u & 0xFF00) ? 0xFF : S->YUV.u,
-                                      (S->YUV.v & 0xFF00) ? 0xFF : S->YUV.v );
+               u8 y = (S->YUV.y & 0xFF00) ? 0xFF : S->YUV.y;
+               u8 u = (S->YUV.u & 0xFF00) ? 0xFF : S->YUV.u;
+               u8 v = (S->YUV.v & 0xFF00) ? 0xFF : S->YUV.v;
 
-               D[0] = (pixel >> 16) & 0xff;
-               D[1] = (pixel >>  8) & 0xff;
-               D[2] = (pixel >>  0) & 0xff;
+#ifdef WORDS_BIGENDIAN
+               D[0] = v;
+               D[1] = y;
+               D[2] = u;
+#else
+               D[0] = u;
+               D[1] = y;
+               D[2] = v;
+#endif
           }
 
           D += 3;
@@ -6911,6 +6947,8 @@ static void Bop_a8_set_alphapixel_Aop_vyu( GenefxState *gfxs )
      u8   CbCop = gfxs->CbCop;
      u8   CrCop = gfxs->CrCop;
 
+#ifdef WORDS_BIGENDIAN
+
 #define SET_PIXEL(d,y,cb,cr,a)\
      switch (a) {\
          case 0xff:\
@@ -6925,6 +6963,23 @@ static void Bop_a8_set_alphapixel_Aop_vyu( GenefxState *gfxs )
                d[2] = ((cb-d[2]) * s + (d[2] << 8)) >> 8;\
           }\
      }
+#else
+
+#define SET_PIXEL(d,y,cb,cr,a)\
+     switch (a) {\
+         case 0xff:\
+               d[0] = cb;\
+               d[1] = y;\
+               d[2] = cr;\
+          case 0: break;\
+          default: {\
+               register u16 s = a+1;\
+               d[0] = ((cb-d[0]) * s + (d[0] << 8)) >> 8;\
+               d[1] = ((y-d[1]) * s + (d[1] << 8)) >> 8;\
+               d[2] = ((cr-d[2]) * s + (d[2] << 8)) >> 8;\
+          }\
+     }
+#endif
 
      while (w>4) {
           SET_PIXEL( D, YCop, CbCop, CrCop, *S ); D+=3; S++;
diff --git a/src/misc/gfx_util.c b/src/misc/gfx_util.c
index 0c2d415..d51951b 100644
--- a/src/misc/gfx_util.c
+++ b/src/misc/gfx_util.c
@@ -385,9 +385,15 @@ static void write_argb_span (u32 *src, u8 *dst[], int len,
                                   (src[i] >>  8) & 0xff,
                                   (src[i]      ) & 0xff, y, u, v );
 
+#ifdef WORDS_BIGENDIAN
                     d[++j] = v;
                     d[++j] = y;
                     d[++j] = u;
+#else
+                    d[++j] = u;
+                    d[++j] = y;
+                    d[++j] = v;
+#endif
                }
                break;
 
-- 
1.6.3.3

>From 2670d0d6304ed855b54437d06b57da1df9ccb829 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Andr=C3=A9=20Draszik?= <andre.dras...@st.com>
Date: Sat, 28 Nov 2009 18:49:47 +0000
Subject: [PATCH 4/5] generic: Fixed Bop_PFI_StoK_Aop_PFI
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

followup on commit fc5d3705b4c9e1b3a61607d2b662d28b1c25b4b7 for
the remaining pixelformats

Signed-off-by: André Draszik <andre.dras...@st.com>
---
 src/gfx/generic/generic.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gfx/generic/generic.c b/src/gfx/generic/generic.c
index b2ff93e..bf93185 100644
--- a/src/gfx/generic/generic.c
+++ b/src/gfx/generic/generic.c
@@ -2362,7 +2362,7 @@ static void Bop_argb8565_StoK_Aop( GenefxState *gfxs )
           u32 d = D[1] << 8 | D[0];
 #endif
 
-          if (Dkey != d) {
+          if (Dkey == d) {
                D[0] = S[pixelstart+0];
                D[1] = S[pixelstart+1];
                D[2] = S[pixelstart+2];
@@ -2391,7 +2391,7 @@ static void Bop_yuv444p_StoK_Aop( GenefxState *gfxs )
           u8 du = *Du;
           u8 dv = *Dv;
 
-          if (Dkey != (u32)(dy<<16 | du<<8 | dv)) {
+          if (Dkey == (u32)(dy<<16 | du<<8 | dv)) {
                u8 sy = Sy[i>>16];
                u8 su = Su[i>>16];
                u8 sv = Sv[i>>16];
@@ -2424,7 +2424,7 @@ static void Bop_vyu_StoK_Aop( GenefxState *gfxs )
           u32 d = D[2] << 16 | D[1] << 8 | D[0];
 #endif
 
-          if (Dkey != d) {
+          if (Dkey == d) {
                D[0] = S[pixelstart+0];
                D[1] = S[pixelstart+1];
                D[2] = S[pixelstart+2];
-- 
1.6.3.3

_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to