#include #include #include #include #include "camconfig.h" #include "video.h" #include "filter.h" #include "log.h" #define MODNAME "hblurfilter" typedef struct hblur_filter_st { int weight; } HBlurFilter; /* * filter_init: Standard filter initialization routine. * * Filter variables: randmod_perline = max # of random pixels per line * randmod_colordpix = Use colored pixels */ void *filter_init( CamConfig *ccfg, char *section_name ){ HBlurFilter *res; if( (res = malloc( sizeof( *res ))) == NULL ){ camserv_log( MODNAME, "FATAL! Could not allocate space for hblur filter!" ); return NULL; } res->weight = camconfig_query_def_int( ccfg, section_name, "weight", 2 ); return res; } /* * filter_deinit: Standard filter deinit routine */ void filter_deinit( void *filter_dat ){ HBlurFilter *hfilt = filter_dat; free( hfilt ); } void filter_func( char *in_data, char **out_data, void *cldat, const Video_Info *vinfo_in, Video_Info *vinfo_out ) { HBlurFilter *hfilt = cldat; int weight, rowspan, x, y, div; unsigned char *outp; *vinfo_out = *vinfo_in; *out_data = in_data; weight = hfilt->weight; outp = in_data; div = 2 + weight; if( vinfo_in->is_black_white ) { /* UNTESTED */ rowspan = vinfo_in->width; for( y=0; y< vinfo_in->height; y++, outp += rowspan) for( x=1; xwidth * 3; for( y=0; y< vinfo_in->height; y++, outp += rowspan) for( x=3; xvars[ 0 ].type = MODINFO_TYPE_INT; return res; }