From 6d3859319652988fd5da6fe8aa6dab79804926dd Mon Sep 17 00:00:00 2001 From: lilo_booter Date: Fri, 31 Dec 2004 08:18:20 +0000 Subject: [PATCH] Resize fix for chroma offsets git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@588 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/framework/mlt_frame.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index d8d3c8a..5a86627 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -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; -- 1.7.4.4