X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fcore%2Fproducer_colour.c;h=9f504f767c81aad8fd96811e705f2857929ee333;hb=2a04e5dceebd174e24be42da8643a815640db27d;hp=75e7aa920790272b9689cc1e1692b2c2feb61e08;hpb=eccf04749681f70957f34fdd6742224774e72d15;p=melted diff --git a/src/modules/core/producer_colour.c b/src/modules/core/producer_colour.c index 75e7aa9..9f504f7 100644 --- a/src/modules/core/producer_colour.c +++ b/src/modules/core/producer_colour.c @@ -50,6 +50,7 @@ mlt_producer producer_colour_init( char *colour ) // Set the default properties mlt_properties_set( properties, "resource", colour == NULL ? "0x000000ff" : colour ); mlt_properties_set( properties, "_resource", "" ); + mlt_properties_set_double( properties, "aspect_ratio", 0 ); return producer; } @@ -135,7 +136,11 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form { // Color the image uint8_t y, u, v; - int i = 0; + int i = *height; + int j = 0; + int uneven = *width % 2; + int count = ( *width - uneven ) / 2; + uint8_t *p = NULL; // Allocate the image size = *width * *height * 2; @@ -149,12 +154,23 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form RGB2YUV( color.r, color.g, color.b, y, u, v ); - while ( i < size ) + p = image; + + while ( i -- ) { - image[ i ++ ] = y; - image[ i ++ ] = u; - image[ i ++ ] = y; - image[ i ++ ] = v; + j = count; + while ( j -- ) + { + *p ++ = y; + *p ++ = u; + *p ++ = y; + *p ++ = v; + } + if ( uneven ) + { + *p ++ = y; + *p ++ = u; + } } } @@ -212,7 +228,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i // Set producer-specific frame properties mlt_properties_set_int( properties, "progressive", 1 ); - mlt_properties_set_double( properties, "aspect_ratio", 0 ); + mlt_properties_set_double( properties, "aspect_ratio", mlt_properties_get_double( producer_props, "aspect_ratio" ) ); // colour is an alias for resource if ( mlt_properties_get( producer_props, "colour" ) != NULL )