2 * filter_deconvolution_sharpen.cpp
3 * Copyright (C) 2013 Dan Dennedy <dan@dennedy.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include <framework/mlt.h>
24 #include "glsl_manager.h"
25 #include <movit/deconvolution_sharpen_effect.h>
27 static mlt_frame process( mlt_filter filter, mlt_frame frame )
29 if ( !mlt_frame_is_test_card( frame ) ) {
30 Effect* effect = GlslManager::get_effect( filter, frame );
32 GlslManager::add_effect( filter, frame, new DeconvolutionSharpenEffect() );
34 mlt_properties filter_props = MLT_FILTER_PROPERTIES( filter );
35 bool ok = effect->set_int( "matrix_size", mlt_properties_get_int( filter_props, "matrix_size" ) );
36 ok |= effect->set_float( "circle_radius", mlt_properties_get_double( filter_props, "circle_radius" ) );
37 ok |= effect->set_float( "gaussian_radius", mlt_properties_get_double( filter_props, "gaussian_radius" ) );
38 ok |= effect->set_float( "correlation", mlt_properties_get_double( filter_props, "correlation" ) );
39 ok |= effect->set_float( "noise", mlt_properties_get_double( filter_props, "noise" ) );
48 mlt_filter filter_deconvolution_sharpen_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
50 mlt_filter filter = NULL;
51 GlslManager* glsl = GlslManager::get_instance();
53 if ( glsl && ( filter = mlt_filter_new() ) ) {
54 mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
55 mlt_properties_set_int( properties, "matrix_size", 5 );
56 mlt_properties_set_double( properties, "circle_radius", 2.0 );
57 mlt_properties_set_double( properties, "gaussian_radius", 0.0 );
58 mlt_properties_set_double( properties, "correlation", 0.95 );
59 mlt_properties_set_double( properties, "noise", 0.01 );
60 filter->process = process;