On Sunday 04 March 2007 21:20, Mark Adams wrote:
> > unichrome driver has a bug when source and destination surface are not
> > of the same size and when only a section of the source surface should be
> > blitted to the destination surface.
> 
> 
> OK, I understand what you're saying now.  Yes, there's a bug: it's using the
> source rectangle height to find the U and V planes rather than the source
> and destination surface heights.  So I guess it goes wrong any time you set
> a source rectangle for a YV12/I420 blit that doesn't include the full height
> of the surface.
> 
> Shame we've missed 1.0...

Here is my first suggestion to fix it.
Just looked at those places where [src|dst]_offset are set and kept
a copy of [src|dst]_height.

Passed a short test with hw-decoding.
Video is scaled correct and colors are _not_ messed up.

-- 
Stefan Lucke
Index: uc_accel.c
===================================================================
RCS file: /cvs/directfb/DirectFB/gfxdrivers/unichrome/uc_accel.c,v
retrieving revision 1.6
diff -U 3 -r1.6 uc_accel.c
--- uc_accel.c  2 Jan 2007 17:46:19 -0000       1.6
+++ uc_accel.c  6 Mar 2007 22:42:09 -0000
@@ -258,8 +258,8 @@
 {
     UC_ACCEL_BEGIN()
 
-    int uv_dst_offset = ucdev->dst_offset + (ucdev->dst_pitch * rect->h);
-    int uv_src_offset = ucdev->src_offset + (ucdev->src_pitch * rect->h);
+    int uv_dst_offset = ucdev->dst_offset + (ucdev->dst_pitch * 
ucdev->dst_height);
+    int uv_src_offset = ucdev->src_offset + (ucdev->src_pitch * 
ucdev->src_height);
     
     int uv_dst_pitch = ucdev->dst_pitch / 2;
     int uv_src_pitch = ucdev->src_pitch / 2;
@@ -292,8 +292,8 @@
     
     // now for the second chrominance plane
     
-    uv_src_offset += uv_src_pitch * rect2.h;
-    uv_dst_offset += uv_dst_pitch * rect2.h;
+    uv_src_offset += uv_src_pitch * ucdev->src_height/2;
+    uv_dst_offset += uv_dst_pitch * ucdev->dst_height/2;
     
     UC_FIFO_PREPARE ( fifo, 6 );
     UC_FIFO_ADD_HDR( fifo, HC_ParaType_NotTex << 16 );
Index: uc_hwset.c
===================================================================
RCS file: /cvs/directfb/DirectFB/gfxdrivers/unichrome/uc_hwset.c,v
retrieving revision 1.6
diff -U 3 -r1.6 uc_hwset.c
--- uc_hwset.c  2 Jan 2007 17:45:58 -0000       1.6
+++ uc_hwset.c  6 Mar 2007 22:42:09 -0000
@@ -161,6 +161,7 @@
      int                    dst_bpp     = DFB_BYTES_PER_PIXEL( dst_format );
 
 
+     ucdev->dst_height = destination->height;
      /* Save FIFO space and CPU cycles. */
      if (ucdev->dst_format == dst_format &&
          ucdev->dst_offset == dst_offset &&
@@ -223,6 +224,7 @@
      
      ucdev->src_offset = buffer->video.offset;
      ucdev->src_pitch = buffer->video.pitch;
+     ucdev->src_height = state->source->height;
 
      UC_VALIDATE( uc_source2d );
 }
@@ -244,7 +246,7 @@
      if (UC_IS_VALID( uc_source3d ))
           return;
 
-     src_height = source->height;
+     ucdev->src_height = src_height = source->height;
      src_offset = buffer->video.offset;
      src_pitch  = buffer->video.pitch;
 
Index: unichrome.h
===================================================================
RCS file: /cvs/directfb/DirectFB/gfxdrivers/unichrome/unichrome.h,v
retrieving revision 1.6
diff -U 3 -r1.6 unichrome.h
--- unichrome.h 1 Feb 2007 18:42:44 -0000       1.6
+++ unichrome.h 6 Mar 2007 22:42:10 -0000
@@ -108,8 +108,10 @@
      DFBSurfacePixelFormat   dst_format; // destination pixel format
      int                     dst_offset; // destination buffer byte offset
      int                     dst_pitch;  // destination buffer byte pitch
+     int                     dst_height;
      int                     src_offset; // source buffer byte offset
      int                     src_pitch;  // source buffer byte pitch
+     int                     src_height;
 
      int                     field;      // source field
 
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to