From: Dan Dennedy Date: Wed, 26 Feb 2014 04:48:40 +0000 (-0800) Subject: Merge pull request #37 from jliljebl/luma-lift-gain-gamma X-Git-Url: https://git.sesse.net/?p=mlt;a=commitdiff_plain;h=25f848ac99aa6b3ced438ee804b4b040a35950f3;hp=138d9115d8d3a8bf5f9c2bfc8a3a375241f49c92 Merge pull request #37 from jliljebl/luma-lift-gain-gamma Add lumaliftgaingamma filter to plusgpl --- diff --git a/presets/filter/movit.opacity/fade_in b/presets/filter/movit.opacity/fade_in new file mode 100644 index 00000000..6637bd38 --- /dev/null +++ b/presets/filter/movit.opacity/fade_in @@ -0,0 +1,2 @@ +opacity=0=0;:2.0=1.0 +alpha=1 diff --git a/presets/filter/movit.opacity/fade_in_out b/presets/filter/movit.opacity/fade_in_out new file mode 100644 index 00000000..bc5b7d6b --- /dev/null +++ b/presets/filter/movit.opacity/fade_in_out @@ -0,0 +1,2 @@ +opacity=0=0;:2.0=1.0; :-2.0=1.0; -1=0 +alpha=1 diff --git a/presets/filter/movit.opacity/fade_out b/presets/filter/movit.opacity/fade_out new file mode 100644 index 00000000..aed8cabf --- /dev/null +++ b/presets/filter/movit.opacity/fade_out @@ -0,0 +1,2 @@ +opacity=:-2.0=1.0; -1=0 +alpha=1 diff --git a/src/modules/opengl/filter_movit_opacity.cpp b/src/modules/opengl/filter_movit_opacity.cpp index 300145c2..eac29757 100644 --- a/src/modules/opengl/filter_movit_opacity.cpp +++ b/src/modules/opengl/filter_movit_opacity.cpp @@ -34,10 +34,11 @@ static int get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format mlt_position position = mlt_filter_get_position( filter, frame ); mlt_position length = mlt_filter_get_length2( filter, frame ); double opacity = mlt_properties_anim_get_double( properties, "opacity", position, length ); + double alpha = mlt_properties_anim_get_double( properties, "alpha", position, length ); mlt_properties_set_double( properties, "movit.parms.vec4.factor[0]", opacity ); mlt_properties_set_double( properties, "movit.parms.vec4.factor[1]", opacity ); mlt_properties_set_double( properties, "movit.parms.vec4.factor[2]", opacity ); - mlt_properties_set_double( properties, "movit.parms.vec4.factor[3]", opacity ); + mlt_properties_set_double( properties, "movit.parms.vec4.factor[3]", alpha >= 0 ? alpha : opacity ); GlslManager::get_instance()->unlock_service( frame ); *format = mlt_image_glsl; int error = mlt_frame_get_image( frame, image, format, width, height, writable ); @@ -64,6 +65,7 @@ mlt_filter filter_movit_opacity_init( mlt_profile profile, mlt_service_type type mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); glsl->add_ref( properties ); mlt_properties_set( properties, "opacity", arg? arg : "1" ); + mlt_properties_set_double( properties, "alpha", -1.0 ); filter->process = process; } return filter; diff --git a/src/modules/opengl/filter_movit_opacity.yml b/src/modules/opengl/filter_movit_opacity.yml index cf4d1d65..264ce321 100644 --- a/src/modules/opengl/filter_movit_opacity.yml +++ b/src/modules/opengl/filter_movit_opacity.yml @@ -15,6 +15,7 @@ notes: > the other video. If the video this is applied to already has an alpha channel, then this preserves that by multiplying the opacity level with the alpha channel. This filter is especially handy when used in conjunction with movit.overlay. + You can also use this to fade a clip from and to black. parameters: - identifier: opacity @@ -24,3 +25,16 @@ parameters: maximum: 1 default: 1 mutable: yes + + - identifier: alpha + title: Alpha + description: > + When this is less than zero, the alpha component of the Movit mutliply + effect follows opacity. Otherwise, you can set this to another value to + control the alpha component independently. If you set this to 1, then + the opacity parameter can be used to fade to and from black. + type: float + minimum: -1 + maximum: 1 + default: -1 + mutable: yes