[XviD-devel] image_output yv12_to_yv12

Milan Cutka xvid-devel@xvid.org
Tue, 17 Dec 2002 08:28:25 +0100


Hi,

yesterday I've updated colorspace conversion routines in ffdshow. I
was using old xvid functions, but now I needed src_width!=src_stride
in image_input. I've noticed that when converting to YV12 colorspace,
image was distorted (I had this problem with latest XviD DirectShow
filters too). This patch seems to solve it:

--- image_1.20.2.11_1.c 2002-12-17 08:20:43.000000000 +0100
+++ image.c     2002-12-17 08:19:09.000000000 +0100
@@ -881,8 +881,8 @@
                return 0;
 
        case XVID_CSP_YV12:             // u,v swapped
-               yv12_to_yv12(dst, dst + width*height, dst + width*height + width2*height2,
-                       width, width2,
+               yv12_to_yv12(dst, dst + dst_stride*height, dst + dst_stride*height + (dst_stride>>1)*height2,
+                       dst_stride, dst_stride>>1,
                        image->y, image->v, image->u, edged_width, edged_width2,
                        width, height, (csp & XVID_CSP_VFLIP));
                return 0;

Maybe other conversions should be checked too.

   Milan