]> git.sesse.net Git - mlt/commitdiff
Resize fix for chroma offsets
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 31 Dec 2004 08:18:20 +0000 (08:18 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 31 Dec 2004 08:18:20 +0000 (08:18 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@588 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_frame.c

index d8d3c8ae1bdd2ad7cfa5db841ffa5f0e83aba8a1..5a866272b99b166214446298d16e81995e0bfb35 100644 (file)
@@ -681,7 +681,7 @@ void mlt_resize_yuv422( uint8_t *output, int owidth, int oheight, uint8_t *input
        uint8_t *out_ptr = out_line;
 
        // Calculate a middle and possibly invalid pointer in the input
-       uint8_t *in_middle = input + istride * ( iheight / 2 ) + ( iwidth / 2 ) * 2;
+       uint8_t *in_middle = input + istride * ( iheight / 2 ) + iwidth;
        int in_line = - in_y_range * istride - in_x_range * 2;
 
        int elements;
@@ -697,10 +697,18 @@ void mlt_resize_yuv422( uint8_t *output, int owidth, int oheight, uint8_t *input
        }
 
        int active_width = 2 * iwidth;
-       int inactive_width = out_x_range - in_x_range;
+       int left_inactive_width = out_x_range - in_x_range;
+       int right_inactive_width = left_inactive_width;
        uint8_t *p = NULL;
        uint8_t *end = NULL;
 
+       if ( in_line % 4 )
+       {
+               active_width -= 2;
+               in_middle += 2;
+               right_inactive_width += 2;
+       }
+
        // Loop for the entirety of our output height.
        while ( iheight -- )
        {
@@ -708,7 +716,7 @@ void mlt_resize_yuv422( uint8_t *output, int owidth, int oheight, uint8_t *input
                out_ptr = out_line;
 
                // Fill the outer part with black
-               elements = inactive_width;
+               elements = left_inactive_width;
                while ( elements -- )
                {
                        *out_ptr ++ = 16;
@@ -725,7 +733,7 @@ void mlt_resize_yuv422( uint8_t *output, int owidth, int oheight, uint8_t *input
                }
 
                // Fill the outer part with black
-               elements = inactive_width;
+               elements = right_inactive_width;
                while ( elements -- )
                {
                        *out_ptr ++ = 16;