From 2ff0b9b2de89a5ac6337f9d65899745997409c6c Mon Sep 17 00:00:00 2001 From: niels Date: Sat, 6 Jun 2015 01:25:03 +0200 Subject: [PATCH] fix marble effect, add 8 new GMIC plugins --- .../plugin-packs/lvdgmic/plugins/Makefile.am | 43 ++- .../lvdgmic/plugins/gmic_curvature.c | 146 +++++++++ .../lvdgmic/plugins/gmic_ditheredbw.c | 131 ++++++++ .../plugin-packs/lvdgmic/plugins/gmic_edges.c | 146 +++++++++ .../lvdgmic/plugins/gmic_freeform.c | 221 +++++++++++++ .../lvdgmic/plugins/gmic_lightrelief.c | 276 ++++++++++++++++ .../lvdgmic/plugins/gmic_marble.c | 2 +- .../lvdgmic/plugins/gmic_plasma.c | 179 ++++++++++ .../lvdgmic/plugins/gmic_quadratize.c | 158 +++++++++ .../lvdgmic/plugins/gmic_shifttiles.c | 168 ++++++++++ .../lvdgmic/plugins/gmic_sketchbw.c | 306 ++++++++++++++++++ .../lvdgmic/plugins/gmic_taquin.c | 157 +++++++++ 12 files changed, 1929 insertions(+), 4 deletions(-) create mode 100644 veejay-current/plugin-packs/lvdgmic/plugins/gmic_curvature.c create mode 100644 veejay-current/plugin-packs/lvdgmic/plugins/gmic_ditheredbw.c create mode 100644 veejay-current/plugin-packs/lvdgmic/plugins/gmic_edges.c create mode 100644 veejay-current/plugin-packs/lvdgmic/plugins/gmic_freeform.c create mode 100644 veejay-current/plugin-packs/lvdgmic/plugins/gmic_lightrelief.c create mode 100644 veejay-current/plugin-packs/lvdgmic/plugins/gmic_plasma.c create mode 100644 veejay-current/plugin-packs/lvdgmic/plugins/gmic_quadratize.c create mode 100644 veejay-current/plugin-packs/lvdgmic/plugins/gmic_shifttiles.c create mode 100644 veejay-current/plugin-packs/lvdgmic/plugins/gmic_sketchbw.c create mode 100644 veejay-current/plugin-packs/lvdgmic/plugins/gmic_taquin.c diff --git a/veejay-current/plugin-packs/lvdgmic/plugins/Makefile.am b/veejay-current/plugin-packs/lvdgmic/plugins/Makefile.am index 6929847d..f731292f 100644 --- a/veejay-current/plugin-packs/lvdgmic/plugins/Makefile.am +++ b/veejay-current/plugin-packs/lvdgmic/plugins/Makefile.am @@ -2,7 +2,6 @@ lividoplugin_LTLIBRARIES = gmic_cartoon.la \ gmic_cracks.la \ gmic_bokeh.la \ gmic_pencilbw.la \ -# gmic_arrayfade.la \ gmic_rodilius.la \ gmic_water.la \ gmic_wave.la \ @@ -23,8 +22,16 @@ lividoplugin_LTLIBRARIES = gmic_cartoon.la \ gmic_kuwahara.la \ gmic_pendrawing.la \ gmic_oldscool8bits.la \ -# gmic_sponge.la \ - gmic_tetris.la + gmic_tetris.la \ + gmic_shifttiles.la \ + gmic_edges.la \ + gmic_ditheredbw.la \ + gmic_taquin.la \ + gmic_quadratize.la \ + gmic_plasma.la \ + gmic_curvature.la \ + gmic_lightrelief.la \ + gmic_sketchbw.la gmic_cartoon_la_SOURCES = gmic_cartoon.c gmic_cartoon_la_LIBADD = -L$(top_builddir)/liblvdgmic -llvdgmic @@ -110,6 +117,36 @@ gmic_oldscool8bits_la_LIBADD = -L$(top_builddir)/liblvdgmic -llvdgmic gmic_tetris_la_SOURCES = gmic_tetris.c gmic_tetris_la_LIBADD = -L$(top_builddir)/liblvdgmic -llvdgmic +gmic_shifttiles_la_SOURCES = gmic_shifttiles.c +gmic_shifttiles_la_LIBADD = -L$(top_builddir)/liblvdgmic -llvdgmic + +gmic_edges_la_SOURCES = gmic_edges.c +gmic_edges_la_LIBADD = -L$(top_builddir)/liblvdgmic -llvdgmic + +gmic_ditheredbw_la_SOURCES = gmic_ditheredbw.c +gmic_ditheredbw_la_LIBADD = -L$(top_builddir)/liblvdgmic -llvdgmic + +gmic_taquin_la_SOURCES = gmic_taquin.c +gmic_taquin_la_LIBADD = -L$(top_builddir)/liblvdgmic -llvdgmic + +gmic_quadratize_la_SOURCES = gmic_quadratize.c +gmic_quadratize_la_LIBADD = -L$(top_builddir)/liblvdgmic -llvdgmic + +gmic_plasma_la_SOURCES = gmic_plasma.c +gmic_plasma_la_LIBADD = -L$(top_builddir)/liblvdgmic -llvdgmic + +gmic_curvature_la_SOURCES = gmic_curvature.c +gmic_curvature_la_LIBADD = -L$(top_builddir)/liblvdgmic -llvdgmic + +#gmic_freeform_la_SOURCES = gmic_freeform.c +#gmic_freeform_la_LIBADD = -L$(top_builddir)/liblvdgmic -llvdgmic + +gmic_lightrelief_la_SOURCES = gmic_lightrelief.c +gmic_lightrelief_la_LIBADD = -L$(top_builddir)/liblvdgmic -llvdgmic + +#very slow +#gmic_sketchbw_la_SOURCES = gmic_sketchbw.c +#gmic_sketchbw_la_LIBADD = -L$(top_builddir)/liblvdgmic -llvdgmic INCLUDES=$(FFMPEG_CFLAGS) -I$(top_srcdir)/liblvdgmic AM_CFLAGS=-I@top_srcdir@/include $(OPTCFLAGS) -DSILENT diff --git a/veejay-current/plugin-packs/lvdgmic/plugins/gmic_curvature.c b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_curvature.c new file mode 100644 index 00000000..7822e7d8 --- /dev/null +++ b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_curvature.c @@ -0,0 +1,146 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2015 Niels Elburg + * See COPYING for software license and distribution details + * + */ + +#ifndef IS_LIVIDO_PLUGIN +#define IS_LIVIDO_PLUGIN +#endif + +#include "livido.h" +LIVIDO_PLUGIN +#include "utils.h" +#include "livido-utils.c" +#include "lvd_common.h" +#include "lvdgmicglue.h" + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = lvdgmic_new(1); + + livido_property_set( my_instance, "PLUGIN_private", + LIVIDO_ATOM_TYPE_VOIDPTR,1,&gmic ); + + return LIVIDO_NO_ERROR; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + lvdgmic_delete(gmic); + + return LIVIDO_NO_ERROR; +} + + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + char cmd[256]; + int palette; + int w; + int h; + + int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + + lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette ); + + int strength = lvd_extract_param_index( my_instance,"in_parameters", 0 ); + + snprintf(cmd,sizeof(cmd),"-blur %d -curvature",strength ); + + lvdgmic_push( gmic, w, h, 0, A, 0); + + lvdgmic_gmic( gmic, cmd ); + + lvdgmic_pull( gmic, 0, O ); + + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_params[1]; + livido_port_t *in_chans[3]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + //@ setup root node, plugin info + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + + //@ setup function pointers + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + port = filter; + + //@ meta information + livido_set_string_value( port, "name", "G'MIC/GREYs Curvature"); + livido_set_string_value( port, "description", "Compute isophote curvatures on image"); + livido_set_string_value( port, "author", "GREYC's Magic for Image Computing"); + + livido_set_int_value( port, "flags", LIVIDO_FILTER_NON_REALTIME); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + //@ some palettes veejay-classic uses + int palettes0[] = { + LIVIDO_PALETTE_YUV444P, + 0, + }; + + //@ setup output channel + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + livido_set_string_value( port, "name", "Input Channel"); + livido_set_int_array( port, "palette_list", 4, palettes0); + livido_set_int_value( port, "flags", 0); + + in_params[0] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[0]; + + livido_set_string_value(port, "name", "Strength" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100); + livido_set_int_value( port, "default", 1 ); + livido_set_string_value( port, "description" ,"Strength"); + + + //@ setup the nodes + livido_set_portptr_array( filter, "in_parameter_templates",1, in_params ); + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + livido_set_portptr_array( filter, "in_channel_templates",1, in_chans ); + + livido_set_portptr_value(info, "filters", filter); + return info; +} diff --git a/veejay-current/plugin-packs/lvdgmic/plugins/gmic_ditheredbw.c b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_ditheredbw.c new file mode 100644 index 00000000..7558a472 --- /dev/null +++ b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_ditheredbw.c @@ -0,0 +1,131 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2015 Niels Elburg + * See COPYING for software license and distribution details + * + */ + +#ifndef IS_LIVIDO_PLUGIN +#define IS_LIVIDO_PLUGIN +#endif + +#include "livido.h" +LIVIDO_PLUGIN +#include "utils.h" +#include "livido-utils.c" +#include "lvd_common.h" +#include "lvdgmicglue.h" + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = lvdgmic_new(1); + + livido_property_set( my_instance, "PLUGIN_private", + LIVIDO_ATOM_TYPE_VOIDPTR,1,&gmic ); + + return LIVIDO_NO_ERROR; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + lvdgmic_delete(gmic); + + return LIVIDO_NO_ERROR; +} + + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + char cmd[256]; + int palette; + int w; + int h; + + int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + + lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette ); + + snprintf(cmd,sizeof(cmd),"-ditheredbw" ); + + lvdgmic_push( gmic, w, h, 0, A, 0); + + lvdgmic_gmic( gmic, cmd ); + + lvdgmic_pull( gmic, 0, O ); + + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_chans[3]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + //@ setup root node, plugin info + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + + //@ setup function pointers + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + port = filter; + + //@ meta information + livido_set_string_value( port, "name", "G'MIC/GREYs DitheredBW"); + livido_set_string_value( port, "description", "Create dithered B&W version of image"); + livido_set_string_value( port, "author", "GREYC's Magic for Image Computing"); + + livido_set_int_value( port, "flags", LIVIDO_FILTER_NON_REALTIME); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + //@ some palettes veejay-classic uses + int palettes0[] = { + LIVIDO_PALETTE_YUV422P, + LIVIDO_PALETTE_YUV444P, + 0, + }; + + //@ setup output channel + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + livido_set_string_value( port, "name", "Input Channel"); + livido_set_int_array( port, "palette_list", 4, palettes0); + livido_set_int_value( port, "flags", 0); + + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + livido_set_portptr_array( filter, "in_channel_templates",1, in_chans ); + + livido_set_portptr_value(info, "filters", filter); + return info; +} diff --git a/veejay-current/plugin-packs/lvdgmic/plugins/gmic_edges.c b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_edges.c new file mode 100644 index 00000000..d90a7bc3 --- /dev/null +++ b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_edges.c @@ -0,0 +1,146 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2015 Niels Elburg + * See COPYING for software license and distribution details + * + */ + +#ifndef IS_LIVIDO_PLUGIN +#define IS_LIVIDO_PLUGIN +#endif + +#include "livido.h" +LIVIDO_PLUGIN +#include "utils.h" +#include "livido-utils.c" +#include "lvd_common.h" +#include "lvdgmicglue.h" + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = lvdgmic_new(1); + + livido_property_set( my_instance, "PLUGIN_private", + LIVIDO_ATOM_TYPE_VOIDPTR,1,&gmic ); + + return LIVIDO_NO_ERROR; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + lvdgmic_delete(gmic); + + return LIVIDO_NO_ERROR; +} + + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + char cmd[256]; + int palette; + int w; + int h; + + int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + + lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette ); + + int threshold = lvd_extract_param_index( my_instance,"in_parameters", 0 ); + + snprintf(cmd,sizeof(cmd),"-edges %d",threshold ); + + lvdgmic_push( gmic, w, h, 0, A, 0); + + lvdgmic_gmic( gmic, cmd ); + + lvdgmic_pull( gmic, 0, O ); + + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_params[1]; + livido_port_t *in_chans[3]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + //@ setup root node, plugin info + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + + //@ setup function pointers + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + port = filter; + + //@ meta information + livido_set_string_value( port, "name", "G'MIC/GREYs Edges"); + livido_set_string_value( port, "description", "Estimate countours of selected image"); + livido_set_string_value( port, "author", "GREYC's Magic for Image Computing"); + + livido_set_int_value( port, "flags", LIVIDO_FILTER_NON_REALTIME); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + //@ some palettes veejay-classic uses + int palettes0[] = { + LIVIDO_PALETTE_YUV444P, + 0, + }; + + //@ setup output channel + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + livido_set_string_value( port, "name", "Input Channel"); + livido_set_int_array( port, "palette_list", 4, palettes0); + livido_set_int_value( port, "flags", 0); + + in_params[0] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[0]; + + livido_set_string_value(port, "name", "Threshold" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 255); + livido_set_int_value( port, "default", 15 ); + livido_set_string_value( port, "description" ,"Threshold"); + + + //@ setup the nodes + livido_set_portptr_array( filter, "in_parameter_templates",1, in_params ); + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + livido_set_portptr_array( filter, "in_channel_templates",1, in_chans ); + + livido_set_portptr_value(info, "filters", filter); + return info; +} diff --git a/veejay-current/plugin-packs/lvdgmic/plugins/gmic_freeform.c b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_freeform.c new file mode 100644 index 00000000..b53ae2bb --- /dev/null +++ b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_freeform.c @@ -0,0 +1,221 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2015 Niels Elburg + * See COPYING for software license and distribution details + * + */ + +#ifndef IS_LIVIDO_PLUGIN +#define IS_LIVIDO_PLUGIN +#endif + +#include "livido.h" +LIVIDO_PLUGIN +#include "utils.h" +#include "livido-utils.c" +#include "lvd_common.h" +#include "lvdgmicglue.h" + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = lvdgmic_new(1); + + livido_property_set( my_instance, "PLUGIN_private", + LIVIDO_ATOM_TYPE_VOIDPTR,1,&gmic ); + + return LIVIDO_NO_ERROR; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + lvdgmic_delete(gmic); + + return LIVIDO_NO_ERROR; +} + + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + char cmd[256]; + int palette; + int w; + int h; + + int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + + lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette ); + + int erode1 = lvd_extract_param_index( my_instance,"in_parameters", 0 ); + int erode2 = lvd_extract_param_index( my_instance,"in_parameters", 1 ); + int amplitude = lvd_extract_param_index( my_instance,"in_parameters", 2 ); + int sharpness = lvd_extract_param_index(my_instance, "in_parameters",3); + int anisotropy = lvd_extract_param_index(my_instance, "in_parameters",4); + int alpha = lvd_extract_param_index(my_instance, "in_parameters",5); + int sigma = lvd_extract_param_index(my_instance, "in_parameters",6); + + snprintf(cmd,sizeof(cmd),"-erode %d -erode %d -equalize 255 -smooth %f,%f,%f,%f", + erode1, + erode2, + amplitude/100.0f, + sharpness/100.0f, + anisotropy/100.0f, + alpha/100.0f, + sigma/100.0f + ); + + lvdgmic_push( gmic, w, h, palette, A, 0); + + lvdgmic_gmic( gmic, cmd ); + + lvdgmic_pull( gmic, 0, O ); + + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_params[7]; + livido_port_t *in_chans[3]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + //@ setup root node, plugin info + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + + //@ setup function pointers + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + port = filter; + + //@ meta information + livido_set_string_value( port, "name", "G'MIC/GREYs Line Accent"); + livido_set_string_value( port, "description", "Apply Line Accent"); + livido_set_string_value( port, "author", "GREYC's Magic for Image Computing"); + + livido_set_int_value( port, "flags", LIVIDO_FILTER_NON_REALTIME); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + //@ some palettes veejay-classic uses + int palettes0[] = { + LIVIDO_PALETTE_YUV422P, + 0, + }; + + //@ setup output channel + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + livido_set_string_value( port, "name", "Input Channel"); + livido_set_int_array( port, "palette_list", 4, palettes0); + livido_set_int_value( port, "flags", 0); + + in_params[0] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[0]; + + livido_set_string_value(port, "name", "Erode" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 30 ); + livido_set_int_value( port, "default", 10 ); + livido_set_string_value( port, "description" ,"Erode (pass 1)"); + + + in_params[1] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[1]; + + livido_set_string_value(port, "name", "Erode" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 30 ); + livido_set_int_value( port, "default", 3 ); + livido_set_string_value( port, "description" ,"Erode (pass 2)"); + + in_params[2] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[2]; + + livido_set_string_value(port, "name", "Ampltiude" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 400 ); + livido_set_int_value( port, "default", 80 ); + livido_set_string_value( port, "description" ,"Amplitude"); + + in_params[3] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[3]; + + livido_set_string_value(port, "name", "Sharpness" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default",0 ); + livido_set_string_value( port, "description" ,"Sharpness"); + + in_params[4] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[4]; + + livido_set_string_value(port, "name", "Anisotropy" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default",0 ); + livido_set_string_value( port, "description" ,"Anisotropy"); + + in_params[5] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[5]; + + livido_set_string_value(port, "name", "Alpha" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default",100 ); + livido_set_string_value( port, "description" ,"Alpha"); + + + in_params[6] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[6]; + + livido_set_string_value(port, "name", "Sigma" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 200 ); + livido_set_int_value( port, "default",6 ); + livido_set_string_value( port, "description" ,"Sigma"); + + + livido_set_portptr_array( filter, "in_parameter_templates",7, in_params ); + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + livido_set_portptr_array( filter, "in_channel_templates",1, in_chans ); + + livido_set_portptr_value(info, "filters", filter); + return info; +} diff --git a/veejay-current/plugin-packs/lvdgmic/plugins/gmic_lightrelief.c b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_lightrelief.c new file mode 100644 index 00000000..3f34931f --- /dev/null +++ b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_lightrelief.c @@ -0,0 +1,276 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2015 Niels Elburg + * See COPYING for software license and distribution details + * + */ + +#ifndef IS_LIVIDO_PLUGIN +#define IS_LIVIDO_PLUGIN +#endif + +#include "livido.h" +LIVIDO_PLUGIN +#include "utils.h" +#include "livido-utils.c" +#include "lvd_common.h" +#include "lvdgmicglue.h" + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = lvdgmic_new(1); + + livido_property_set( my_instance, "PLUGIN_private", + LIVIDO_ATOM_TYPE_VOIDPTR,1,&gmic ); + + return LIVIDO_NO_ERROR; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + lvdgmic_delete(gmic); + + return LIVIDO_NO_ERROR; +} + + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + char cmd[256]; + int palette; + int w; + int h; + + int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + + lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette ); + + int p1 = lvd_extract_param_index( my_instance,"in_parameters", 0 ); + int p2 = lvd_extract_param_index( my_instance,"in_parameters", 1 ); + int p3 = lvd_extract_param_index(my_instance, "in_parameters",2); + int p4 = lvd_extract_param_index(my_instance, "in_parameters",3); + int p5 = lvd_extract_param_index(my_instance, "in_parameters",4); + int p6 = lvd_extract_param_index(my_instance, "in_parameters",5); + int p7 = lvd_extract_param_index(my_instance, "in_parameters",6); + int p8 = lvd_extract_param_index(my_instance, "in_parameters",7); + int p9 = lvd_extract_param_index(my_instance, "in_parameters",8); + int p10 = lvd_extract_param_index(my_instance, "in_parameters",9); + int p11 = lvd_extract_param_index(my_instance, "in_parameters",10); + + + snprintf(cmd,sizeof(cmd),"-gimp_light_relief %f,%f,%f,%f,%d,%f,%f,%d,%f,%d,%d", + (float) p1/100.0f, + (float) p2/100.0f, + (float) p3/100.0f, + (float) p4/100.0f, + p5, + (float) p6/100.0f, + (float) p7/100.0f, + p8, + (float) p9/100.0f, + p10, + p11); + + lvdgmic_push( gmic, w, h, palette, A, 0); + + lvdgmic_gmic( gmic, cmd ); + + lvdgmic_pull( gmic, 0, O ); + + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_params[11]; + livido_port_t *in_chans[3]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + //@ setup root node, plugin info + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + + //@ setup function pointers + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + port = filter; + + //@ meta information + livido_set_string_value( port, "name", "G'MIC/GREYs Light Relief"); + livido_set_string_value( port, "description", "Apply Light Relief"); + livido_set_string_value( port, "author", "GREYC's Magic for Image Computing"); + + livido_set_int_value( port, "flags", LIVIDO_FILTER_NON_REALTIME); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + //@ some palettes veejay-classic uses + int palettes0[] = { + LIVIDO_PALETTE_YUV422P, + 0, + }; + + //@ setup output channel + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + livido_set_string_value( port, "name", "Input Channel"); + livido_set_int_array( port, "palette_list", 4, palettes0); + livido_set_int_value( port, "flags", 0); + + in_params[0] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[0]; + + livido_set_string_value(port, "name", "Ambient lightness" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 500 ); + livido_set_int_value( port, "default", 30 ); + livido_set_string_value( port, "description" ,"Ambient lightness"); + + + in_params[1] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[1]; + + livido_set_string_value(port, "name", "Specular lightness" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 200 ); + livido_set_int_value( port, "default", 20 ); + livido_set_string_value( port, "description" ,"Specular lightness"); + + in_params[2] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[2]; + + livido_set_string_value(port, "name", "Specular size" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default", 10 ); + livido_set_string_value( port, "description" ,"Specular size"); + + in_params[3] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[3]; + + livido_set_string_value(port, "name", "Darkness" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default",0 ); + livido_set_string_value( port, "description" ,"Darkness"); + + in_params[4] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[4]; + + livido_set_string_value(port, "name", "Light smoothness" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 5 ); + livido_set_int_value( port, "default",1 ); + livido_set_string_value( port, "description" ,"Light smoothness"); + + in_params[5] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[5]; + + livido_set_string_value(port, "name", "X-light" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default",50 ); + livido_set_string_value( port, "description" ,"X-light"); + + + in_params[6] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[6]; + + livido_set_string_value(port, "name", "Y-light" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default",50 ); + livido_set_string_value( port, "description" ,"Y-light"); + + + + in_params[7] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[7]; + + livido_set_string_value(port, "name", "Z-light" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 20 ); + livido_set_int_value( port, "default",5 ); + livido_set_string_value( port, "description" ,"Z-light"); + + + in_params[8] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[8]; + + livido_set_string_value(port, "name", "Z-scale" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 300 ); + livido_set_int_value( port, "default",50 ); + livido_set_string_value( port, "description" ,"Z-scale"); + + + + in_params[9] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[9]; + + livido_set_string_value(port, "name", "Opacity" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max",1 ); + livido_set_int_value( port, "default",0 ); + livido_set_string_value( port, "description" ,"Opacity as heightmap"); + + + in_params[10] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[10]; + + livido_set_string_value(port, "name", "Smoothness" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max",10 ); + livido_set_int_value( port, "default",0 ); + livido_set_string_value( port, "description" ,"Image smoothness"); + + + //@ setup the nodes + livido_set_portptr_array( filter, "in_parameter_templates",11, in_params ); + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + livido_set_portptr_array( filter, "in_channel_templates",1, in_chans ); + + livido_set_portptr_value(info, "filters", filter); + return info; +} diff --git a/veejay-current/plugin-packs/lvdgmic/plugins/gmic_marble.c b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_marble.c index e39ffddb..c0be72a1 100644 --- a/veejay-current/plugin-packs/lvdgmic/plugins/gmic_marble.c +++ b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_marble.c @@ -87,7 +87,7 @@ livido_port_t *livido_setup(livido_setup_t list[], int version) LIVIDO_IMPORT(list); livido_port_t *port = NULL; - livido_port_t *in_params[10]; + livido_port_t *in_params[11]; livido_port_t *in_chans[3]; livido_port_t *out_chans[1]; livido_port_t *info = NULL; diff --git a/veejay-current/plugin-packs/lvdgmic/plugins/gmic_plasma.c b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_plasma.c new file mode 100644 index 00000000..40dfaa0b --- /dev/null +++ b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_plasma.c @@ -0,0 +1,179 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2015 Niels Elburg + * See COPYING for software license and distribution details + * + */ + +#ifndef IS_LIVIDO_PLUGIN +#define IS_LIVIDO_PLUGIN +#endif + +#include "livido.h" +LIVIDO_PLUGIN +#include "utils.h" +#include "livido-utils.c" +#include "lvd_common.h" +#include "lvdgmicglue.h" + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = lvdgmic_new(1); + + livido_property_set( my_instance, "PLUGIN_private", + LIVIDO_ATOM_TYPE_VOIDPTR,1,&gmic ); + + return LIVIDO_NO_ERROR; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + lvdgmic_delete(gmic); + + return LIVIDO_NO_ERROR; +} + + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + char cmd[256]; + int palette; + int w; + int h; + + int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + + lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette ); + + int alpha = lvd_extract_param_index( my_instance,"in_parameters", 0 ); + int beta = lvd_extract_param_index( my_instance,"in_parameters", 1 ); + int scale = lvd_extract_param_index(my_instance, "in_parameters",2); + int seed = lvd_extract_param_index(my_instance, "in_parameters",3); + + snprintf(cmd,sizeof(cmd),"-srand %d -plasma %f,%f,%d", seed,alpha/100.0f, beta/100.0f, scale ); + + lvdgmic_push( gmic, w, h, 0, A, 0); + + lvdgmic_gmic( gmic, cmd ); + + lvdgmic_pull( gmic, 0, O ); + + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_params[4]; + livido_port_t *in_chans[3]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + //@ setup root node, plugin info + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + + //@ setup function pointers + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + port = filter; + + //@ meta information + livido_set_string_value( port, "name", "G'MIC/GREYs Plasma"); + livido_set_string_value( port, "description", "Draw random colored plasma fractal"); + livido_set_string_value( port, "author", "GREYC's Magic for Image Computing"); + + livido_set_int_value( port, "flags", LIVIDO_FILTER_NON_REALTIME); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + //@ some palettes veejay-classic uses + int palettes0[] = { + LIVIDO_PALETTE_YUV444P, + 0, + }; + + //@ setup output channel + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + livido_set_string_value( port, "name", "Input Channel"); + livido_set_int_array( port, "palette_list", 4, palettes0); + livido_set_int_value( port, "flags", 0); + + in_params[0] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[0]; + + livido_set_string_value(port, "name", "Alpha" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 200 ); + livido_set_int_value( port, "default", 100 ); + livido_set_string_value( port, "description" ,"Alpha"); + + + in_params[1] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[1]; + + livido_set_string_value(port, "name", "Beta" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 200 ); + livido_set_int_value( port, "default", 100); + livido_set_string_value( port, "description" ,"Beta"); + + in_params[2] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[2]; + + livido_set_string_value(port, "name", "Scale" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default", 8); + livido_set_string_value( port, "description" ,"Scale"); + + in_params[3] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[3]; + + livido_set_string_value(port, "name", "Seed" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 65535 ); + livido_set_int_value( port, "default", 0); + livido_set_string_value( port, "description" ,"Random Seed"); + + //@ setup the nodes + livido_set_portptr_array( filter, "in_parameter_templates",4, in_params ); + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + livido_set_portptr_array( filter, "in_channel_templates",1, in_chans ); + + livido_set_portptr_value(info, "filters", filter); + return info; +} diff --git a/veejay-current/plugin-packs/lvdgmic/plugins/gmic_quadratize.c b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_quadratize.c new file mode 100644 index 00000000..a7fb29eb --- /dev/null +++ b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_quadratize.c @@ -0,0 +1,158 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2015 Niels Elburg + * See COPYING for software license and distribution details + * + */ + +#ifndef IS_LIVIDO_PLUGIN +#define IS_LIVIDO_PLUGIN +#endif + +#include "livido.h" +LIVIDO_PLUGIN +#include "utils.h" +#include "livido-utils.c" +#include "lvd_common.h" +#include "lvdgmicglue.h" + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = lvdgmic_new(1); + + livido_property_set( my_instance, "PLUGIN_private", + LIVIDO_ATOM_TYPE_VOIDPTR,1,&gmic ); + + return LIVIDO_NO_ERROR; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + lvdgmic_delete(gmic); + + return LIVIDO_NO_ERROR; +} + + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + char cmd[256]; + int palette; + int w; + int h; + + int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + + lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette ); + + int xtiles = lvd_extract_param_index( my_instance,"in_parameters", 0 ); + int ytiles = lvd_extract_param_index( my_instance,"in_parameters", 1 ); + + snprintf(cmd,sizeof(cmd),"-quadratize_tiles %d,%d", xtiles,ytiles ); + + lvdgmic_push( gmic, w, h, 0, A, 0); + + lvdgmic_gmic( gmic, cmd ); + + lvdgmic_pull( gmic, 0, O ); + + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_params[3]; + livido_port_t *in_chans[3]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + //@ setup root node, plugin info + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + + //@ setup function pointers + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + port = filter; + + //@ meta information + livido_set_string_value( port, "name", "G'MIC/GREYs Quadratize Tiles"); + livido_set_string_value( port, "description", "Quadratize MxN tiles on image"); + livido_set_string_value( port, "author", "GREYC's Magic for Image Computing"); + + livido_set_int_value( port, "flags", LIVIDO_FILTER_NON_REALTIME); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + //@ some palettes veejay-classic uses + int palettes0[] = { + LIVIDO_PALETTE_YUV422P, + LIVIDO_PALETTE_YUV444P, + 0, + }; + + //@ setup output channel + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + livido_set_string_value( port, "name", "Input Channel"); + livido_set_int_array( port, "palette_list", 4, palettes0); + livido_set_int_value( port, "flags", 0); + + in_params[0] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[0]; + + livido_set_string_value(port, "name", "X tiles" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default", 8 ); + livido_set_string_value( port, "description" ,"X tiles"); + + + in_params[1] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[1]; + + livido_set_string_value(port, "name", "Y tiles" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default", 8); + livido_set_string_value( port, "description" ,"Y tiles"); + + //@ setup the nodes + livido_set_portptr_array( filter, "in_parameter_templates",2, in_params ); + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + livido_set_portptr_array( filter, "in_channel_templates",1, in_chans ); + + livido_set_portptr_value(info, "filters", filter); + return info; +} diff --git a/veejay-current/plugin-packs/lvdgmic/plugins/gmic_shifttiles.c b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_shifttiles.c new file mode 100644 index 00000000..20aee88c --- /dev/null +++ b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_shifttiles.c @@ -0,0 +1,168 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2015 Niels Elburg + * See COPYING for software license and distribution details + * + */ + +#ifndef IS_LIVIDO_PLUGIN +#define IS_LIVIDO_PLUGIN +#endif + +#include "livido.h" +LIVIDO_PLUGIN +#include "utils.h" +#include "livido-utils.c" +#include "lvd_common.h" +#include "lvdgmicglue.h" + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = lvdgmic_new(1); + + livido_property_set( my_instance, "PLUGIN_private", + LIVIDO_ATOM_TYPE_VOIDPTR,1,&gmic ); + + return LIVIDO_NO_ERROR; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + lvdgmic_delete(gmic); + + return LIVIDO_NO_ERROR; +} + + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + char cmd[256]; + int palette; + int w; + int h; + + int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + + lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette ); + + int N = lvd_extract_param_index( my_instance,"in_parameters", 0 ); + int M = lvd_extract_param_index( my_instance,"in_parameters", 1 ); + int amplitude = lvd_extract_param_index(my_instance, "in_parameters",2); + + snprintf(cmd,sizeof(cmd),"-shift_tiles %d,%d,%d", N, M, amplitude ); + + lvdgmic_push( gmic, w, h, 0, A, 0); + + lvdgmic_gmic( gmic, cmd ); + + lvdgmic_pull( gmic, 0, O ); + + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_params[3]; + livido_port_t *in_chans[3]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + //@ setup root node, plugin info + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + + //@ setup function pointers + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + port = filter; + + //@ meta information + livido_set_string_value( port, "name", "G'MIC/GREYs Shift Tiles"); + livido_set_string_value( port, "description", "Apply MxN tiled-shift effect on image"); + livido_set_string_value( port, "author", "GREYC's Magic for Image Computing"); + + livido_set_int_value( port, "flags", LIVIDO_FILTER_NON_REALTIME); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + //@ some palettes veejay-classic uses + int palettes0[] = { + LIVIDO_PALETTE_YUV444P, + 0, + }; + + //@ setup output channel + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + livido_set_string_value( port, "name", "Input Channel"); + livido_set_int_array( port, "palette_list", 4, palettes0); + livido_set_int_value( port, "flags", 0); + + in_params[0] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[0]; + + livido_set_string_value(port, "name", "X tiles" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default", 8 ); + livido_set_string_value( port, "description" ,"X tiles"); + + + in_params[1] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[1]; + + livido_set_string_value(port, "name", "Y tiles" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default", 8); + livido_set_string_value( port, "description" ,"Y tiles"); + + in_params[2] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[2]; + + livido_set_string_value(port, "name", "Amplitude" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default", 10 ); + livido_set_string_value( port, "description" ,"Amplitude"); + + //@ setup the nodes + livido_set_portptr_array( filter, "in_parameter_templates",3, in_params ); + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + livido_set_portptr_array( filter, "in_channel_templates",1, in_chans ); + + livido_set_portptr_value(info, "filters", filter); + return info; +} diff --git a/veejay-current/plugin-packs/lvdgmic/plugins/gmic_sketchbw.c b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_sketchbw.c new file mode 100644 index 00000000..f05d79cb --- /dev/null +++ b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_sketchbw.c @@ -0,0 +1,306 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2015 Niels Elburg + * See COPYING for software license and distribution details + * + */ + +#ifndef IS_LIVIDO_PLUGIN +#define IS_LIVIDO_PLUGIN +#endif + +#include "livido.h" +LIVIDO_PLUGIN +#include "utils.h" +#include "livido-utils.c" +#include "lvd_common.h" +#include "lvdgmicglue.h" + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = lvdgmic_new(1); + + livido_property_set( my_instance, "PLUGIN_private", + LIVIDO_ATOM_TYPE_VOIDPTR,1,&gmic ); + + return LIVIDO_NO_ERROR; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + lvdgmic_delete(gmic); + + return LIVIDO_NO_ERROR; +} + + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + char cmd[256]; + int palette; + int w; + int h; + + int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + + lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette ); + + int orientations = lvd_extract_param_index( my_instance,"in_parameters", 0 ); + int starting_angle = lvd_extract_param_index( my_instance,"in_parameters", 1 ); + int angle_range = lvd_extract_param_index(my_instance, "in_parameters",2); + int stroke_length = lvd_extract_param_index(my_instance, "in_parameters",3); + int contour_threshold = lvd_extract_param_index(my_instance, "in_parameters",4); + int opacity = lvd_extract_param_index( my_instance,"in_parameters", 5); + int bg_intensity = lvd_extract_param_index( my_instance,"in_parameters",6); + int density = lvd_extract_param_index(my_instance, "in_parameters",7); + int sharpness = lvd_extract_param_index(my_instance, "in_parameters",8); + int anisotropy = lvd_extract_param_index(my_instance, "in_parameters",9); + int smoothness = lvd_extract_param_index( my_instance,"in_parameters",10); + int coherence = lvd_extract_param_index( my_instance,"in_parameters",11); + int boost_stroke = lvd_extract_param_index(my_instance, "in_parameters",12); + int curved_stroke = lvd_extract_param_index(my_instance, "in_parameters",13); + + snprintf(cmd,sizeof(cmd),"-sketchbw %d,%d,%d,%d,%d,%f,%d,%f,%f,%f,%f,%d,%d,%d", + orientations, + starting_angle, + angle_range, + stroke_length, + contour_threshold, + (float)opacity/100.0f, + bg_intensity, + (float)density/100.0f, + (float)sharpness/100.0f, + (float)anisotropy/100.0f, + (float)smoothness/100.0f, + coherence, + boost_stroke, + curved_stroke + ); + + lvdgmic_push( gmic, w, h, 0, A, 0); + + lvdgmic_gmic( gmic, cmd ); + + lvdgmic_pull( gmic, 0, O ); + + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_params[14]; + livido_port_t *in_chans[3]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + //@ setup root node, plugin info + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + + //@ setup function pointers + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + port = filter; + + //@ meta information + livido_set_string_value( port, "name", "G'MIC/GREYs Sketch BW"); + livido_set_string_value( port, "description", "Draw BW sketch"); + livido_set_string_value( port, "author", "GREYC's Magic for Image Computing"); + + livido_set_int_value( port, "flags", LIVIDO_FILTER_NON_REALTIME); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + //@ some palettes veejay-classic uses + int palettes0[] = { + LIVIDO_PALETTE_YUV444P, + 0, + }; + + //@ setup output channel + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + livido_set_string_value( port, "name", "Input Channel"); + livido_set_int_array( port, "palette_list", 4, palettes0); + livido_set_int_value( port, "flags", 0); + + in_params[0] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[0]; + + livido_set_string_value(port, "name", "Orientations" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 1 ); + livido_set_int_value( port, "max", 16 ); + livido_set_int_value( port, "default", 2 ); + livido_set_string_value( port, "description" ,"Number of orientations"); + + + in_params[1] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[1]; + + livido_set_string_value(port, "name", "Starting angle" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 180 ); + livido_set_int_value( port, "default", 45); + livido_set_string_value( port, "description" ,"Starting angle"); + + in_params[2] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[2]; + + livido_set_string_value(port, "name", "Angle range" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 180 ); + livido_set_int_value( port, "default", 180); + livido_set_string_value( port, "description" ,"Angle range"); + + in_params[3] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[3]; + + livido_set_string_value(port, "name", "Stroke length" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 1000 ); + livido_set_int_value( port, "default", 30); + livido_set_string_value( port, "description" ,"Stroke length"); + + in_params[4] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[4]; + + livido_set_string_value(port, "name", "Contour threshold" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 3 ); + livido_set_int_value( port, "default", 1); + livido_set_string_value( port, "description" ,"Contour threshold" ); + + in_params[5] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[5]; + + livido_set_string_value(port, "name", "Opacity" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default", 1); + livido_set_string_value( port, "description" ,"Opacity" ); + + in_params[6] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[6]; + + livido_set_string_value(port, "name", "Background intensity" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 2); + livido_set_int_value( port, "default", 0); + livido_set_string_value( port, "description" ,"Background intensity" ); + + in_params[7] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[7]; + + livido_set_string_value(port, "name", "Density" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 500); + livido_set_int_value( port, "default", 60); + livido_set_string_value( port, "description" ,"Density" ); + + + in_params[8] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[8]; + + livido_set_string_value(port, "name", "Sharpness" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 150); + livido_set_int_value( port, "default", 10); + livido_set_string_value( port, "description" ,"Sharpness" ); + + in_params[9] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[9]; + + livido_set_string_value(port, "name", "Anisotropy" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 1); + livido_set_int_value( port, "default", 6); + livido_set_string_value( port, "description" ,"Anisotropy" ); + + in_params[10] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[10]; + + livido_set_string_value(port, "name", "Smoothness" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 1000); + livido_set_int_value( port, "default", 25); + livido_set_string_value( port, "description" ,"Anisotropy" ); + + + in_params[11] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[11]; + + livido_set_string_value(port, "name", "Coherence" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 10); + livido_set_int_value( port, "default", 1); + livido_set_string_value( port, "description" ,"Coherence" ); + + in_params[12] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[12]; + + livido_set_string_value(port, "name", "Boost stroke" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 1); + livido_set_int_value( port, "default", 0); + livido_set_string_value( port, "description" ,"Boost stroke" ); + + in_params[13] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[13]; + + livido_set_string_value(port, "name", "Curved stroke" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 1); + livido_set_int_value( port, "default", 0); + livido_set_string_value( port, "description" ,"Curved stroke" ); + + //@ setup the nodes + livido_set_portptr_array( filter, "in_parameter_templates",14, in_params ); + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + livido_set_portptr_array( filter, "in_channel_templates",1, in_chans ); + + livido_set_portptr_value(info, "filters", filter); + return info; +} diff --git a/veejay-current/plugin-packs/lvdgmic/plugins/gmic_taquin.c b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_taquin.c new file mode 100644 index 00000000..8ceb24fc --- /dev/null +++ b/veejay-current/plugin-packs/lvdgmic/plugins/gmic_taquin.c @@ -0,0 +1,157 @@ +/* + * LIBVJE - veejay fx library + * + * Copyright(C)2015 Niels Elburg + * See COPYING for software license and distribution details + * + */ + +#ifndef IS_LIVIDO_PLUGIN +#define IS_LIVIDO_PLUGIN +#endif + +#include "livido.h" +LIVIDO_PLUGIN +#include "utils.h" +#include "livido-utils.c" +#include "lvd_common.h" +#include "lvdgmicglue.h" + +livido_init_f init_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = lvdgmic_new(1); + + livido_property_set( my_instance, "PLUGIN_private", + LIVIDO_ATOM_TYPE_VOIDPTR,1,&gmic ); + + return LIVIDO_NO_ERROR; +} + + +livido_deinit_f deinit_instance( livido_port_t *my_instance ) +{ + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + lvdgmic_delete(gmic); + + return LIVIDO_NO_ERROR; +} + + +livido_process_f process_instance( livido_port_t *my_instance, double timecode ) +{ + uint8_t *A[4] = {NULL,NULL,NULL,NULL}; + uint8_t *O[4]= {NULL,NULL,NULL,NULL}; + char cmd[256]; + int palette; + int w; + int h; + + int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette ); + if( error != LIVIDO_NO_ERROR ) + return LIVIDO_ERROR_HARDWARE; + Clvdgmic *gmic = NULL; + livido_property_get( my_instance, "PLUGIN_private",0, &gmic); + + lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette ); + + int xtiles = lvd_extract_param_index( my_instance,"in_parameters", 0 ); + int ytiles = lvd_extract_param_index( my_instance,"in_parameters", 1 ); + + snprintf(cmd,sizeof(cmd),"-taquin %d,%d", xtiles,ytiles ); + + lvdgmic_push( gmic, w, h, 0, A, 0); + + lvdgmic_gmic( gmic, cmd ); + + lvdgmic_pull( gmic, 0, O ); + + return LIVIDO_NO_ERROR; +} + +livido_port_t *livido_setup(livido_setup_t list[], int version) + +{ + LIVIDO_IMPORT(list); + + livido_port_t *port = NULL; + livido_port_t *in_params[3]; + livido_port_t *in_chans[3]; + livido_port_t *out_chans[1]; + livido_port_t *info = NULL; + livido_port_t *filter = NULL; + + //@ setup root node, plugin info + info = livido_port_new( LIVIDO_PORT_TYPE_PLUGIN_INFO ); + port = info; + + livido_set_string_value( port, "maintainer", "Niels"); + livido_set_string_value( port, "version","1"); + + filter = livido_port_new( LIVIDO_PORT_TYPE_FILTER_CLASS ); + livido_set_int_value( filter, "api_version", LIVIDO_API_VERSION ); + + //@ setup function pointers + livido_set_voidptr_value( filter, "deinit_func", &deinit_instance ); + livido_set_voidptr_value( filter, "init_func", &init_instance ); + livido_set_voidptr_value( filter, "process_func", &process_instance ); + port = filter; + + //@ meta information + livido_set_string_value( port, "name", "G'MIC/GREYs Taquin puzzle"); + livido_set_string_value( port, "description", "Create MxN taquin puzzle"); + livido_set_string_value( port, "author", "GREYC's Magic for Image Computing"); + + livido_set_int_value( port, "flags", LIVIDO_FILTER_NON_REALTIME); + livido_set_string_value( port, "license", "GPL2"); + livido_set_int_value( port, "version", 1); + + //@ some palettes veejay-classic uses + int palettes0[] = { + LIVIDO_PALETTE_YUV422P, + 0, + }; + + //@ setup output channel + out_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = out_chans[0]; + + livido_set_string_value( port, "name", "Output Channel"); + livido_set_int_array( port, "palette_list", 3, palettes0); + livido_set_int_value( port, "flags", 0); + + in_chans[0] = livido_port_new( LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE ); + port = in_chans[0]; + livido_set_string_value( port, "name", "Input Channel"); + livido_set_int_array( port, "palette_list", 4, palettes0); + livido_set_int_value( port, "flags", 0); + + in_params[0] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[0]; + + livido_set_string_value(port, "name", "X tiles" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default", 8 ); + livido_set_string_value( port, "description" ,"X tiles"); + + + in_params[1] = livido_port_new( LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE ); + port = in_params[1]; + + livido_set_string_value(port, "name", "Y tiles" ); + livido_set_string_value(port, "kind", "INDEX" ); + livido_set_int_value( port, "min", 0 ); + livido_set_int_value( port, "max", 100 ); + livido_set_int_value( port, "default", 8); + livido_set_string_value( port, "description" ,"Y tiles"); + + //@ setup the nodes + livido_set_portptr_array( filter, "in_parameter_templates",2, in_params ); + livido_set_portptr_array( filter, "out_channel_templates", 1, out_chans ); + livido_set_portptr_array( filter, "in_channel_templates",1, in_chans ); + + livido_set_portptr_value(info, "filters", filter); + return info; +}