From 05008d72aac63b4abca2bc51b9c6e73a722d5703 Mon Sep 17 00:00:00 2001 From: lilo_booter Date: Fri, 14 Jan 2005 13:03:00 +0000 Subject: [PATCH] Sundry minor fixes and optimisations git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@607 d19143bc-622f-0410-bfdd-b5b2a6649095 --- demo/demo | 2 +- demo/mlt_watermark | 2 +- src/framework/mlt_producer.c | 5 - src/framework/mlt_properties.c | 48 +++++----- src/framework/mlt_properties.h | 32 +++--- src/framework/mlt_property.c | 26 ++++- src/framework/mlt_property.h | 2 +- src/framework/mlt_tractor.c | 3 +- src/modules/core/filter_data_show.c | 2 +- src/modules/core/filter_obscure.c | 37 ++++--- src/modules/core/transition_composite.c | 19 ++-- src/modules/core/transition_region.c | 4 +- src/modules/feeds/PAL/data_fx.properties | 167 +----------------------------- src/modules/feeds/PAL/obscure.properties | 17 +++- src/modules/fezzik.ini | 1 + src/modules/gtk2/producer_pango.c | 22 +++-- 16 files changed, 133 insertions(+), 256 deletions(-) diff --git a/demo/demo b/demo/demo index 752fa8f..98777ca 100755 --- a/demo/demo +++ b/demo/demo @@ -88,7 +88,7 @@ do if [ "$MLT_CONSUMER" == "westley:" ] then export WESTLEY_CONSUMER="westley:$demo.westley" bash $demo -consumer $WESTLEY_CONSUMER - inigo +$demo.txt out=100 $demo.westley $demo.westley -filter watermark:watermark1.png composite.fill=true + inigo +$demo.txt out=100 $demo.westley $demo.westley -filter watermark:watermark1.png composite.fill=1 composite.geometry=85%,5%:10%x10% elif [ "$MLT_CONSUMER" == "westley" ] then bash $demo -consumer $MLT_CONSUMER | less else bash $demo -consumer $MLT_CONSUMER diff --git a/demo/mlt_watermark b/demo/mlt_watermark index 7c8902b..b832d5b 100644 --- a/demo/mlt_watermark +++ b/demo/mlt_watermark @@ -2,5 +2,5 @@ inigo \ clip2.dv out=1000 \ -track \ watermark1.png out=1000 \ --transition composite fill=1 in=0 out=1000 a_track=0 b_track=1 \ +-transition composite fill=1 in=0 out=1000 a_track=0 b_track=1 geometry=85%,5%:10%x10% \ $* diff --git a/src/framework/mlt_producer.c b/src/framework/mlt_producer.c index 3382d11..d84a0eb 100644 --- a/src/framework/mlt_producer.c +++ b/src/framework/mlt_producer.c @@ -208,11 +208,6 @@ mlt_producer mlt_producer_cut( mlt_producer this, int in, int out ) mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "_fezzik", 1 ); mlt_producer_attach( result, filter ); mlt_filter_close( filter ); - filter = mlt_factory_filter( "data_show", "%obscure.properties" ); - mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "_fezzik", 1 ); - mlt_producer_attach( result, filter ); - mlt_filter_close( filter ); - mlt_events_unblock( MLT_PRODUCER_PROPERTIES( result ), MLT_PRODUCER_PROPERTIES( result ) ); return result; } diff --git a/src/framework/mlt_properties.c b/src/framework/mlt_properties.c index 53db476..b42d02a 100644 --- a/src/framework/mlt_properties.c +++ b/src/framework/mlt_properties.c @@ -101,7 +101,7 @@ mlt_properties mlt_properties_new( ) /** Load properties from a file. */ -mlt_properties mlt_properties_load( char *filename ) +mlt_properties mlt_properties_load( const char *filename ) { // Construct a standalone properties object mlt_properties this = mlt_properties_new( ); @@ -151,7 +151,7 @@ mlt_properties mlt_properties_load( char *filename ) return this; } -static inline int generate_hash( char *name ) +static inline int generate_hash( const char *name ) { int hash = 0; int i = 1; @@ -165,7 +165,7 @@ static inline int generate_hash( char *name ) real producer. */ -static inline void mlt_properties_do_mirror( mlt_properties this, char *name ) +static inline void mlt_properties_do_mirror( mlt_properties this, const char *name ) { property_list *list = this->local; if ( list->mirror != NULL ) @@ -246,7 +246,7 @@ int mlt_properties_inherit( mlt_properties this, mlt_properties that ) /** Pass all properties from 'that' that match the prefix to 'this' (excluding the prefix). */ -int mlt_properties_pass( mlt_properties this, mlt_properties that, char *prefix ) +int mlt_properties_pass( mlt_properties this, mlt_properties that, const char *prefix ) { int count = mlt_properties_count( that ); int length = strlen( prefix ); @@ -267,7 +267,7 @@ int mlt_properties_pass( mlt_properties this, mlt_properties that, char *prefix /** Locate a property by name */ -static inline mlt_property mlt_properties_find( mlt_properties this, char *name ) +static inline mlt_property mlt_properties_find( mlt_properties this, const char *name ) { property_list *list = this->local; mlt_property value = NULL; @@ -294,7 +294,7 @@ static inline mlt_property mlt_properties_find( mlt_properties this, char *name /** Add a new property. */ -static mlt_property mlt_properties_add( mlt_properties this, char *name ) +static mlt_property mlt_properties_add( mlt_properties this, const char *name ) { property_list *list = this->local; int key = generate_hash( name ); @@ -303,7 +303,7 @@ static mlt_property mlt_properties_add( mlt_properties this, char *name ) if ( list->count == list->size ) { list->size += 50; - list->name = realloc( list->name, list->size * sizeof( char * ) ); + list->name = realloc( list->name, list->size * sizeof( const char * ) ); list->value = realloc( list->value, list->size * sizeof( mlt_property ) ); } @@ -322,7 +322,7 @@ static mlt_property mlt_properties_add( mlt_properties this, char *name ) /** Fetch a property by name - this includes add if not found. */ -static mlt_property mlt_properties_fetch( mlt_properties this, char *name ) +static mlt_property mlt_properties_fetch( mlt_properties this, const char *name ) { // Try to find an existing property first mlt_property property = mlt_properties_find( this, name ); @@ -338,7 +338,7 @@ static mlt_property mlt_properties_fetch( mlt_properties this, char *name ) /** Set the property. */ -int mlt_properties_set( mlt_properties this, char *name, char *value ) +int mlt_properties_set( mlt_properties this, const char *name, const char *value ) { int error = 1; @@ -348,7 +348,7 @@ int mlt_properties_set( mlt_properties this, char *name, char *value ) // Set it if not NULL if ( property == NULL ) { - fprintf( stderr, "Whoops\n" ); + fprintf( stderr, "Whoops - %s not found (should never occur)\n", name ); } else if ( value == NULL ) { @@ -360,7 +360,7 @@ int mlt_properties_set( mlt_properties this, char *name, char *value ) error = mlt_property_set_string( property, value ); mlt_properties_do_mirror( this, name ); } - else if ( property != NULL && value[ 0 ] == '@' ) + else if ( value[ 0 ] == '@' ) { int total = 0; int current = 0; @@ -417,7 +417,7 @@ int mlt_properties_set( mlt_properties this, char *name, char *value ) /** Set or default the property. */ -int mlt_properties_set_or_default( mlt_properties this, char *name, char *value, char *def ) +int mlt_properties_set_or_default( mlt_properties this, const char *name, const char *value, const char *def ) { return mlt_properties_set( this, name, value == NULL ? def : value ); } @@ -425,7 +425,7 @@ int mlt_properties_set_or_default( mlt_properties this, char *name, char *value, /** Get a string value by name. */ -char *mlt_properties_get( mlt_properties this, char *name ) +char *mlt_properties_get( mlt_properties this, const char *name ) { mlt_property value = mlt_properties_find( this, name ); return value == NULL ? NULL : mlt_property_get_string( value ); @@ -476,7 +476,7 @@ int mlt_properties_count( mlt_properties this ) /** Set a value by parsing a name=value string */ -int mlt_properties_parse( mlt_properties this, char *namevalue ) +int mlt_properties_parse( mlt_properties this, const char *namevalue ) { char *name = strdup( namevalue ); char *value = NULL; @@ -515,7 +515,7 @@ int mlt_properties_parse( mlt_properties this, char *namevalue ) /** Get a value associated to the name. */ -int mlt_properties_get_int( mlt_properties this, char *name ) +int mlt_properties_get_int( mlt_properties this, const char *name ) { mlt_property value = mlt_properties_find( this, name ); return value == NULL ? 0 : mlt_property_get_int( value ); @@ -524,7 +524,7 @@ int mlt_properties_get_int( mlt_properties this, char *name ) /** Set a value associated to the name. */ -int mlt_properties_set_int( mlt_properties this, char *name, int value ) +int mlt_properties_set_int( mlt_properties this, const char *name, int value ) { int error = 1; @@ -546,7 +546,7 @@ int mlt_properties_set_int( mlt_properties this, char *name, int value ) /** Get a value associated to the name. */ -double mlt_properties_get_double( mlt_properties this, char *name ) +double mlt_properties_get_double( mlt_properties this, const char *name ) { mlt_property value = mlt_properties_find( this, name ); return value == NULL ? 0 : mlt_property_get_double( value ); @@ -555,7 +555,7 @@ double mlt_properties_get_double( mlt_properties this, char *name ) /** Set a value associated to the name. */ -int mlt_properties_set_double( mlt_properties this, char *name, double value ) +int mlt_properties_set_double( mlt_properties this, const char *name, double value ) { int error = 1; @@ -577,7 +577,7 @@ int mlt_properties_set_double( mlt_properties this, char *name, double value ) /** Get a value associated to the name. */ -mlt_position mlt_properties_get_position( mlt_properties this, char *name ) +mlt_position mlt_properties_get_position( mlt_properties this, const char *name ) { mlt_property value = mlt_properties_find( this, name ); return value == NULL ? 0 : mlt_property_get_position( value ); @@ -586,7 +586,7 @@ mlt_position mlt_properties_get_position( mlt_properties this, char *name ) /** Set a value associated to the name. */ -int mlt_properties_set_position( mlt_properties this, char *name, mlt_position value ) +int mlt_properties_set_position( mlt_properties this, const char *name, mlt_position value ) { int error = 1; @@ -608,7 +608,7 @@ int mlt_properties_set_position( mlt_properties this, char *name, mlt_position v /** Get a value associated to the name. */ -void *mlt_properties_get_data( mlt_properties this, char *name, int *length ) +void *mlt_properties_get_data( mlt_properties this, const char *name, int *length ) { mlt_property value = mlt_properties_find( this, name ); return value == NULL ? NULL : mlt_property_get_data( value, length ); @@ -617,7 +617,7 @@ void *mlt_properties_get_data( mlt_properties this, char *name, int *length ) /** Set a value associated to the name. */ -int mlt_properties_set_data( mlt_properties this, char *name, void *value, int length, mlt_destructor destroy, mlt_serialiser serialise ) +int mlt_properties_set_data( mlt_properties this, const char *name, void *value, int length, mlt_destructor destroy, mlt_serialiser serialise ) { int error = 1; @@ -636,7 +636,7 @@ int mlt_properties_set_data( mlt_properties this, char *name, void *value, int l /** Rename a property. */ -int mlt_properties_rename( mlt_properties this, char *source, char *dest ) +int mlt_properties_rename( mlt_properties this, const char *source, const char *dest ) { mlt_property value = mlt_properties_find( this, dest ); @@ -673,7 +673,7 @@ void mlt_properties_dump( mlt_properties this, FILE *output ) fprintf( output, "%s=%s\n", list->name[ i ], mlt_properties_get( this, list->name[ i ] ) ); } -void mlt_properties_debug( mlt_properties this, char *title, FILE *output ) +void mlt_properties_debug( mlt_properties this, const char *title, FILE *output ) { fprintf( output, "%s: ", title ); if ( this != NULL ) diff --git a/src/framework/mlt_properties.h b/src/framework/mlt_properties.h index ff87dc0..c2cbebc 100644 --- a/src/framework/mlt_properties.h +++ b/src/framework/mlt_properties.h @@ -42,32 +42,32 @@ struct mlt_properties_s extern int mlt_properties_init( mlt_properties, void *child ); extern mlt_properties mlt_properties_new( ); -extern mlt_properties mlt_properties_load( char *file ); +extern mlt_properties mlt_properties_load( const char *file ); extern int mlt_properties_inc_ref( mlt_properties self ); extern int mlt_properties_dec_ref( mlt_properties self ); extern int mlt_properties_ref_count( mlt_properties self ); extern void mlt_properties_mirror( mlt_properties self, mlt_properties that ); extern int mlt_properties_inherit( mlt_properties self, mlt_properties that ); -extern int mlt_properties_pass( mlt_properties self, mlt_properties that, char *prefix ); -extern int mlt_properties_set( mlt_properties self, char *name, char *value ); -extern int mlt_properties_set_or_default( mlt_properties self, char *name, char *value, char *def ); -extern int mlt_properties_parse( mlt_properties self, char *namevalue ); -extern char *mlt_properties_get( mlt_properties self, char *name ); +extern int mlt_properties_pass( mlt_properties self, mlt_properties that, const char *prefix ); +extern int mlt_properties_set( mlt_properties self, const char *name, const char *value ); +extern int mlt_properties_set_or_default( mlt_properties self, const char *name, const char *value, const char *def ); +extern int mlt_properties_parse( mlt_properties self, const char *namevalue ); +extern char *mlt_properties_get( mlt_properties self, const char *name ); extern char *mlt_properties_get_name( mlt_properties self, int index ); extern char *mlt_properties_get_value( mlt_properties self, int index ); extern void *mlt_properties_get_data_at( mlt_properties self, int index, int *size ); -extern int mlt_properties_get_int( mlt_properties self, char *name ); -extern int mlt_properties_set_int( mlt_properties self, char *name, int value ); -extern double mlt_properties_get_double( mlt_properties self, char *name ); -extern int mlt_properties_set_double( mlt_properties self, char *name, double value ); -extern mlt_position mlt_properties_get_position( mlt_properties self, char *name ); -extern int mlt_properties_set_position( mlt_properties self, char *name, mlt_position value ); -extern int mlt_properties_set_data( mlt_properties self, char *name, void *value, int length, mlt_destructor, mlt_serialiser ); -extern void *mlt_properties_get_data( mlt_properties self, char *name, int *length ); -extern int mlt_properties_rename( mlt_properties self, char *source, char *dest ); +extern int mlt_properties_get_int( mlt_properties self, const char *name ); +extern int mlt_properties_set_int( mlt_properties self, const char *name, int value ); +extern double mlt_properties_get_double( mlt_properties self, const char *name ); +extern int mlt_properties_set_double( mlt_properties self, const char *name, double value ); +extern mlt_position mlt_properties_get_position( mlt_properties self, const char *name ); +extern int mlt_properties_set_position( mlt_properties self, const char *name, mlt_position value ); +extern int mlt_properties_set_data( mlt_properties self, const char *name, void *value, int length, mlt_destructor, mlt_serialiser ); +extern void *mlt_properties_get_data( mlt_properties self, const char *name, int *length ); +extern int mlt_properties_rename( mlt_properties self, const char *source, const char *dest ); extern int mlt_properties_count( mlt_properties self ); extern void mlt_properties_dump( mlt_properties self, FILE *output ); -extern void mlt_properties_debug( mlt_properties self, char *title, FILE *output ); +extern void mlt_properties_debug( mlt_properties self, const char *title, FILE *output ); extern void mlt_properties_close( mlt_properties self ); #endif diff --git a/src/framework/mlt_property.c b/src/framework/mlt_property.c index ddc000c..63e32a4 100644 --- a/src/framework/mlt_property.c +++ b/src/framework/mlt_property.c @@ -110,7 +110,7 @@ int mlt_property_set_position( mlt_property this, mlt_position value ) /** Set a string on this property. */ -int mlt_property_set_string( mlt_property this, char *value ) +int mlt_property_set_string( mlt_property this, const char *value ) { if ( value != this->prop_string ) { @@ -153,6 +153,16 @@ int mlt_property_set_data( mlt_property this, void *value, int length, mlt_destr return 0; } +static inline int mlt_property_atoi( const char *value ) +{ + if ( value == NULL ) + return 0; + else if ( value[0] == '0' && value[1] == 'x' ) + return strtol( value + 2, NULL, 16 ); + else + return strtol( value, NULL, 10 ); +} + /** Get an int from this property. */ @@ -167,7 +177,7 @@ int mlt_property_get_int( mlt_property this ) else if ( this->types & mlt_prop_int64 ) return ( int )this->prop_int64; else if ( this->types & mlt_prop_string ) - return atoi( this->prop_string ); + return mlt_property_atoi( this->prop_string ); return 0; } @@ -207,6 +217,16 @@ mlt_position mlt_property_get_position( mlt_property this ) return 0; } +static inline int64_t mlt_property_atoll( const char *value ) +{ + if ( value == NULL ) + return 0; + else if ( value[0] == '0' && value[1] == 'x' ) + return strtoll( value + 2, NULL, 16 ); + else + return strtoll( value, NULL, 10 ); +} + /** Get an int64 from this property. */ @@ -221,7 +241,7 @@ int64_t mlt_property_get_int64( mlt_property this ) else if ( this->types & mlt_prop_position ) return ( int64_t )this->prop_position; else if ( this->types & mlt_prop_string ) - return ( int64_t )atol( this->prop_string ); + return mlt_property_atoll( this->prop_string ); return 0; } diff --git a/src/framework/mlt_property.h b/src/framework/mlt_property.h index 96287d4..51a8f41 100644 --- a/src/framework/mlt_property.h +++ b/src/framework/mlt_property.h @@ -71,7 +71,7 @@ extern int mlt_property_set_int( mlt_property self, int value ); extern int mlt_property_set_double( mlt_property self, double value ); extern int mlt_property_set_position( mlt_property self, mlt_position value ); extern int mlt_property_set_uint64( mlt_property self, uint64_t value ); -extern int mlt_property_set_string( mlt_property self, char *value ); +extern int mlt_property_set_string( mlt_property self, const char *value ); extern int mlt_property_set_data( mlt_property self, void *value, int length, mlt_destructor destructor, mlt_serialiser serialiser ); extern int mlt_property_get_int( mlt_property self ); extern double mlt_property_get_double( mlt_property self ); diff --git a/src/framework/mlt_tractor.c b/src/framework/mlt_tractor.c index 861edff..4a26d0b 100644 --- a/src/framework/mlt_tractor.c +++ b/src/framework/mlt_tractor.c @@ -308,8 +308,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra mlt_properties_set_data( frame_properties, label, temp, 0, ( mlt_destructor )mlt_frame_close, NULL ); // We want the first data_queue, but after that, all queues are appended - if ( !done && mlt_properties_get_data( temp_properties, "data_queue", NULL ) != NULL && - mlt_deque_count( mlt_properties_get_data( temp_properties, "data_queue", NULL ) ) != 0 ) + if ( !done && mlt_properties_get_data( temp_properties, "data_queue", NULL ) != NULL ) { if ( data_queue == NULL ) { diff --git a/src/modules/core/filter_data_show.c b/src/modules/core/filter_data_show.c index 4387ae2..b080446 100644 --- a/src/modules/core/filter_data_show.c +++ b/src/modules/core/filter_data_show.c @@ -139,7 +139,7 @@ static int process_feed( mlt_properties feed, mlt_filter filter, mlt_frame frame { if ( !strncmp( name + len, "length[", 7 ) ) { - mlt_properties_set_position( properties, key, length / period ); + mlt_properties_set_position( properties, key, ( length - period ) / period ); } else { diff --git a/src/modules/core/filter_obscure.c b/src/modules/core/filter_obscure.c index ae70e10..d552198 100644 --- a/src/modules/core/filter_obscure.c +++ b/src/modules/core/filter_obscure.c @@ -151,38 +151,45 @@ static float position_calculate( mlt_filter this, mlt_frame frame ) /** The averaging function... */ -void obscure_average( uint8_t *start, int width, int height, int stride ) +static inline void obscure_average( uint8_t *start, int width, int height, int stride ) { - int y; - int x; + register int y; + register int x; register int Y = ( *start + *( start + 2 ) ) / 2; register int U = *( start + 1 ); register int V = *( start + 3 ); register uint8_t *p; + register int components = width >> 1; - for ( y = 0; y < height; y ++ ) + y = height; + while( y -- ) { - p = start + y * stride; - for ( x = 0; x < width / 2; x ++ ) + p = start; + x = components; + while( x -- ) { - Y = ( Y + *p ++ ) / 2; - U = ( U + *p ++ ) / 2; - Y = ( Y + *p ++ ) / 2; - V = ( V + *p ++ ) / 2; + Y = ( Y + *p ++ ) >> 1; + U = ( U + *p ++ ) >> 1; + Y = ( Y + *p ++ ) >> 1; + V = ( V + *p ++ ) >> 1; } + start += stride; } - for ( y = 0; y < height; y ++ ) + start -= height * stride; + y = height; + while( y -- ) { - p = start + y * stride; - - for ( x = 0; x < width / 2; x ++ ) + p = start; + x = components; + while( x -- ) { *p ++ = Y; *p ++ = U; *p ++ = Y; *p ++ = V; } + start += stride; } } @@ -213,7 +220,7 @@ static void obscure_render( uint8_t *image, int width, int height, struct geomet aw = w + mw > area_w ? mw - ( w + mw - area_w ) : mw; ah = h + mh > area_h ? mh - ( h + mh - area_h ) : mh; if ( aw > 1 && ah > 1 ) - obscure_average( p + h * width * 2 + w * 2, aw, ah, width * 2 ); + obscure_average( p + h * ( width << 1 ) + ( w << 1 ), aw, ah, width << 1 ); } } } diff --git a/src/modules/core/transition_composite.c b/src/modules/core/transition_composite.c index ed2436f..16bf590 100644 --- a/src/modules/core/transition_composite.c +++ b/src/modules/core/transition_composite.c @@ -384,8 +384,8 @@ void composite_line_yuv( uint8_t *dest, uint8_t *src, int width_src, uint8_t *al for ( j = 0; j < width_src; j ++ ) { a = ( alpha == NULL ) ? 255 : *alpha ++; - mix = ( luma == NULL ) ? weight : linearstep( luma[ j ], luma[ j ] + softness, weight ); - mix = ( mix * ( a + 1 ) ) >> 8; + mix = ( luma == NULL ) ? weight : smoothstep( luma[ j ], luma[ j ] + softness, weight + softness ); + mix = ( mix * a ) >> 8; *dest = ( *src++ * mix + *dest * ( ( 1 << 16 ) - mix ) ) >> 16; dest++; *dest = ( *src++ * mix + *dest * ( ( 1 << 16 ) - mix ) ) >> 16; @@ -527,7 +527,7 @@ static int composite_yuv( uint8_t *p_dest, int width_dest, int height_dest, uint */ static inline void -scale_luma ( uint16_t *dest_buf, int dest_width, int dest_height, const uint16_t *src_buf, int src_width, int src_height ) +scale_luma ( uint16_t *dest_buf, int dest_width, int dest_height, const uint16_t *src_buf, int src_width, int src_height, int invert ) { register int i, j; register int x_step = ( src_width << 16 ) / dest_width; @@ -541,7 +541,7 @@ scale_luma ( uint16_t *dest_buf, int dest_width, int dest_height, const uint16_t for ( j = 0; j < dest_width; j++ ) { - *dest_buf++ = src[ x >> 16 ]; + *dest_buf++ = src[ x >> 16 ] ^ invert; x += x_step; } y += y_step; @@ -554,6 +554,7 @@ static uint16_t* get_luma( mlt_properties properties, int width, int height ) int luma_width = mlt_properties_get_int( properties, "_luma.width" ); int luma_height = mlt_properties_get_int( properties, "_luma.height" ); uint16_t *luma_bitmap = mlt_properties_get_data( properties, "_luma.bitmap", NULL ); + int invert = mlt_properties_get_int( properties, "luma_invert" ); // If the filename property changed, reload the map char *resource = mlt_properties_get( properties, "luma" ); @@ -647,7 +648,7 @@ static uint16_t* get_luma( mlt_properties properties, int width, int height ) } // Scale luma map luma_bitmap = mlt_pool_alloc( width * height * sizeof( uint16_t ) ); - scale_luma( luma_bitmap, width, height, orig_bitmap, luma_width, luma_height ); + scale_luma( luma_bitmap, width, height, orig_bitmap, luma_width, luma_height, invert * ( ( 1 << 16 ) - 1 ) ); // Remember the scaled luma size to prevent unnecessary scaling mlt_properties_set_int( properties, "_luma.width", width ); @@ -1015,8 +1016,10 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f if ( mlt_properties_get_int( properties, "titles" ) ) { - result.nw = result.item.w = *width; - result.nh = result.item.h = *height; + result.item.w = *width * ( result.item.w / result.nw ); + result.nw = result.item.w; + result.item.h = *height * ( result.item.h / result.nh ); + result.nh = *height; result.sw = width_b; result.sh = height_b; } @@ -1066,7 +1069,7 @@ mlt_transition transition_composite_init( char *arg ) this->process = composite_process; // Default starting motion and zoom - mlt_properties_set( properties, "start", arg != NULL ? arg : "85%,5%:10%x10%" ); + mlt_properties_set( properties, "start", arg != NULL ? arg : "0,0:100%x100%" ); // Default factory mlt_properties_set( properties, "factory", "fezzik" ); diff --git a/src/modules/core/transition_region.c b/src/modules/core/transition_region.c index bfe4a4e..4934d3b 100644 --- a/src/modules/core/transition_region.c +++ b/src/modules/core/transition_region.c @@ -119,7 +119,7 @@ static uint8_t *filter_get_alpha_mask( mlt_frame this ) alpha = p; while ( size -- ) { - *p ++ = *image ++; + *p ++ = ( int )( ( ( *image ++ - 16 ) * 299 ) / 255 ); image ++; } mlt_properties_set_data( MLT_FRAME_PROPERTIES( this ), "alpha", alpha, region_width * region_height, mlt_pool_release, NULL ); @@ -176,7 +176,7 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for mlt_properties composite_properties = MLT_TRANSITION_PROPERTIES( composite ); // We want to ensure that we don't get a wobble... - mlt_properties_set_int( composite_properties, "distort", 1 ); + //mlt_properties_set_int( composite_properties, "distort", 1 ); mlt_properties_set_int( composite_properties, "progressive", 1 ); // Pass all the composite. properties on the transition down diff --git a/src/modules/feeds/PAL/data_fx.properties b/src/modules/feeds/PAL/data_fx.properties index e60979a..1a29713 100644 --- a/src/modules/feeds/PAL/data_fx.properties +++ b/src/modules/feeds/PAL/data_fx.properties @@ -28,7 +28,6 @@ titles=region .filter[0]=watermark .filter[0].resource=colour:0x000000 .filter[0].composite.geometry=0%,0%:100%x100%:0;5=0%,0%:100%x100%:40 -.filter[0].composite.titles=1 .filter[1]=watermark .filter[1].resource=pango: .filter[1].producer.markup=Shotcut @@ -50,12 +49,10 @@ top-titles=region .filter[0]=watermark .filter[0].resource=colour:0x000000 .filter[0].composite.geometry=0%,0%:100%x100%:0;5=0%,0%:100%x100%:40 -.filter[0].composite.titles=1 .filter[1]=watermark .filter[1].resource=pango: .filter[1].producer.markup=Shotcut .filter[1].composite.geometry=0%,0%:100%x100%:0;8=0%,0%:100%x100%:100 -.filter[1].composite.halign=centre .filter[1].composite.titles=1 # @@ -70,8 +67,6 @@ tickertape=region .composite.geometry=0%,93%:100%x7% .filter[0]=watermark .filter[0].resource=colour:0x000000 -.filter[0].composite.geometry=0%,0%:100%x100%:100 -.filter[0].composite.titles=1 .filter[1]=watermark .filter[1].resource=pango: .filter[1].producer.markup=Shotcut @@ -79,164 +74,6 @@ tickertape=region .filter[1].producer.font=San 32 .filter[1].composite.titles=1 -# -# ETV Location -# - -location=region -.description=Titles -.properties.markup=filter[1].producer.markup -.type.markup=text -.period=2 -.properties.length[0]=filter[0].composite.out -.properties.length[1]=filter[1].composite.out -.composite.geometry=0,80:230x30 -.filter[0]=watermark -.filter[0].resource=colour:0x6c010100 -.filter[0].composite.geometry=0%,0%:100%x100%:0;25=0%,0%:100%x100%:100 -.filter[0].composite.luma=%luma01.pgm -.filter[0].composite.titles=1 -.filter[1]=watermark -.filter[1].resource=pango: -.filter[1].producer.markup= -.filter[1].producer.font=San 24 -.filter[1].composite.geometry=0%,0%:100%x100%:0;24=0%,0%:100%x100%:0;49=0%,0%:100%x100%:100 -.filter[1].composite.titles=1 -.filter[1].composite.halign=right -.filter[1].composite.valign=center - -courtesy=region -.description=Titles -.properties.markup=filter[1].producer.markup -.type.markup=text -.period=2 -.properties.length[0]=filter[0].composite.out -.properties.length[1]=filter[1].composite.out -.composite.geometry=0,115:230x30 -.filter[0]=watermark -.filter[0].resource=colour:0x6c010100 -.filter[0].composite.geometry=12=0%,0%:100%x100%:0;37=0%,0%:100%x100%:100 -.filter[0].composite.luma=%luma01.pgm -.filter[0].composite.titles=1 -.filter[1]=watermark -.filter[1].resource=pango: -.filter[1].producer.markup=ETV Exclusive -.filter[1].producer.font=San 24 -.filter[1].composite.geometry=0%,0%:100%x100%:0;37=0%,0%:100%x100%:0;61=0%,0%:100%x100%:100 -.filter[1].composite.titles=1 -.filter[1].composite.halign=right -.filter[1].composite.valign=right - -exclusive=region -.description=Exclusive -.period=2 -.properties.length[0]=filter[0].composite.out -.properties.length[1]=filter[1].composite.out -.composite.geometry=0,115:230x30 -.filter[0]=watermark -.filter[0].resource=colour:0x6c010100 -.filter[0].composite.geometry=0%,0%:100%x100%:10;12=0%,0%:100%x100%:100 -.filter[0].composite.titles=1 -.filter[1]=watermark -.filter[1].resource=pango: -.filter[1].producer.markup=ETV Exclusive -.filter[1].producer.font=San 24 -.filter[1].composite.geometry=0%,0%:100%x100%:10;12=0%,0%:100%x100%:100 -.filter[1].composite.titles=1 -.filter[1].composite.halign=right -.filter[1].composite.valign=right - -file_shot=region -.description=Titles -.period=2 -.properties.length[0]=filter[0].composite.out -.properties.length[1]=filter[1].composite.out -.composite.geometry=590,160:80x25 -.filter[0]=watermark -.filter[0].resource=colour:0x6c010100 -.filter[0].composite.geometry=0%,0%:100%x100%:10;25=0%,0%:100%x100%:100 -.filter[0].composite.titles=1 -.filter[1]=watermark -.filter[1].resource=pango: -.filter[1].producer.markup=File Shot -.filter[1].producer.font=San 20 -.filter[1].composite.geometry=0%,0%:100%x100%:15;25=0%,0%:100%x100%:100 -.filter[1].composite.titles=1 -.filter[1].composite.halign=centre -.filter[1].composite.valign=centre - -special=region -.description=Titles -.period=2 -.properties.length[0]=filter[0].composite.out -.properties.length[1]=filter[1].composite.out -.composite.geometry=465,375:255x35 -.filter[0]=watermark -.filter[0].resource=colour:0x6c010100 -.filter[0].composite.geometry=100%,0%:100%x100%:0;49=100%,0%:100%x100%:0;74=0%,0%:100%x100%:100 -.filter[0].composite.titles=1 -.filter[1]=watermark -.filter[1].resource=pango: -.filter[1].producer.markup=Special -.filter[1].producer.font=San 24 -.filter[1].composite.geometry=100%,0%:100%x100%:0;49=100%,0%:100%x100%:0;74=0%,0%:100%x100%:100 -.filter[1].composite.titles=1 -.filter[1].composite.halign=centre -.filter[1].composite.valign=centre - -ticker=region -.description=Tickertape -.properties.markup=filter[1].producer.markup -.type.markup=text -.properties.length[0]=filter[1].composite.out -.composite.geometry=0,500:722x75 -.filter[0]=watermark -.filter[0].resource=colour:0x6c010100 -.filter[0].composite.geometry=0%,0%:100%x100%:100 -.filter[0].composite.titles=1 -.filter[1]=watermark -.filter[1].resource=pango: -.filter[1].producer.markup=Ticker - provided for reference -.filter[1].composite.geometry=0%,0%:100%x100%:100 -.filter[1].composite.titles=0 -.filter[1].producer.font=San 24 -.filter[1].composite.halign=centre -.filter[1].composite.titles=1 -.filter[1].composite.valign=centre - -super=region -.description=Transcription -.properties.0=filter[1].producer.markup -.properties.1=filter[2].producer.markup -.properties.align=filter[1].composite.valign -.properties.length[0]=filter[0].composite.out -.properties.length[1]=filter[1].composite.out -.properties.length[2]=filter[2].composite.out -.period=2 -.composite.geometry=0,410:720x90 -.filter[0]=watermark -.filter[0].resource=colour:0xbbbbbb00 -.filter[0].composite.geometry=0%,0%:100%x100%:10;25=0%,0%:100%x100%:100 -.filter[0].composite.titles=1 -.filter[0].composite.luma=%luma18.pgm -.filter[0].composite.out=25 -.filter[1]=watermark -.filter[1].resource=pango: -.filter[1].producer.markup= -.filter[1].producer.font=San 32 -.filter[1].producer.fgcolour=0x6c0101ff -.filter[1].composite.geometry=0%,0%:100%x100%:0;25=0%,0%:100%x100%:100 -.filter[1].composite.titles=1 -.filter[1].composite.halign=centre -.filter[1].composite.valign=top -.filter[2]=watermark -.filter[2].resource=pango: -.filter[2].producer.markup= -.filter[2].producer.font=San 32 -.filter[2].producer.fgcolour=0x6c0101ff -.filter[2].composite.geometry=0%,0%:100%x100%:0;25=0%,0%:100%x100%:100 -.filter[2].composite.titles=1 -.filter[2].composite.halign=centre -.filter[2].composite.valign=bottom - +greyscale=greyscale +.description=greyscale diff --git a/src/modules/feeds/PAL/obscure.properties b/src/modules/feeds/PAL/obscure.properties index 97162b7..3917d9a 100644 --- a/src/modules/feeds/PAL/obscure.properties +++ b/src/modules/feeds/PAL/obscure.properties @@ -1,4 +1,4 @@ -# This properties file describes the fx available to the data_send and +# This properties file describes the fx available to the data_feed and # data_show filters # # Syntax is as follows: @@ -13,8 +13,18 @@ # included as properties using the normal region filter syntax. # -obscure=region -.description=Obscure +obscure0=region +.description=Primary Obscure +.properties.geometry=composite.geometry +.properties.resource=resource +.properties.length[0]=composite.out +.composite.geometry= +.resource=rectangle +.composite.refresh=1 +.filter[0]=obscure + +obscure1=region +.description=Secondary Obscure .properties.geometry=composite.geometry .properties.resource=resource .properties.length[0]=composite.out @@ -22,5 +32,4 @@ obscure=region .resource=rectangle .composite.refresh=1 .filter[0]=obscure -.filter[0].start=0,0:100%x100%:8x8 diff --git a/src/modules/fezzik.ini b/src/modules/fezzik.ini index c3d7fcc..f7061e5 100644 --- a/src/modules/fezzik.ini +++ b/src/modules/fezzik.ini @@ -11,3 +11,4 @@ rescaler=mcrescale,gtkrescale,rescale resizer=resize resampler=resample,soxresample,avresample data=data_feed:attr_check +obscure=data_show:%obscure.properties diff --git a/src/modules/gtk2/producer_pango.c b/src/modules/gtk2/producer_pango.c index 6863edb..7863979 100644 --- a/src/modules/gtk2/producer_pango.c +++ b/src/modules/gtk2/producer_pango.c @@ -541,6 +541,7 @@ static GdkPixbuf *pango_get_pixbuf( const char *markup, const char *text, const FT_Bitmap bitmap; uint8_t *src = NULL; uint8_t* dest = NULL; + uint8_t *d, *s, a; int stride; pango_ft2_font_map_set_resolution( fontmap, 72, 72 ); @@ -575,18 +576,23 @@ static GdkPixbuf *pango_get_pixbuf( const char *markup, const char *text, const src = bitmap.buffer; x = ( gdk_pixbuf_get_width( pixbuf ) - w - 2 * pad ) * align / 2 + pad; dest = gdk_pixbuf_get_pixels( pixbuf ) + 4 * x + pad * stride; - for ( j = 0; j < h; j++ ) + j = h; + + while( j -- ) { - uint8_t *d = dest; - for ( i = 0; i < w; i++ ) + d = dest; + s = src; + i = w; + while( i -- ) { - float a = ( float ) bitmap.buffer[ j * bitmap.pitch + i ] / 255.0; - *d++ = ( int ) ( a * fg.r + ( 1 - a ) * bg.r ); - *d++ = ( int ) ( a * fg.g + ( 1 - a ) * bg.g ); - *d++ = ( int ) ( a * fg.b + ( 1 - a ) * bg.b ); - *d++ = ( int ) ( a * fg.a + ( 1 - a ) * bg.a ); + a = *s ++; + *d++ = ( a * fg.r + ( 255 - a ) * bg.r ) >> 8; + *d++ = ( a * fg.g + ( 255 - a ) * bg.g ) >> 8; + *d++ = ( a * fg.b + ( 255 - a ) * bg.b ) >> 8; + *d++ = ( a * fg.a + ( 255 - a ) * bg.a ) >> 8; } dest += stride; + src += bitmap.pitch; } mlt_pool_release( bitmap.buffer ); g_object_unref( layout ); -- 1.7.4.4