[vlc-devel] [PATCH] Extracted sobel oeprator into its own function and simplified help message
Tristan Matthews
tmatth at videolan.org
Tue Feb 2 12:17:28 CET 2016
On Tue, Feb 2, 2016 at 12:10 PM, Tristan Matthews <tmatth at videolan.org> wrote:
> Hi,
>
> On Wed, Jan 27, 2016 at 5:50 PM, Odd-Arild Kristensen
> <oddarildkristensen at gmail.com> wrote:
>> ---
>> modules/video_filter/Makefile.am | 3 +
>> modules/video_filter/edgedetection.c | 218 +++++++++++++++++++++++++++++++++++
>> 2 files changed, 221 insertions(+)
>> create mode 100644 modules/video_filter/edgedetection.c
>>
>> diff --git a/modules/video_filter/Makefile.am b/modules/video_filter/Makefile.am
>> index ea0b72c..b2ff9cd 100644
>> --- a/modules/video_filter/Makefile.am
>> +++ b/modules/video_filter/Makefile.am
>> @@ -3,6 +3,8 @@ video_filterdir = $(pluginsdir)/video_filter
>> noinst_HEADERS += video_filter/filter_picture.h
>>
>> # video filters
>> +libedgedetection_plugin_la_SOURCES = video_filter/edgedetection.c
>> +libedgedetection_plugin_la_LIBADD = $(LIBM)
>> libadjust_plugin_la_SOURCES = video_filter/adjust.c video_filter/adjust_sat_hue.c video_filter/adjust_sat_hue.h
>> libadjust_plugin_la_LIBADD = $(LIBM)
>> libalphamask_plugin_la_SOURCES = video_filter/alphamask.c
>> @@ -75,6 +77,7 @@ video_filter_LTLIBRARIES = \
>> libcanvas_plugin.la \
>> libcolorthres_plugin.la \
>> libcroppadd_plugin.la \
>> + libedgedetection_plugin.la \
>> liberase_plugin.la \
>> libextract_plugin.la \
>> libgradient_plugin.la \
>> diff --git a/modules/video_filter/edgedetection.c b/modules/video_filter/edgedetection.c
>> new file mode 100644
>> index 0000000..dce0064
>> --- /dev/null
>> +++ b/modules/video_filter/edgedetection.c
>> @@ -0,0 +1,218 @@
>> +/******************************************************************************
>> + * edgedetection.c : edge detection plugin for VLC
>> + *****************************************************************************
>> + * Copyright (C) 2016 VLC authors and VideoLAN
>> + * $Id$
>> + *
>> + * Authors: Odd-Arild Kristensen <oddarildkristensen at gmail.com>
>> + *
>> + * This program is free software; you can redistribute it and/or modify it
>> + * under the terms of the GNU Lesser General Public License as published by
>> + * the Free Software Foundation; either version 2.1 of the License, or
>> + * (at your option) any later version.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU Lesser General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU Lesser General Public License
>> + * along with this program; if not, write to the Free Software Foundation,
>> + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>> + *****************************************************************************/
>> +
>> +/*****************************************************************************
>> + * Preabmle
>> + *****************************************************************************/
>> +#ifdef HAVE_CONFIG_H
>> +# include "config.h"
>> +#endif
>> +
>> +#include <assert.h>
>> +#include <vlc_common.h>
>> +#include <vlc_plugin.h>
>> +#include <vlc_filter.h>
>> +#include <string.h>
>> +
>> +/*****************************************************************************
>> + * Module descriptor
>> + *****************************************************************************/
>> +#define EDGE_DETECTION_DESCRIPTION N_( "Edge detection video filter" )
>> +#define EDGE_DETECTION_TEXT N_( "Edge detection" )
>> +#define EDGE_DETECTION_LONGTEXT N_( \
>> + "Detects edges in the frame and highlights them in white." )
>> +
>> +/*****************************************************************************
>> + * Local prototypes
>> + *****************************************************************************/
>> +static int Open( vlc_object_t * );
>> +static int Close( vlc_object_t * );
>> +static picture_t *new_frame( filter_t * );
>> +static picture_t *Filter( filter_t *, picture_t * );
>> +static int sobel( uint8_t const *, const int, const int, const int, const int);
>> +
>> +/* Kernel for X axis */
>> +static const int pi_kernel_x[3][3] = {
>> + {-1, 0, 1},
>> + {-2, 0, 2},
>> + {-1, 0, 1}
>> +};
>> +
>> +/* Kernel for Y axis */
>> +static const int pi_kernel_y[3][3] = {
>> + {-1, -2, -1},
>> + {0, 0, 0},
>> + {1, 2, 1}
>> +};
>> +
>> +vlc_module_begin ()
>> +
>> + set_description( EDGE_DETECTION_DESCRIPTION )
>> + set_shortname( EDGE_DETECTION_TEXT )
>> + set_help( EDGE_DETECTION_LONGTEXT )
>> + set_category( CAT_VIDEO )
>> + set_subcategory( SUBCAT_VIDEO_VFILTER )
>> +
>> + set_capability( "video filter2", 0 )
>> + set_callbacks( Open, Close )
>> +
>> +vlc_module_end ()
>> +
>> +/* Store the filter chain */
>> +struct filter_sys_t
>> +{
>> + filter_chain_t *p_chain;
>> +};
>> +
>> +/*****************************************************************************
>> + * Opens the filter.
>> + * Sets up the filer chain. The image needs to be black-and-white in order to
nit: "Sets up the filter chain."
More information about the vlc-devel
mailing list