Skip to content

Commit

Permalink
Fix invert=1 and mix=100 gives wrong image.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Dec 22, 2018
1 parent 0bf1f4a commit 1a3329e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/modules/vmfx/filter_shape.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
static inline double smoothstep( const double e1, const double e2, const double a )
{
if ( a < e1 ) return 0.0;
if ( a > e2 ) return 1.0;
if ( a >= e2 ) return 1.0;
double v = ( a - e1 ) / ( e2 - e1 );
return ( v * v * ( 3 - 2 * v ) );
}
Expand All @@ -50,7 +50,8 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format

// Render the frame
*format = mlt_image_yuv422;
if ( mlt_frame_get_image( frame, image, format, width, height, writable ) == 0 && ( !use_luminance || !use_mix || ( int )mix != 1 ) )
if ( mlt_frame_get_image( frame, image, format, width, height, writable ) == 0 &&
( !use_luminance || !use_mix || (int) mix != 1 || invert == 255 ) )
{
// Get the alpha mask of the source
uint8_t *alpha = mlt_frame_get_alpha_mask( frame );
Expand Down Expand Up @@ -97,7 +98,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
q += 2;
}
}
else if ( ( int )mix != 1 )
else if ( (int) mix != 1 || invert == 255 )
{
int full_range = mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "full_luma" );
double offset = full_range ? 0.0 : 16.0;
Expand Down

0 comments on commit 1a3329e

Please sign in to comment.