return length * ( y - x ) / 2.0;
}
-static int get_value( mlt_properties properties, char *preferred, char *fallback )
+static int get_value( mlt_properties properties, const char *preferred, const char *fallback )
{
int value = mlt_properties_get_int( properties, preferred );
if ( value == 0 )
luma_height = height;
}
- if ( resource != NULL && strchr( resource, '%' ) )
+ if ( resource && resource[0] && strchr( resource, '%' ) )
{
// TODO: Clean up quick and dirty compressed/existence check
FILE *test;
resource = temp;
}
- if ( resource != NULL && ( luma_bitmap == NULL || luma_width != width || luma_height != height ) )
+ if ( resource && resource[0] )
+ {
+ char *old_luma = mlt_properties_get( properties, "_luma" );
+ int old_invert = mlt_properties_get_int( properties, "_luma_invert" );
+
+ if ( invert != old_invert || ( old_luma && old_luma[0] && strcmp( resource, old_luma ) ) )
+ {
+ mlt_properties_set_data( properties, "_luma.orig_bitmap", NULL, 0, NULL, NULL );
+ luma_bitmap = NULL;
+ }
+ }
+ else {
+ char *old_luma = mlt_properties_get( properties, "_luma" );
+ if ( old_luma && old_luma[0] )
+ {
+ mlt_properties_set_data( properties, "_luma.orig_bitmap", NULL, 0, NULL, NULL );
+ luma_bitmap = NULL;
+ mlt_properties_set( properties, "_luma", NULL);
+ }
+ }
+
+ if ( resource && resource[0] && ( luma_bitmap == NULL || luma_width != width || luma_height != height ) )
{
uint16_t *orig_bitmap = mlt_properties_get_data( properties, "_luma.orig_bitmap", NULL );
luma_width = mlt_properties_get_int( properties, "_luma.orig_width" );
mlt_properties_set_int( properties, "_luma.width", width );
mlt_properties_set_int( properties, "_luma.height", height );
mlt_properties_set_data( properties, "_luma.bitmap", luma_bitmap, width * height * 2, mlt_pool_release, NULL );
+ mlt_properties_set( properties, "_luma", resource );
+ mlt_properties_set_int( properties, "_luma_invert", invert );
}
return luma_bitmap;
}
uint8_t *alpha_b = NULL;
// Composites always need scaling... defaulting to lowest
- char *rescale = mlt_properties_get( a_props, "rescale.interp" );
+ const char *rescale = mlt_properties_get( a_props, "rescale.interp" );
if ( rescale == NULL || !strcmp( rescale, "none" ) )
rescale = "nearest";
mlt_properties_set( a_props, "rescale.interp", rescale );