X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fframework%2Fmlt_frame.c;h=52de88d9ea40757ab28e936f3dcfb1ccfdaed079;hb=40b169c095486ba1b868486eb98a47c41f36ce8c;hp=03a5e22d69cfa084459f5ced85ef0b206f2563c8;hpb=bf3264b9e340ba5c11cbf59835a8af3db94e0cc2;p=melted diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index 03a5e22..52de88d 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -22,6 +22,8 @@ #include "mlt_frame.h" #include "mlt_producer.h" #include "mlt_factory.h" +#include "mlt_profile.h" + #include #include #include @@ -37,9 +39,6 @@ mlt_frame mlt_frame_init( ) if ( this != NULL ) { - // Get the normalisation - char *normalisation = mlt_environment( "MLT_NORMALISATION" ); - // Initialise the properties mlt_properties properties = &this->parent; mlt_properties_init( properties, this ); @@ -47,24 +46,11 @@ mlt_frame mlt_frame_init( ) // Set default properties on the frame mlt_properties_set_position( properties, "_position", 0.0 ); mlt_properties_set_data( properties, "image", NULL, 0, NULL, NULL ); - - if ( normalisation == NULL || strcmp( normalisation, "NTSC" ) ) - { - mlt_properties_set_int( properties, "width", 720 ); - mlt_properties_set_int( properties, "height", 576 ); - mlt_properties_set_int( properties, "normalised_width", 720 ); - mlt_properties_set_int( properties, "normalised_height", 576 ); - mlt_properties_set_double( properties, "aspect_ratio", 59.0/54.0 ); - } - else - { - mlt_properties_set_int( properties, "width", 720 ); - mlt_properties_set_int( properties, "height", 480 ); - mlt_properties_set_int( properties, "normalised_width", 720 ); - mlt_properties_set_int( properties, "normalised_height", 480 ); - mlt_properties_set_double( properties, "aspect_ratio", 10.0/11.0 ); - } - + mlt_properties_set_int( properties, "width", mlt_profile_get()->width ); + mlt_properties_set_int( properties, "height", mlt_profile_get()->height ); + mlt_properties_set_int( properties, "normalised_width", mlt_profile_get()->width ); + mlt_properties_set_int( properties, "normalised_height", mlt_profile_get()->height ); + mlt_properties_set_double( properties, "aspect_ratio", mlt_profile_sar( NULL ) ); mlt_properties_set_data( properties, "audio", NULL, 0, NULL, NULL ); mlt_properties_set_data( properties, "alpha", NULL, 0, NULL, NULL ); @@ -565,6 +551,7 @@ int mlt_convert_rgb24a_to_yuv422( uint8_t *rgba, int width, int height, int stri register uint8_t *d = yuv; register int i, j; + if ( alpha ) for ( i = 0; i < height; i++ ) { register uint8_t *s = rgba + ( stride * i ); @@ -596,6 +583,39 @@ int mlt_convert_rgb24a_to_yuv422( uint8_t *rgba, int width, int height, int stri *d++ = u0; } } + else + for ( i = 0; i < height; i++ ) + { + register uint8_t *s = rgba + ( stride * i ); + for ( j = 0; j < ( width / 2 ); j++ ) + { + r = *s++; + g = *s++; + b = *s++; + s++; + RGB2YUV (r, g, b, y0, u0 , v0); + r = *s++; + g = *s++; + b = *s++; + s++; + RGB2YUV (r, g, b, y1, u1 , v1); + *d++ = y0; + *d++ = (u0+u1) >> 1; + *d++ = y1; + *d++ = (v0+v1) >> 1; + } + if ( width % 2 ) + { + r = *s++; + g = *s++; + b = *s++; + s++; + RGB2YUV (r, g, b, y0, u0 , v0); + *d++ = y0; + *d++ = u0; + } + } + return ret; } @@ -646,6 +666,7 @@ int mlt_convert_bgr24a_to_yuv422( uint8_t *rgba, int width, int height, int stri register uint8_t *d = yuv; register int i, j; + if ( alpha ) for ( i = 0; i < height; i++ ) { register uint8_t *s = rgba + ( stride * i ); @@ -677,6 +698,38 @@ int mlt_convert_bgr24a_to_yuv422( uint8_t *rgba, int width, int height, int stri *d++ = u0; } } + else + for ( i = 0; i < height; i++ ) + { + register uint8_t *s = rgba + ( stride * i ); + for ( j = 0; j < ( width / 2 ); j++ ) + { + b = *s++; + g = *s++; + r = *s++; + s++; + RGB2YUV (r, g, b, y0, u0 , v0); + b = *s++; + g = *s++; + r = *s++; + s++; + RGB2YUV (r, g, b, y1, u1 , v1); + *d++ = y0; + *d++ = (u0+u1) >> 1; + *d++ = y1; + *d++ = (v0+v1) >> 1; + } + if ( width % 2 ) + { + b = *s++; + g = *s++; + r = *s++; + s++; + RGB2YUV (r, g, b, y0, u0 , v0); + *d++ = y0; + *d++ = u0; + } + } return ret; } @@ -727,6 +780,7 @@ int mlt_convert_argb_to_yuv422( uint8_t *rgba, int width, int height, int stride register uint8_t *d = yuv; register int i, j; + if ( alpha ) for ( i = 0; i < height; i++ ) { register uint8_t *s = rgba + ( stride * i ); @@ -758,6 +812,38 @@ int mlt_convert_argb_to_yuv422( uint8_t *rgba, int width, int height, int stride *d++ = u0; } } + else + for ( i = 0; i < height; i++ ) + { + register uint8_t *s = rgba + ( stride * i ); + for ( j = 0; j < ( width / 2 ); j++ ) + { + s++; + r = *s++; + g = *s++; + b = *s++; + RGB2YUV (r, g, b, y0, u0 , v0); + s++; + r = *s++; + g = *s++; + b = *s++; + RGB2YUV (r, g, b, y1, u1 , v1); + *d++ = y0; + *d++ = (u0+u1) >> 1; + *d++ = y1; + *d++ = (v0+v1) >> 1; + } + if ( width % 2 ) + { + s++; + r = *s++; + g = *s++; + b = *s++; + RGB2YUV (r, g, b, y0, u0 , v0); + *d++ = y0; + *d++ = u0; + } + } return ret; }