X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmodules%2Fcore%2Ftransition_composite.c;h=9b9eada2d55c224e29650e13f37b2a640f47706d;hb=facc6328e46eb0c973c6293390a14258abf071d4;hp=8aa8a6163abc93d6be2ed3078179a4b62e1534f1;hpb=3aa0a608eab6066fc971c314699499268c49a632;p=mlt diff --git a/src/modules/core/transition_composite.c b/src/modules/core/transition_composite.c index 8aa8a616..9b9eada2 100644 --- a/src/modules/core/transition_composite.c +++ b/src/modules/core/transition_composite.c @@ -355,7 +355,7 @@ static void luma_read_yuv422( uint8_t *image, uint16_t **map, int width, int hei static inline int calculate_mix( uint16_t *luma, int j, int softness, int weight, int alpha, uint32_t step ) { - return ( ( luma ? smoothstep( luma[ j ], luma[ j ] + softness, step ) : weight ) * alpha ) >> 8; + return ( ( luma ? smoothstep( luma[ j ], luma[ j ] + softness, step ) : weight ) * ( alpha + 1 ) ) >> 8; } static inline uint8_t sample_mix( uint8_t dest, uint8_t src, int mix ) @@ -460,7 +460,7 @@ static int composite_yuv( uint8_t *p_dest, int width_dest, int height_dest, uint int stride_src = geometry.sw * bpp; int stride_dest = width_dest * bpp; int i_softness = ( 1 << 16 ) * softness; - int weight = ( ( ( 1 << 16 ) - 1 ) * geometry.item.mix + 50 ) / 100; + int weight = ( ( 1 << 16 ) * geometry.item.mix + 50 ) / 100; uint32_t luma_step = ( ( ( 1 << 16 ) - 1 ) * geometry.item.mix + 50 ) / 100 * ( 1.0 + softness ); // Adjust to consumer scale @@ -561,7 +561,6 @@ static int composite_yuv( uint8_t *p_dest, int width_dest, int height_dest, uint if ( uneven_x != uneven_x_src ) { p_src += 2; - width_src -= 2; alpha_b += 1; } @@ -675,7 +674,7 @@ static uint16_t* get_luma( mlt_transition self, mlt_properties properties, int w if ( extension != NULL && strcmp( extension, ".pgm" ) == 0 ) { // Open PGM - FILE *f = fopen( resource, "r" ); + FILE *f = fopen( resource, "rb" ); if ( f != NULL ) { // Load from PGM @@ -1327,7 +1326,7 @@ static mlt_frame composite_process( mlt_transition self, mlt_frame a_frame, mlt_ mlt_transition transition_composite_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { - mlt_transition self = calloc( sizeof( struct mlt_transition_s ), 1 ); + mlt_transition self = calloc( 1, sizeof( struct mlt_transition_s ) ); if ( self != NULL && mlt_transition_init( self, NULL ) == 0 ) { mlt_properties properties = MLT_TRANSITION_PROPERTIES( self );