return ( y - x ) / 2.0;
}
-static inline int dissolve_yuv( mlt_frame this, mlt_frame that, float weight, int *width, int *height )
+static inline int dissolve_yuv( mlt_frame this, mlt_frame that, float weight, int width, int height )
{
int ret = 0;
- int width_src = *width, height_src = *height;
- int width_dest = *width, height_dest = *height;
- mlt_image_format format_src = mlt_image_yuv422, format_dest = mlt_image_yuv422;
+ int width_src = width, height_src = height;
+ mlt_image_format format = mlt_image_yuv422;
uint8_t *p_src, *p_dest;
- int i, j;
- int stride_src;
- int stride_dest;
-
- format_src = mlt_image_yuv422;
- format_dest = mlt_image_yuv422;
-
- mlt_frame_get_image( this, &p_dest, &format_dest, &width_dest, &height_dest, 1 /* writable */ );
- mlt_frame_get_image( that, &p_src, &format_src, &width_src, &height_src, 0 /* writable */ );
-
- stride_src = width_src << 1;
- stride_dest = width_dest << 1;
-
- uint8_t *p = p_src;
- uint8_t *q = p_dest;
- uint8_t *o = p_dest;
-
- uint8_t Y;
- uint8_t UV;
float weight_complement = 1 - weight;
+ uint8_t *p;
+ uint8_t *limit;
- // now do the compositing only to cropped extents
- for ( i = 0; i < height_src; i++ )
- {
- p = &p_src[ i * stride_src ];
- o = q = &p_dest[ i * stride_dest ];
+ mlt_frame_get_image( this, &p_dest, &format, &width, &height, 1 /* writable */ );
+ mlt_frame_get_image( that, &p_src, &format, &width_src, &height_src, 0 /* writable */ );
+
+ p = p_dest;
+ limit = p_dest + height_src * width_src * 2;
- for ( j = 0; j < width_src; j ++ )
- {
- Y = *p ++;
- UV = *p ++;
- *o ++ = (uint8_t)( Y * weight + *q++ * weight_complement );
- *o ++ = (uint8_t)( UV * weight + *q++ * weight_complement );
- }
- }
+ while ( p < limit )
+ *p_dest++ = ( uint8_t )( *p_src++ * weight + *p++ * weight_complement );
return ret;
}
uint8_t y;
uint8_t uv;
- float value;
+ float value;
float x_diff = ( float )luma_width / ( float )*width;
float y_diff = ( float )luma_height / ( float )*height;
luma_softness, progressive ? -1 : top_field_first, width, height );
else
// Dissolve the frames using the time offset for mix value
- dissolve_yuv( this, b_frame, mix, width, height );
+ dissolve_yuv( this, b_frame, mix, *width, *height );
// Extract the a_frame image info
*width = mlt_properties_get_int( a_props, "width" );
static void luma_read_pgm( FILE *f, float **map, int *width, int *height )
{
- void *release = NULL;
uint8_t *data = NULL;
while (1)
{
bpp = maxval > 255 ? 2 : 1;
// allocate temporary storage for the raw data
- data = mlt_pool_allocate( *width * *height * bpp, &release );
+ data = mlt_pool_alloc( *width * *height * bpp );
if ( data == NULL )
break;
break;
// allocate the luma bitmap
- // IRRIGATE ME
- // Difficult here - need to change the function prototype....
- *map = p = (float*) malloc( *width * *height * sizeof( float ) );
+ *map = p = (float*)mlt_pool_alloc( *width * *height * sizeof( float ) );
if ( *map == NULL )
break;
break;
}
- if ( release != NULL )
- mlt_pool_release( release );
+ if ( data != NULL )
+ mlt_pool_release( data );
}
pipe = fopen( luma_file, "r" );
if ( pipe != NULL )
{
- free( this->bitmap );
+ mlt_pool_release( this->bitmap );
luma_read_pgm( pipe, &this->bitmap, &this->width, &this->height );
fclose( pipe );
}
static void transition_close( mlt_transition parent )
{
transition_luma *this = (transition_luma*) parent->child;
- free( this->bitmap );
+ mlt_pool_release( this->bitmap );
free( this->filename );
free( this );
}