示例#1
0
static	int prepare_filmstrip(int film_length, int w, int h)
{
	int i,j;
	int picture_width = w / sqrt(film_length);
	int picture_height = h / sqrt(film_length);

	photo_list = (picture_t**) vj_malloc(sizeof(picture_t*) * (film_length + 1) );
	if(!photo_list)
		return 0;

	num_photos = film_length;

	uint8_t val = 0;
	int inc = num_photos % 255;

	for ( i = 0; i < num_photos; i ++ )
	{
		photo_list[i] = vj_malloc(sizeof(picture_t));
		if(!photo_list[i])
			return 0;
		photo_list[i]->w = picture_width;
		photo_list[i]->h = picture_height;
		for( j = 0; j < 3; j ++ )
		{
			photo_list[i]->data[j] = vj_malloc(sizeof(uint8_t) * picture_width * picture_height );
			if(!photo_list[i]->data[j])
				return 0;
			memset(photo_list[i]->data[j], (j==0 ? val : 128), picture_width *picture_height );
		}
		val+= inc;
	}
	frame_counter = 0;

	return 1;
}
示例#2
0
int	chameleon_malloc(int w, int h)
{
	int i;
	for( i = 0; i < 3; i ++ ) {
		bgimage[i] = vj_malloc(sizeof(uint8_t) * RUP8(w * h) + RUP8(w*2) );
		tmpimage[i] = vj_malloc(sizeof(uint8_t) * RUP8(w * h) );
	}
	vj_frame_clear1( bgimage[0], pixel_Y_lo_, RUP8(w*h));
	vj_frame_clear1( tmpimage[0], pixel_Y_lo_, RUP8(w*h));
	for( i = 1; i < 3; i ++ ) {
		vj_frame_clear1( bgimage[i], 128, RUP8(w*h));
		vj_frame_clear1( tmpimage[i], 128, RUP8(w*h));
	}
	
	sum = (int32_t*) vj_calloc( RUP8(w * h) * sizeof(int32_t));
	timebuffer = (uint8_t*) vj_calloc( RUP8(w * h) * PLANES );

	has_bg = 0;
	plane = 0;
	N__ = 0;
	n__ = 0;
	last_mode_ = -1;

	return 1;
}
示例#3
0
static	int prepare_filmstrip(int film_length, int w, int h)
{
	int i,j;
	int picture_width = w / sqrt(film_length);
	int picture_height = h / sqrt(film_length);

	photo_list = (picture_t**) vj_calloc(sizeof(picture_t*) * (film_length + 1) );
	if(!photo_list)
		return 0;

	rt = (int*) vj_calloc(sizeof(int) * film_length );
	if(!rt)
		return 0;

	num_photos = film_length;

	for ( i = 0; i < num_photos; i ++ )
	{
		photo_list[i] = vj_malloc(sizeof(picture_t));
		if(!photo_list[i])
			return 0;
		photo_list[i]->w = picture_width;
		photo_list[i]->h = picture_height;
		for( j = 0; j < 3; j ++ )
		{
			photo_list[i]->data[j] = vj_malloc(sizeof(uint8_t) * picture_width * picture_height );
			if(!photo_list[i]->data[j])
				return 0;
			veejay_memset(photo_list[i]->data[j], (j==0 ? pixel_Y_lo_ : 128), picture_width *picture_height );
		}
	}
	frame_counter = 0;

	return 1;
}
int		neighbours3_malloc(int w, int h )
{
	tmp_buf[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * w * h * 2);
	if(!tmp_buf[0] ) return 0;
	tmp_buf[1] = tmp_buf[0] + (w*h);
	chromacity[0] = (uint8_t*) vj_malloc(sizeof(uint8_t) * w * h *2);
	if(!chromacity[0]) return 0;
	chromacity[1] = chromacity[0] + (w*h);
	return 1;
}
示例#5
0
文件: radcor.c 项目: c0ntrol/veejay
int radcor_malloc( int width, int height )
{
	badbuf = (uint8_t*) vj_malloc( RUP8( width * height * 4 * sizeof(uint8_t)));
	if(!badbuf)
		return 0;
	Map = (uint32_t*) vj_malloc( RUP8(width * height * sizeof(uint32_t)));
	veejay_memset( Map, 0, RUP8(width * height * sizeof(uint32_t)) );
	if(!Map)
		return 0;
	return 1;
}
示例#6
0
static	char	*osc_create_path( const char *base, const char *path )
{
	int n = strlen(base) + strlen(path) + 2;
	char *res = (char*) vj_malloc(n);
	snprintf(res,n,"%s/%s", base,path);
	return res;
}
示例#7
0
int reflection_malloc(int width, int height)
{ 
  int i, x, y;
    float rad;
 
    for (i = 0; i < width; i++) {
	rad = (float) i * 0.0174532 * 0.703125;
	reflect_aSin[i] = (short) ((sin(rad) * 100.0) + 256.0);
    }
    for (x = 0; x < width; ++x) {
	for (y = 0; y < 256; ++y) {
	    float xx = (x - 128) / 128.0;
	    float yy = (y - 128) / 128.0;
	    float zz = 1.0 - sqrt(xx * xx + yy * yy);
	    zz *= 255.0;
	    if (zz < 0.0)
		zz = 0.0;
	    reflection_map[x][y] = (int) zz;
	}
    }
    reflection_buffer = (uint8_t *) vj_malloc(sizeof(uint8_t) * width + 1);	/* fixme */
    if(!reflection_buffer) return 0;

    return 1;


}
示例#8
0
static	char	*osc_fx_pair_str( const char *base, const char *key )
{
	int n = strlen(base) + strlen(key) + 2;
	char *res = (char*) vj_malloc(n);
	snprintf( res,n,"%s/%s", base,key);
	return res;
}
int magicmirror_malloc(int w, int h)
{
	int i ;
	for( i = 0; i < 3 ;i ++ ) {
		magicmirrorbuf[i] = (uint8_t*)vj_malloc(sizeof(uint8_t) * RUP8(w*h));
		if(!magicmirrorbuf[i])
			return 0;
	}
	
	funhouse_x = (double*)vj_calloc(sizeof(double) * w );
	if(!funhouse_x) return 0;

	cache_x = (unsigned int *)vj_calloc(sizeof(unsigned int)*w);
	if(!cache_x) return 0;

	funhouse_y = (double*)vj_calloc(sizeof(double) * h );
	if(!funhouse_y) return 0;

	cache_y = (unsigned int*)vj_calloc(sizeof(unsigned int)*h);
	if(!cache_y) return 0;
	veejay_memset(cache_x,0,w);
	veejay_memset(cache_y,0,h);

	n__ =0;
	N__ =0;

	return 1;
}
示例#10
0
void	vj_midi_learning_vims( void *vv, char *widget, char *msg, int extra )
{
	vmidi_t *v = (vmidi_t*) vv;
        if(!v->active) return;

	if( !v->learn )
		return;

	if( v->learn_event[0] == -1 || v->learn_event[1] == -1 || v->learn_event[2] == -1 ) {
		veejay_msg(0, "Cannot learn '%s' (%s) - unknown midi event.",
			widget, msg );
		return;
	}

	dvims_t *d = (dvims_t*) vj_malloc(sizeof(dvims_t));
	d->extra = extra;	
	d->msg = (msg == NULL ? NULL : strdup(msg));
	d->widget = (widget == NULL ? NULL : strdup(widget));
	char key[32];
	snprintf(key,sizeof(key), "%03d%03d", v->learn_event[0],v->learn_event[1] );

	dvims_t *cur = NULL;
	if( vevo_property_get( v->vims, key, 0, &cur ) == VEVO_NO_ERROR )
	{
		if( cur->widget ) free(cur->widget );
		if( cur->msg ) free(cur->msg);
		free(cur);
	}
	int error = vevo_property_set( v->vims, key, 1, VEVO_ATOM_TYPE_VOIDPTR, &d );
	if( error != VEVO_NO_ERROR )
		return;
	vj_msg( VEEJAY_MSG_INFO, 
		"Midi %x: %x ,%x learned", v->learn_event[0],v->learn_event[1],v->learn_event[2]);
}
示例#11
0
文件: plugload.c 项目: flv0/veejay
char		*list_plugins()
{
	int i = 0;
	int len = 0;
	char *res = NULL;
	for ( i = 0; i < index_; i ++ )
	{
		char *name = plug_get_name( i );
		if(name)
		{
			len += strlen(name) + 1;
			free(name);
		}
	}

	if(len <= 0 )
		return NULL;

	res = (char*) vj_malloc( len );
	memset( res,0,len );
	char *p = res;
	for ( i = 0; i < index_; i ++ )
	{
		char *name = plug_get_name(i);
		if(name)
		{
			sprintf(p, "%s:",name );
			p += strlen(name) + 1;
		}
	}
	return res;
}
示例#12
0
文件: vj-misc.c 项目: flv0/veejay
filelist_t *find_media_files( veejay_t *info )
{
	char working_dir[PATH_MAX];
	char *wd = getcwd( working_dir, sizeof(working_dir));

	if( wd == NULL ) {
		return NULL;
	}

	filelist_t *fl = (filelist_t*) vj_malloc(sizeof(filelist_t));
	fl->files      = (char**) vj_calloc(sizeof(char*) * 1024 ); 
	fl->max_files  = 1024;
	fl->num_files  = 0;	
	fl->working_dir = vj_strdup(working_dir);

	int res = find_files( fl, wd );

	if( res == 0 ) {
		veejay_msg(VEEJAY_MSG_DEBUG, "No files found in %s", wd );
		free( fl->files );
		free( fl->working_dir );
		free( fl );
		fl = NULL;
	}

	return fl;
}
示例#13
0
int motionblur_malloc(int width, int height)
{
	int i;
	for( i = 0;i < 3 ; i ++ )
		previous_frame[i] = vj_malloc(sizeof(uint8_t) * width * height);
	n_motion_frames = 0;
	return 1;
}
示例#14
0
文件: mtracer.c 项目: c0ntrol/veejay
int mtracer_malloc(int w, int h)
{
	size_t buflen = RUP8( (w*h+w)) * sizeof(uint8_t);
	mtrace_buffer[0] = (uint8_t*) vj_malloc( buflen );
	if(!mtrace_buffer[0]) {
		return 0;
	}
	return 1;
}
示例#15
0
int 	tracer_malloc(int w, int h)
{

	trace_buffer[0] = (uint8_t *) vj_malloc(sizeof(uint8_t) * RUP8(w * h * 3) );
	trace_buffer[1] = trace_buffer[0] + RUP8(w*h);
	trace_buffer[2] = trace_buffer[1] + RUP8(w*h);
	vj_frame_clear1( trace_buffer[0], pixel_Y_lo_, RUP8(w*h));
	vj_frame_clear1( trace_buffer[1], 128, RUP8(w*h*2) );
   	return 1;
}
示例#16
0
int	boids_malloc(int w, int h)
{
	int j,i;
	double frac;
	int dist_sqrt;

	if(blob_radius_ <= 0)
		return 0;

	blob_dradius_ = blob_radius_ * 2;
	blob_sradius_ = blob_radius_ * blob_radius_;

	blob_ = (uint8_t**) vj_malloc(sizeof(uint8_t*) * blob_dradius_ );
	for(i = 0; i < blob_dradius_ ; i ++ )
	{
		blob_[i] = (uint8_t*) vj_calloc(sizeof(uint8_t) * blob_dradius_ );
		if(!blob_[i]) return 0;
	}

	blobs_ = (blob_t*) vj_calloc(sizeof(blob_t) * blob_num_ );
	if(!blobs_ ) return 0;

	blob_image_ = (uint8_t*) vj_calloc(sizeof(uint8_t) * w * h );
	if(!blob_image_) return 0;

		
	for( i = -blob_radius_ ; i < blob_radius_ ; ++ i )
	{
		for( j = -blob_radius_ ; j < blob_radius_ ; ++ j ) 
		{
			dist_sqrt = i * i + j * j;
			if( dist_sqrt < blob_sradius_ )
			{
				frac = (double) (sqrt(dist_sqrt)) / (double) blob_sradius_;
				blob_[i + blob_radius_][j + blob_radius_] = 0xff;
			}
			else
			{
				blob_[i + blob_radius_][j + blob_radius_ ] = 0x0; // was 0
			}
		}
	}

	for( i = 0; i < blob_num_ ; i ++ )
	{
		blob_init_( blobs_ + i ,i, w , h );
	}

	veejay_memset( blob_image_ , 0 , w * h );

	blob_ready_  = 1;

	return 1;
}
示例#17
0
int	zoom_malloc(int width, int height)
{
	int i;
	for( i = 0; i < 3; i ++ ) {	
		zoom_private_[i] = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(width*height));
		if(!zoom_private_[i])
			return 0;
	}

	return 1;
}
示例#18
0
int	gaussblur_malloc(int w, int h)
{
	gaussfilter = (FilterParam*) vj_calloc(sizeof(FilterParam));
	temp = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(w*h));
	if(temp == NULL)
		return 0;
	last_radius = 0;
	last_strength = 0;
	last_quality = 0;
	return 1;
}
示例#19
0
文件: oscsend.c 项目: flv0/veejay
void	*veejay_new_osc_sender_uri( const char *uri )
{
	oscclient_t *osc = (oscclient_t*) vj_malloc(sizeof(oscclient_t));
	memset(osc,0,sizeof(oscclient_t));
	osc->addr = lo_address_new_from_url( uri );

	osc->addr_str = strdup(lo_address_get_hostname( osc->addr ));
	osc->port_str = strdup(lo_address_get_port ( osc->addr ));
	veejay_msg(0,"New OSC sender from uri '%s', Host %s, Port %s",
			uri, osc->addr_str, osc->port_str );
	return (void*) osc;
}
示例#20
0
文件: cutstop.c 项目: c0ntrol/veejay
int	cutstop_malloc(int width, int height)
{
	int i;
	for( i = 0; i < 3 ;i ++ ) {
		vvcutstop_buffer[i] = (uint8_t*)vj_malloc(sizeof(uint8_t) * RUP8( width * height )); 
		if(!vvcutstop_buffer[i] )
			return 0;
	}
	veejay_memset( vvcutstop_buffer[0],0, width*height);
	veejay_memset( vvcutstop_buffer[1],128,(width*height));
	veejay_memset( vvcutstop_buffer[2],128,(width*height));
	return 1;
}
示例#21
0
void	*veejay_new_osc_server( void *data, const char *port )
{
	osc_recv_t *s = (osc_recv_t*) vj_malloc(sizeof( osc_recv_t));
	s->st = lo_server_thread_new( port, error_handler );
	lo_server_thread_start( s->st );

	s->url = lo_server_thread_get_url( s->st );
	s->port = lo_server_thread_get_port( s->st );

	veejay_msg( 0, "OSC server '%s' ready",s->url );

	return (void*) s;
}
示例#22
0
int	motionmap_malloc(int w, int h )
{
	bg_image = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(w * h));
	binary_img = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(w * h)); 
	prev_img = (uint8_t*) vj_malloc(sizeof(uint8_t) * RUP8(w*h));
	interpolate_buf = vj_malloc( sizeof(uint8_t) * RUP8(w*h*3));
	diff_img = (uint8_t*) vj_malloc( sizeof(uint8_t) * RUP8(w*h*2));

	veejay_msg(2, "This is 'Motion Mapping'");
	veejay_msg(2, "This FX calculates motion energy activity levels over a period of time to scale FX parameters");
	veejay_msg(2, "Add any of the following to the FX chain (if not already present)");
	veejay_msg(2, "\tBathroom Window, Displacement Mapping, Multi Mirrors, Magic Mirror, Sinoids");
	veejay_msg(2, "\tSlice Window , Smear, ChameleonTV and TimeDistort TV");
	veejay_memset( histogram_, 0, sizeof(int32_t) * HIS_LEN );

	nframe_ = 0;
	running = 0;

	is_initialized ++;

	return 1;
}
示例#23
0
文件: oscsend.c 项目: flv0/veejay
void	*veejay_new_osc_sender( const char *addr, const char *port )
{
	oscclient_t *osc = (oscclient_t*) vj_malloc(sizeof(oscclient_t));
	memset(osc,0,sizeof(oscclient_t));
	osc->addr = lo_address_new( addr, port );

	osc->addr_str = strdup( addr );
	osc->port_str = port ? strdup( port ) : NULL;
	veejay_msg(0,"New OSC sender Host %s, Port %s",
			osc->addr_str, osc->port_str );

	return (void*) osc;
}
示例#24
0
int 	timedistort_malloc( int w, int h )
{	
	unsigned int i;
	if(nonmap) timedistort_free();
	nonmap = vj_malloc( RUP8(w + 2 * w * h) * sizeof(uint8_t));
	if(!nonmap)
		return 0;

	planes[0] = vj_malloc( RUP8(PLANES * 3 * w * h) * sizeof(uint8_t));
	planes[1] = planes[0] + RUP8(PLANES * w * h );
	planes[2] = planes[1] + RUP8(PLANES * w * h );

	veejay_memset( planes[0],0, RUP8(PLANES * w * h ));
	veejay_memset( planes[1],128,RUP8(PLANES * w * h  ));
	veejay_memset( planes[2],128,RUP8(PLANES * w * h ));

	have_bg = 0;
	n__ = 0;
	N__ = 0;
	
	for( i = 0; i < PLANES; i ++ )
	{
		planetableY[i] = &planes[0][ (w*h) * i ];
		planetableU[i] = &planes[1][ (w*h) * i ];
		planetableV[i] = &planes[2][ (w*h) * i ];
	}

	warptime[0] = (uint8_t*) vj_calloc( sizeof(uint8_t) * RUP8((w * h)+w+1) );
	warptime[1] = (uint8_t*) vj_calloc( sizeof(uint8_t) * RUP8((w * h)+w+1) );
	if( warptime[0] == NULL || warptime[1] == NULL )
		return 0;

	plane = 0;
	state = 1;


	return 1;
}
示例#25
0
int	chromascratcher_malloc(int w, int h)
{
    cframe[0] =
	(uint8_t *) vj_malloc( RUP8(w * h * 3) * MAX_SCRATCH_FRAMES * sizeof(uint8_t) );
    if(!cframe[0]) return 0;

    cframe[1] = cframe[0] + ( w * h * MAX_SCRATCH_FRAMES );
    cframe[2] = cframe[1] + ( w * h * MAX_SCRATCH_FRAMES );


    int strides[4] = { w * h * MAX_SCRATCH_FRAMES, w * h * MAX_SCRATCH_FRAMES, w * h * MAX_SCRATCH_FRAMES, 0 };
    vj_frame_clear( cframe, strides, 128 );

    return 1;
}
示例#26
0
static	int prepare_filmstrip(int w, int h)
{
	int i,j;
	int picture_width = gcd(w,h);
	int picture_height = gcd(w,h);
	int film_length = n_pics(w,h);

	photo_list = (picture_t**) vj_calloc(sizeof(picture_t*) * film_length  );
	if(!photo_list)
		return 0;

	num_photos = film_length;

	uint8_t val = 0;
	int inc = num_photos % 255;

	for ( i = 0; i < num_photos; i ++ )
	{
		photo_list[i] = vj_calloc(sizeof(picture_t));
		if(!photo_list[i])
			return 0;
		photo_list[i]->w = picture_width;
		photo_list[i]->h = picture_height;
		for( j = 0; j < 3; j ++ )
		{
			photo_list[i]->data[j] = vj_malloc(sizeof(uint8_t) * picture_width * picture_height );
			if(!photo_list[i]->data[j])
				return 0;
		}
		veejay_memset( photo_list[i]->data[0], 0,
				picture_width * picture_height );
		veejay_memset( photo_list[i]->data[1],128,
				picture_width * picture_height );
		veejay_memset( photo_list[i]->data[2],128,
				picture_width * picture_height );
		val+= inc;
	}
	frame_counter = 0;

	offset_table_x = (int*) vj_calloc(sizeof(int) * film_length);
	if(!offset_table_x)
		return 0;
	offset_table_y = (int*) vj_calloc(sizeof(int) * film_length);
	if(!offset_table_y)
		return 0;

	return 1;
}
示例#27
0
文件: oscsend.c 项目: flv0/veejay
static	int	_vevo_get_dbl( void *port, const char *key, int n_elem, lo_message lmsg  )
{
	double *values = NULL;
	if( n_elem == 0 )
		return VEVO_NO_ERROR;
	
	values = (double*) vj_malloc(sizeof(double) * n_elem );
	int i;

	int error;
	for( i = 0; i < n_elem; i ++ )
	{
		error = vevo_property_get( port, key, i, &(values[i]));
		lo_message_add_double( lmsg, values[i]);
	}
	return VEVO_NO_ERROR;
}
示例#28
0
int scratcher_malloc(int w, int h)
{
	/* need memory for bounce mode ... */
    frame[0] =
	(uint8_t *) vj_malloc(w * h * 2 * sizeof(uint8_t) * MAX_SCRATCH_FRAMES);
	if(!frame[0]) return 0;
	
    veejay_memset( frame[0], pixel_Y_lo_, w * h * MAX_SCRATCH_FRAMES );

    frame[1] =
	    frame[0] + ( w * h * MAX_SCRATCH_FRAMES );
    frame[2] =
	    frame[1] + ( ((w*h)/4) * MAX_SCRATCH_FRAMES );

    veejay_memset( frame[1], 128, ((w * h)/4 ) * MAX_SCRATCH_FRAMES);
    veejay_memset( frame[2], 128, ((w * h)/4) * MAX_SCRATCH_FRAMES);
    return 1;
}
示例#29
0
int bgsubtract_malloc(int width, int height)
{
	if(static_bg__ == NULL){
		static_bg__ = (uint8_t*) vj_malloc( RUP8(width*height)*4);
		bg_frame__[0] = static_bg__;
		bg_frame__[1] = bg_frame__[0] + RUP8(width*height);
		bg_frame__[2] = bg_frame__[1] + RUP8(width*height);
		bg_frame__[3] = bg_frame__[2] + RUP8(width*height);
	}
	
	instance = 1;
	
	veejay_msg( VEEJAY_MSG_INFO,
			"You can enable/disable the histogram equalizer by setting env var VEEJAY_BG_AUTO_HISTOGRAM_EQ" );
	veejay_msg( VEEJAY_MSG_INFO,
			"Histogram equalization is %s", (auto_hist ? "enabled" : "disabled" ));

	return 1;
}
示例#30
0
文件: vj-sdl.c 项目: c0ntrol/veejay
vj_sdl *vj_sdl_allocate(int width, int height, int fmt, int use_key, int use_mouse, int show_cursor)
{
    vj_sdl *vjsdl = (vj_sdl *) vj_malloc(sizeof(vj_sdl));
    if (!vjsdl)
	return NULL;

    veejay_memset( vjsdl,0,sizeof(vj_sdl));

    vjsdl->flags[0] = 0;
    vjsdl->flags[1] = 0;
//   vjsdl->mouse_motion = 1;
  //  vjsdl->use_keyboard = 1;
    vjsdl->use_keyboard = use_key;
    vjsdl->mouse_motion = use_mouse;
    vjsdl->show_cursor = show_cursor;
    vjsdl->pix_format = SDL_YUY2_OVERLAY; 
    vjsdl->pix_fmt = fmt;
    vjsdl->width = width;
    vjsdl->height = height;
    vjsdl->frame_size = width * height;
    vjsdl->sw_scale_width = 0;
    vjsdl->sw_scale_height = 0;
    vjsdl->custom_geo[0] = -1;
    vjsdl->custom_geo[1] = -1;
    vjsdl->display = NULL;
	switch(fmt) {
	 //@ dont use YUVJ here - on blitting it to SDL it will be converted to YUV clamped for YUYJ422
	case FMT_422F:vjsdl->ffmpeg_pixfmt = PIX_FMT_YUV422P;break;
	case FMT_422:vjsdl->ffmpeg_pixfmt = PIX_FMT_YUV422P;break;
	}
    sws_template templ;	
    memset(&templ,0,sizeof(sws_template));
    templ.flags = yuv_which_scaler();
    VJFrame *src = yuv_yuv_template( NULL,NULL,NULL,vjsdl->width,vjsdl->height, vjsdl->ffmpeg_pixfmt );
    VJFrame *dst = yuv_yuv_template(  NULL,NULL,NULL,vjsdl->width,vjsdl->height,PIX_FMT_YUYV422);
    vjsdl->scaler = yuv_init_swscaler( src,dst, &templ, yuv_sws_get_cpu_flags() );

    vjsdl->src_frame = (void*) src;
    vjsdl->dst_frame = (void*) dst;

    return vjsdl;
}