Example #1
0
int		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_NO_OUTPUT_CHANNELS; 
	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 amplitude =  lvd_extract_param_index( my_instance,"in_parameters", 0 );
	int frequency = lvd_extract_param_index( my_instance,"in_parameters", 1 );
	int x_center = lvd_extract_param_index(my_instance, "in_parameters",2);
	int y_center = lvd_extract_param_index(my_instance, "in_parameters",3);
	
	snprintf(cmd,sizeof(cmd),"-wave %d,%f,%d,%d", amplitude, (float)frequency/100.0f,x_center,y_center);

	lvdgmic_push( gmic, w, h, palette, A, 0);

	lvdgmic_gmic( gmic, cmd );

	lvdgmic_pull( gmic, 0, O );

	return LIVIDO_NO_ERROR;
}
Example #2
0
int		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_NO_OUTPUT_CHANNELS; 
	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 scale =  lvd_extract_param_index( my_instance,"in_parameters", 0 );
	int dithering = lvd_extract_param_index( my_instance,"in_parameters", 1 );
	int levels = lvd_extract_param_index(my_instance, "in_parameters",2);

	snprintf(cmd,sizeof(cmd),"-gimp_8bits %d,%d,%d", scale, dithering, levels );

	lvdgmic_push( gmic, w, h, palette, A, 0);

	lvdgmic_gmic( gmic, cmd );

	lvdgmic_pull( gmic, 0, O );

	return LIVIDO_NO_ERROR;
}
Example #3
0
int		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_NO_OUTPUT_CHANNELS; 
	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 density =  lvd_extract_param_index( my_instance,"in_parameters", 0 );
	int smoothness = lvd_extract_param_index( my_instance,"in_parameters", 1 );
	int edges = lvd_extract_param_index(my_instance, "in_parameters",2);
	
	snprintf(cmd,sizeof(cmd),"-gimp_crystal %d,%f,%d", density, (float)smoothness/100.0f, edges );

	lvdgmic_push( gmic, w, h, 0, A, 0);

	lvdgmic_gmic( gmic, cmd );

	lvdgmic_pull( gmic, 0, O );

	livido_memset( O[1], 128, (w*h)/2);
	livido_memset( O[2], 128, (w*h)/2);

	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 dx = lvd_extract_param_index( my_instance,"in_parameters", 0 );
	int dy = lvd_extract_param_index( my_instance,"in_parameters", 1 );
	int dz = lvd_extract_param_index(my_instance, "in_parameters",2);

	snprintf(cmd,sizeof(cmd),"-spread %d,%d,%d",dx,dy,dz);

	lvdgmic_push( gmic, w, h, palette, A, 0);

	lvdgmic_gmic( gmic, cmd );

	lvdgmic_pull( gmic, 0, O );

	return LIVIDO_NO_ERROR;
}
Example #5
0
int		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_NO_OUTPUT_CHANNELS; 
	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 smoothness = lvd_extract_param_index( my_instance,"in_parameters", 0 );
	int levels = lvd_extract_param_index( my_instance,"in_parameters", 1 );
	int contrast = lvd_extract_param_index(my_instance, "in_parameters",2);

	snprintf(cmd,sizeof(cmd),"-gimp_color_abstraction %d,%d,%f",smoothness,levels,(float)contrast/100.0f );

	lvdgmic_push( gmic, w, h, 0, A, 0);

	lvdgmic_gmic( gmic, cmd );

	lvdgmic_pull( gmic, 0, O );

	return LIVIDO_NO_ERROR;
}
Example #6
0
int		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_NO_OUTPUT_CHANNELS; 
	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 gamma =  lvd_extract_param_index( my_instance,"in_parameters", 0 );
	int smoothness = lvd_extract_param_index( my_instance,"in_parameters", 1 );

	snprintf(cmd,sizeof(cmd),"-poster_hope %f,%d", (float) gamma/100.0f, smoothness );

	lvdgmic_push( gmic, w, h, palette, A, 0);

	lvdgmic_gmic( gmic, cmd );

	lvdgmic_pull( gmic, 0, O );

	return LIVIDO_NO_ERROR;
}
Example #7
0
int		process_instance( livido_port_t *my_instance, double timecode )
{
	int len =0;
	uint8_t *O[4]= {NULL,NULL,NULL,NULL};

	int palette;
	int w;
	int h;
	
	//@ get output channel details
	int error	  = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette );
	if( error != LIVIDO_NO_ERROR )
		return LIVIDO_ERROR_NO_OUTPUT_CHANNELS; //@ error codes in livido flanky

	int uv_len = lvd_uv_plane_len( palette,w,h );
	len = w * h;
	
	starfield_t *starfield = NULL;
	if ( livido_property_get( my_instance, "PLUGIN_private", 0, &starfield ) != LIVIDO_NO_ERROR )
    	return LIVIDO_ERROR_INTERNAL;

	//@ get parameter values
	int		number_of_stars =  lvd_extract_param_index( my_instance,"in_parameters", 0 );
	int		speed = 2 + lvd_extract_param_index( my_instance, "in_parameters", 1 );

	livido_memset( O[0], 0, len );
	livido_memset( O[1], 128, uv_len );
	livido_memset( O[2], 128, uv_len );

	int center_x = w >> 1;
	int center_y = h >> 1;
	int i;
	int temp_x, temp_y;
	
	STAR **stars = starfield->stars;

	for( i = 0; i < number_of_stars; i ++ ) {
			
		stars[i]->zpos -= stars[i]->speed;

		if( stars[i]->zpos <= 0 ) {
			init_star( stars[i], i + 1, speed );
		}

		temp_x = (stars[i]->xpos / stars[i]->zpos ) + center_x;
		temp_y = (stars[i]->ypos / stars[i]->zpos ) + center_y;

		if( temp_x < 0 || temp_x > (w-1) || temp_y < 0 || temp_y > (h-1) ) {
			init_star( stars[i], i + 1, speed );
			continue;
		}

		O[0][ temp_y * w + temp_x ] = stars[i]->color;
	}
	

	return LIVIDO_NO_ERROR;
}
Example #8
0
int		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};

	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_NO_OUTPUT_CHANNELS;

    error = lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette );
	if( error != LIVIDO_NO_ERROR )
		return LIVIDO_ERROR_NO_INPUT_CHANNELS;

	int		scale =  lvd_extract_param_index( my_instance,"in_parameters", 0 );
	int		mode  =  lvd_extract_param_index( my_instance,"in_parameters", 1 );
	int		shift = 1;

	if( palette == LIVIDO_PALETTE_YUV444P )
	    shift = 0;

	displaywall_t *wall = NULL;
	livido_property_get( my_instance, "PLUGIN_private", 0, &wall );

	switch( mode ) {
		case 0:
			wall->dx = 0; wall->dy = 1; 
			break;
		case 1:
			wall->dy = 1; wall->dx = 0;
			break;
		case 2:
			wall->dy = -1; wall->dx = 0;		
			break;
		case 3:
			wall->dy = 0; wall->dx = -1;
			break;
	}

	wall->scale = scale;

	displaywall_tick( wall, w, h );

	displaywall_draw( wall, A[0], O[0], w, h);
	displaywall_draw( wall, A[1], O[1], w >> shift, h );
	displaywall_draw( wall, A[2], O[2], w >> shift, h );

	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 imageweight =  lvd_extract_param_index( my_instance,"in_parameters", 0 );
	int patternweight = lvd_extract_param_index( my_instance,"in_parameters", 1 );
	int patternangle = lvd_extract_param_index(my_instance, "in_parameters",2);
	int amplitude = lvd_extract_param_index(my_instance, "in_parameters",3);
	int sharpness = lvd_extract_param_index(my_instance, "in_parameters",4);
	int anisotropy = lvd_extract_param_index(my_instance, "in_parameters",5);
	int alpha = lvd_extract_param_index(my_instance, "in_parameters",6);
	int sigma = lvd_extract_param_index(my_instance, "in_parameters",7);
	int cutlow = lvd_extract_param_index(my_instance, "in_parameters",8);
	int cuthigh = lvd_extract_param_index(my_instance, "in_parameters",9);

	snprintf(cmd,sizeof(cmd),"-gimp_marble %f,%d,%d,%d,%f,%f,%f,%f,%d,%d",
		(float) imageweight/10.0f, patternweight, patternangle, amplitude,(float)sharpness/100.0f,
	  	(float) anisotropy/100.0f, (float) alpha/10.0f, (float) sigma / 10.0f,
		cutlow, cuthigh	
		);

	lvdgmic_push( gmic, w, h, palette, A, 0);

	lvdgmic_gmic( gmic, cmd );

	lvdgmic_pull( gmic, 0, O );

	return LIVIDO_NO_ERROR;
}
livido_process_f		process_instance( livido_port_t *my_instance, double timecode )
{
	int len =0;
	int i = 0;
	uint8_t *A[4] = {NULL,NULL,NULL,NULL};
	uint8_t *O[4]= {NULL,NULL,NULL,NULL};

	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; 

        lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette );

	int uv_len = lvd_uv_plane_len( palette,w,h );
	len = w * h;

	int		red    =  lvd_extract_param_index( my_instance,"in_parameters", 0 );
	int		green  =  lvd_extract_param_index( my_instance,"in_parameters", 1 );
	int		blue   =  lvd_extract_param_index( my_instance,"in_parameters", 2 );
	int		shift = 1;
        if( palette == LIVIDO_PALETTE_YUV444P )
                shift = 0;
	
	if( O[0] != A[0] ) {
		livido_memcpy( A[0], O[0], len );
	}
	
	int		y,u,v;
	GIMP_rgb2yuv( red, green, blue, y, u, v );

	livido_memset( O[1], u, uv_len );
	livido_memset( O[2], v, uv_len );

	return LIVIDO_NO_ERROR;
}
Example #11
0
int		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_NO_OUTPUT_CHANNELS; 
	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 smoothness = lvd_extract_param_index( my_instance,"in_parameters", 0 );
	int threshold = lvd_extract_param_index( my_instance,"in_parameters", 1 );
	int shade = lvd_extract_param_index(my_instance, "in_parameters",2);
	int thickness = lvd_extract_param_index(my_instance, "in_parameters",3);
	int antialiasing = lvd_extract_param_index(my_instance, "in_parameters",4);
	int posterization_lvl = lvd_extract_param_index(my_instance, "in_parameters",5);
	int posterization_aa = lvd_extract_param_index(my_instance, "in_parameters",6);

	snprintf(cmd,sizeof(cmd),"-poster_edges %d,%d,%d,%d,%d,%d,%d",
		smoothness,threshold,shade,thickness,antialiasing,posterization_lvl,posterization_aa);

	lvdgmic_push( gmic, w, h, palette, A, 0);

	lvdgmic_gmic( gmic, cmd );

	lvdgmic_pull( gmic, 0, O );

	return LIVIDO_NO_ERROR;
}
Example #12
0
int		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};

	int palette;
	int w;
	int h;
	
	lvd_crop_t *crop = NULL;
	livido_property_get( my_instance, "PLUGIN_private", 0, &crop );
	
	if( crop == NULL )
		return LIVIDO_ERROR_INTERNAL;

	int error  = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette );
	if( error != LIVIDO_NO_ERROR )
		return LIVIDO_ERROR_NO_OUTPUT_CHANNELS;

    error = lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette );
	if( error != LIVIDO_NO_ERROR )
		return LIVIDO_ERROR_NO_INPUT_CHANNELS;

	int	left = lvd_extract_param_index( my_instance,"in_parameters", 0 );
	int	right = lvd_extract_param_index( my_instance,"in_parameters", 1 );
	int	top = lvd_extract_param_index( my_instance, "in_parameters", 2 );
	int	bottom = lvd_extract_param_index( my_instance, "in_parameters", 3);
	int scale = lvd_extract_param_index( my_instance, "in_parameters", 4);

	int tmp_w = ( w - left - right);
	int tmp_h = h - top - bottom;

	if( tmp_w < 0 )
		tmp_w = 0;
	if( tmp_h < 0 )
		tmp_h = 0;

	if( tmp_w != crop->w || tmp_h != crop->h ) {
		if( crop->sws ) {
			sws_freeContext( crop->sws );
			crop->sws = NULL;
		}
		crop->w = tmp_w;
		crop->h = tmp_h;
	}

	int crop_strides[4] = { crop->w, crop->w, crop->w, 0 };
	int dst_strides[4]  = { w, w, w, 0 }; 

	if( !lvd_crop_plane( crop->buf[0], A[0], left, right, top, bottom, w, h ) )
		return LIVIDO_NO_ERROR;

	if( !lvd_crop_plane( crop->buf[1], A[1], left, right, top, bottom, w, h ) )
		return LIVIDO_NO_ERROR;

	if( !lvd_crop_plane( crop->buf[2], A[2], left, right, top, bottom, w, h ) )
		return LIVIDO_NO_ERROR;

	if( crop->sws == NULL ) {
		crop->sws = sws_getContext(crop->w,crop->h,PIX_FMT_YUV444P,w,h,PIX_FMT_YUV444P,crop->flags,NULL,NULL,NULL);
		if( crop->sws == NULL )
			return LIVIDO_ERROR_INTERNAL;
	}

	sws_scale(crop->sws,(const uint8_t * const *)crop->buf,crop_strides,0,crop->h,(uint8_t * const *) O,dst_strides);

	return LIVIDO_NO_ERROR;
}
Example #13
0
int	process_instance( livido_port_t *my_instance, double timecode )
{
	int len =0;
	uint8_t *A[4] = {NULL,NULL,NULL,NULL};
	uint8_t *O[4]= {NULL,NULL,NULL,NULL};
	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_NO_OUTPUT_CHANNELS;

    error = lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette );
	if( error != LIVIDO_NO_ERROR )
		return LIVIDO_ERROR_NO_INPUT_CHANNELS;
	
	len = w * h;

	int	src_red    =  lvd_extract_param_index( my_instance,"in_parameters", 0 );
	int	src_green  =  lvd_extract_param_index( my_instance,"in_parameters", 1 );
	int	src_blue   =  lvd_extract_param_index( my_instance,"in_parameters", 2 );

	int	dst_red    =  lvd_extract_param_index( my_instance,"in_parameters", 3 );
	int	dst_green  =  lvd_extract_param_index( my_instance,"in_parameters", 4 );
	int	dst_blue   =  lvd_extract_param_index( my_instance,"in_parameters", 5 );

	int mode	   =  lvd_extract_param_index( my_instance,"in_parameters", 6 );
	int black_incl	   =  lvd_extract_param_index( my_instance,"in_parameters", 7 );
		
	int		sy,su,sv;
	GIMP_rgb2yuv( src_red, src_green, src_blue, sy,su,sv );

	int		dy,du,dv;
	GIMP_rgb2yuv( dst_red, dst_green, dst_blue, dy,du,dv );

	uint8_t *ch0 = A[0];
	uint8_t *ch1 = A[1];
	uint8_t *ch2 = A[2];

	uint8_t *o0 = O[0];
	uint8_t *o1 = O[1];
	uint8_t *o2 = O[2];

	const int minY = ( mode == 1 ? 16: 0 );
	const int maxY = ( mode == 1 ? 235: 255 );
	const int minUV= ( mode == 1 ? 16: 0 );
	const int maxUV= ( mode == 1 ? 240: 255 );

	int i;

	if( black_incl ) {
		for( i = 0; i < len; i ++ )
		{
			o0[i] = CLAMP( ch0[i] + dy - sy,minY,maxY );
			o1[i] = CLAMP( ch1[i] + du - su,minUV,maxUV );
			o2[i] = CLAMP( ch2[i] + dv - sv,minUV,maxUV );
		}
	}
	else {
		for( i = 0; i < len; i ++ )
		{
			if(ch0[i] != 0 ) {
				o0[i] = CLAMP( ch0[i] + dy - sy,minY,maxY );
				o1[i] = CLAMP( ch1[i] + du - su,minUV,maxUV );
				o2[i] = CLAMP( ch2[i] + dv - sv,minUV,maxUV );
			}
		}

	}	


	return LIVIDO_NO_ERROR;
}
Example #14
0
int		process_instance( livido_port_t *my_instance, double timecode )
{
	uint8_t *A[4] = {NULL,NULL,NULL,NULL};
	uint8_t *B[4] = {NULL,NULL,NULL,NULL};
	uint8_t *O[4] = {NULL,NULL,NULL,NULL};

	int palette;
	int w;
	int h;
	
	scale0tilt_instance_t *inst = NULL;
	livido_property_get( my_instance, "PLUGIN_private", 0, &inst );
	
	if( inst == NULL )
		return LIVIDO_ERROR_INTERNAL;

	int error  = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette );
	if( error != LIVIDO_NO_ERROR )
		return LIVIDO_ERROR_NO_OUTPUT_CHANNELS;

    error = lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette );
	if( error != LIVIDO_NO_ERROR )
		return LIVIDO_ERROR_NO_INPUT_CHANNELS;

    error = lvd_extract_channel_values( my_instance, "in_channels" , 1, &w, &h, B, &palette );
	if( error != LIVIDO_NO_ERROR )
		return LIVIDO_ERROR_NO_INPUT_CHANNELS;

	double width = (double)w;
	double height= (double)h;

	inst->cl = lvd_extract_param_index( my_instance,"in_parameters", 0 ) / width;
	inst->cr = ((double) lvd_extract_param_index( my_instance,"in_parameters", 1 )) / width;
	inst->ct = ((double) lvd_extract_param_index( my_instance, "in_parameters", 2 )) / height;
	inst->cb = ((double) lvd_extract_param_index( my_instance, "in_parameters", 3)) / height;
	
	inst->sx = ( (double) lvd_extract_param_index( my_instance,"in_parameters", 4 )  / width) * 2.0;
	inst->sy = ( (double) lvd_extract_param_index( my_instance,"in_parameters", 5 )  / height) * 2.0;
	inst->tx = ( (double) lvd_extract_param_index( my_instance, "in_parameters", 6 ) / width) * 2.0 - 1.0;
	inst->ty = ( (double) lvd_extract_param_index( my_instance, "in_parameters", 7) / height) * 2.0 - 1.0;

	int alpha = lvd_extract_param_index( my_instance, "in_parameters", 8 );

	inst->frame_src->strides[0] = width;
	inst->frame_src->strides[1] = width;
	inst->frame_src->strides[2] = width;

	inst->frame_dst->strides[0] = width;
	inst->frame_dst->strides[1] = width;
	inst->frame_dst->strides[2] = width;

	update_scaler( inst );

	gavl_video_frame_t* frame_src = inst->frame_src;

	inst->frame_src->planes[0] = B[0];
	inst->frame_src->planes[1] = B[1];
	inst->frame_src->planes[2] = B[2];

	inst->frame_dst->planes[0] = O[0];
	inst->frame_dst->planes[1] = O[1];
	inst->frame_dst->planes[2] = O[2];

	if ( inst->do_scale )
	{
		int len = w * h;
		int i;
		livido_memset( inst->temp_alpha->planes[0],0,len);

		/* scale alpha channel first */
		inst->frame_src->strides[0] = width;
		inst->frame_src->strides[1] = 0;
		inst->frame_src->strides[2] = 0;
		inst->frame_src->planes[0] = B[3];
	
		inst->temp_alpha->strides[0] = width;
		inst->temp_alpha->strides[1] = 0;
		inst->temp_alpha->strides[2] = 0;

		gavl_video_scaler_scale( inst->video_scaler, frame_src, inst->temp_alpha );

		/* setup pointers for frames */
		inst->frame_src->strides[1] = width;
		inst->frame_src->strides[2] = width;
		inst->frame_src->planes[0] = B[0];
		inst->frame_src->planes[1] = B[1];
		inst->frame_src->planes[2] = B[2];

		inst->frame_dst->strides[0] = width;
		inst->frame_dst->strides[1] = width;
		inst->frame_dst->strides[2] = width;
		inst->frame_dst->planes[0] = O[0];
		inst->frame_dst->planes[1] = O[1];
		inst->frame_dst->planes[2] = O[2];

		if(alpha)
		{	
			livido_memset( inst->temp->planes[0], 0, len );
			livido_memset( inst->temp->planes[1],128,len );
			livido_memset( inst->temp->planes[2],128,len );

			gavl_video_scaler_scale( inst->video_scaler, frame_src, inst->temp );

			const uint8_t *t0 = inst->temp->planes[0];
			const uint8_t *t1 = inst->temp->planes[1];
			const uint8_t *t2 = inst->temp->planes[2];
			const uint8_t *tA = inst->temp_alpha->planes[0];

			for( i = 0; i < len; i ++ ) {
				if( tA[i] > 0 )
				{
					unsigned int op1 = tA[i];
					unsigned int op0 = 0xff - tA[i];
					O[0][i] = (op0 * O[0][i] + op1 * t0[i]) >> 8;
					O[1][i] = (op0 * O[1][i] + op1 * t1[i]) >> 8;
					O[2][i] = (op0 * O[2][i] + op1 * t2[i]) >> 8;
					O[3][i] = op1;
				}
			}
		}