コード例 #1
0
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;
}
コード例 #2
0
ファイル: vj-misc.c プロジェクト: flv0/veejay
static int	is_usable_file( filelist_t *filelist, const char *node, const char *filename )
{
	if(!node) 
		return 0;

	struct stat l;
	veejay_memset(&l,0,sizeof(struct stat));
	if( lstat( node, &l) < 0 )
		return 0;
	
	if( S_ISLNK( l.st_mode )) {
		veejay_memset(&l,0,sizeof(struct stat));
		stat(node, &l);
		return 1;
	}
	
	if( S_ISDIR( l.st_mode ) ) {
		return 1;
	}

	if( S_ISREG( l.st_mode ) ) {
		if( is_it_usable(node)) {
			if( filelist->num_files < filelist->max_files ) {
				filelist->files[ filelist->num_files ] =
					relative_path(filelist,node);
				filelist->num_files ++;
			}
		}
	}
	return 0;
}
コード例 #3
0
ファイル: bgsubtract.c プロジェクト: c0ntrol/veejay
static void bgsubtract_show_bg( VJFrame *frame )
{
	veejay_memcpy( frame->data[0], bg_frame__[0], frame->len );
	if( bg_ssm && frame->ssm ) {
		veejay_memcpy( frame->data[1], bg_frame__[1], frame->len );
		veejay_memcpy( frame->data[2], bg_frame__[2], frame->len );
	} else { /* subsampling does not match */
		veejay_memset( frame->data[1], 128, frame->uv_len );
		veejay_memset( frame->data[2], 128, frame->uv_len );
	}	
}
コード例 #4
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;
}
コード例 #5
0
ファイル: sequence.c プロジェクト: flv0/veejay
static int	veejay_process_status( veejay_preview_t *vp, veejay_track_t *v )
{

	unsigned char status_len[6];
	veejay_memset( status_len, 0, sizeof(status_len) );
	int k = -1;
	int n = 0;
	while( (k = vj_client_poll( v->fd, V_STATUS )) ) // is there a more recent message?
	{
		veejay_memset( status_len, 0, sizeof( status_len ) );
		n = vj_client_read(v->fd, V_STATUS, status_len, 5 );
		int bytes= 0;

		if( status_len[0] != 'V' ) {
			n = -1;
			k = -1;
		}

		if( n == -1  && v->is_master ) {
			reloaded_schedule_restart();
			break;
		}
		
		if( sscanf( (char*) status_len+1, "%03d", &bytes ) != 1 ) {
			veejay_msg(0, "Invalid status message.");
			bytes = 0;
			reloaded_schedule_restart();
			break;
		}

		if(bytes > 0 )
		{
			n = vj_client_read( v->fd, V_STATUS, v->status_buffer, bytes );
			if( n <= 0 ) {	
				if( n == -1 && v->is_master )
					reloaded_schedule_restart();		
									
				break;
			}
		}
	}
	if( k == -1 && v->is_master )
		reloaded_schedule_restart();
	
	veejay_memset( v->status_tokens,0, sizeof(sizeof(int) * 32));
	status_to_arr( (char*) v->status_buffer, v->status_tokens );	
	return 1;
}
コード例 #6
0
ファイル: videowall.c プロジェクト: c0ntrol/veejay
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;
}
コード例 #7
0
ファイル: multitrack.c プロジェクト: flv0/veejay
static	GdkPixbuf	*load_logo_image(int dw, int dh )
{
	char path[1024];
	veejay_memset(path,0,sizeof(path));
	get_gd(path,NULL, "veejay-logo.png");
	return gdk_pixbuf_new_from_file( path,NULL );
}
コード例 #8
0
ファイル: dummy.c プロジェクト: d-j-a-y/veejay-dyne-outdated
void dummy_rgb_apply( VJFrame *frame, int width, int height, int r,int g, int b)
{
    	const int len = frame->len;
	const int uv_len = frame->uv_len;
	int colorCb, colorCr, colorY;

 	uint8_t *Y = frame->data[0];
	uint8_t *Cb = frame->data[1];
	uint8_t *Cr = frame->data[2];

	_rgb2yuv(r,g,b,colorY,colorCb,colorCr);
  
 	veejay_memset( Y, colorY, len);
   	veejay_memset( Cb,colorCb,uv_len);
   	veejay_memset( Cr,colorCr,uv_len);
}
コード例 #9
0
ファイル: avhelper.c プロジェクト: flv0/veejay
static int avcodec_decode_video( AVCodecContext *avctx, AVFrame *picture, int *got_picture, uint8_t *data, int pktsize ) {
	AVPacket pkt;
	veejay_memset( &pkt, 0, sizeof(AVPacket));
	pkt.data = data;
	pkt.size = pktsize;
	return avcodec_decode_video2( avctx, picture, got_picture, &pkt );
}
コード例 #10
0
ファイル: alphaflatten.c プロジェクト: c0ntrol/veejay
void alphaflatten_apply( VJFrame *frame, int mode)
{
	unsigned int i;
	const int len = frame->len;

	uint8_t *o0 = frame->data[0];
	uint8_t *o1 = frame->data[1];
	uint8_t *o2 = frame->data[2];
	uint8_t *oA = frame->data[3];
	uint8_t *a0 = frame->data[0];
	uint8_t *a1 = frame->data[1];
	uint8_t *a2 = frame->data[2];
	uint8_t *aA = frame->data[3];

	for( i = 0; i < len; i ++ )
	{
		unsigned int op1 = 0xff - aA[i];
		unsigned int op0 = aA[i];
		o0[i] = (op0 * a0[i]) >> 8;
		o1[i] = (op0 * a1[i] + op1 * 128) >> 8;
		o2[i] = (op0 * a2[i] + op1 * 128)>>8;
	}

	if( mode ) {
		veejay_memset( oA, 0, len );
	}
}
コード例 #11
0
ファイル: multitrack.c プロジェクト: flv0/veejay
void		*multitrack_sync( void * mt )
{
	multitracker_t *m = (multitracker_t*) mt;
	sync_info *s = gvr_sync( m->preview );	
	if(!s)
		return NULL;

	if(!vt___)
	{
		veejay_memset(vt__,0,sizeof(vt__));
		vt___ = 1;
	}

	int i;
	for( i =0; i < MAX_TRACKS ;i ++ )
	{
		if(!vt__[i] && s->status_list[i] == NULL )
		{
			//gtk_widget_set_sensitive_(GTK_WIDGET(m->view[i]), FALSE );
			vt__[i] = 1;
		}
		else if( s->status_list[i] && vt__[i] )
		{
			//gtk_widget_set_sensitive_(GTK_WIDGET(m->view[i]), TRUE );
			vt__[i] = 0;
		}
	}
	s->master = m->master_track;
	return (void*)s;
}
コード例 #12
0
ファイル: plugload.c プロジェクト: flv0/veejay
static	int	scan_plugins()
{
	char *home = getenv( "HOME" );
	char path[PATH_MAX];
	char data[CONFIG_FILE_LEN];
	if(!home) return 0;
	
	sprintf( path , "%s/.veejay/plugins.cfg" , home );

	int fd = open( path, O_RDONLY );
	if( fd < 0 ) {
		return 0;
	}

	veejay_memset( data,0, sizeof(data));

	if( read( fd, data, CONFIG_FILE_LEN ) > 0 )
	{
		char *pch = strtok( data, "\n" );
		while( pch != NULL )
		{
			add_to_plugin_list( pch );
			pch = strtok( NULL, "\n");
		}
	}

	close(fd);

	return 1;
}
コード例 #13
0
ファイル: photoplay.c プロジェクト: c0ntrol/veejay
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;
}
コード例 #14
0
ファイル: plugload.c プロジェクト: flv0/veejay
static	char	*get_livido_plug_path()
{ //@ quick & dirty
	char location[1024];
	snprintf( location, sizeof(location)-1, "/proc/%d/exe", getpid() );
	
	char target[1024];
	char lvdpath[1024];
	
	veejay_memset(lvdpath,0,sizeof(lvdpath));

	int  err = readlink( location, target, sizeof(target) );
	if( err >= 0 )
	{
	 target[err] = '\0';

	 int n = err;
	 while( target[n] != '/' && n > 0 ) {
	   n--; //@ strip name of executable
	 }
	 if( n > 0 ) n --;
	 
	 while( target[n] != '/' && n > 0 ) {
	   n--; //@ strip bin dir of executable
	 }
	 
	 strncpy(lvdpath, target, n );
 	 strcat( lvdpath, "/lib/livido-plugins" );	 

	 return vj_strdup( lvdpath );
	}
	return NULL;
}
コード例 #15
0
ファイル: dummy.c プロジェクト: d-j-a-y/veejay-dyne-outdated
void dummy_apply( VJFrame *frame, int width, int height, int color)
{
    const int len = frame->len;
    const int uv_len = frame->uv_len;
    char colorCb, colorCr, colorY;

    uint8_t *Y = frame->data[0];
    uint8_t *Cb = frame->data[1];
    uint8_t *Cr = frame->data[2];

    colorY = bl_pix_get_color_y(color);
    colorCb = bl_pix_get_color_cb(color);
    colorCr = bl_pix_get_color_cr(color);

    veejay_memset( Y, colorY, len);
    veejay_memset( Cb,colorCb,uv_len);
    veejay_memset( Cr,colorCr,uv_len);
}
コード例 #16
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;
}
コード例 #17
0
ファイル: average.c プロジェクト: c0ntrol/veejay
void average_apply(VJFrame *frame, int max_sum, int mode)
{
    unsigned int i;
    const int len = frame->len;
    uint8_t *Y = frame->data[0];
    uint8_t *Cb = frame->data[1];
    uint8_t *Cr = frame->data[2];
    
	if( last_params[0] != max_sum || last_params[1] != mode || ( mode == 0 && frame_count == max_sum) )
	{
		veejay_memset( running_sum[0], 0, sizeof(double) * (len + len + len) );
		last_params[0] = max_sum;
		last_params[1] = mode;
		frame_count = 1;
	}

	if( mode == 0 )
	{
		if( frame_count <= max_sum ) {
			for (i = 0; i < len; i++) {
				running_sum[0][i] += Y[i];
				running_sum[1][i] += Cb[i];
				running_sum[2][i] += Cr[i];
			}
		}

		if( frame_count > 2 ) {

			for (i = 0; i < len; i++) {
				Y[i] = (uint8_t)(running_sum[0][i] / frame_count );
				Cb[i] = (uint8_t)(running_sum[1][i] / frame_count );
				Cr[i] = (uint8_t)(running_sum[2][i] / frame_count );
			}
		}

		if( frame_count <= max_sum )
			frame_count ++;
	}
	else
	{
		for (i = 0; i < len; i++) {
			running_sum[0][i] += Y[i];
			running_sum[1][i] += Cb[i];
			running_sum[2][i] += Cr[i];
		}

		if( frame_count > 2 )
		{
			for (i = 0; i < len; i++) {
				Y[i] = (running_sum[0][i] / frame_count );
				Cb[i] = (running_sum[1][i] / frame_count );
				Cr[i] = (running_sum[2][i] / frame_count );
			}
		}
		frame_count ++;
	}
}
コード例 #18
0
ファイル: sequence.c プロジェクト: flv0/veejay
static	void	gvr_parse_track_list( veejay_preview_t *vp, veejay_track_t *v, unsigned char *tmp, int len )
{
	int i = 0;
	int items = 0;
	unsigned char *ptr = tmp;

	char **z = vj_calloc( sizeof( char * ) * vp->n_tracks );

	while( i < len )
	{
		int k = 0;
		char k_str[4];
		strncpy( k_str,(char*) ptr, 3 );
		if( k > 0 )
		{
			ptr += 3;
			z[items] = strndup( (char*) ptr, k );
			items ++;
			ptr += k;
		}
		i += ( 3 + k );
	}

	if( items > 0 )
	{
		for( i = 0; i < items ; i ++ )
		{
			int k;
			int in_track = -1;
			for( k = 0; k < vp->n_tracks ; k ++ )
			{
				veejay_track_t *t = vp->tracks[k];
				if(t)
				{
					char hostname[255];
					int  port = 0;
					int  stream_id = 0;
					veejay_memset(hostname,0,255 );
					if( sscanf( (char*) z[i], "%s %d %d", hostname, &port, &stream_id ))
					{
						if( strcasecmp(	hostname, t->hostname ) == 0 &&
							port == t->port_num )
							in_track = k;	
					}
				}
			}

			v->track_list[i] = in_track;			

			free( z[i] );
		}
		v->track_items = items;
	}

	free( z );
}
コード例 #19
0
ファイル: contourextract.c プロジェクト: flv0/veejay
int contourextract_malloc(void **d, int width, int height)
{
    contourextract_data *my;
    *d = (void*) vj_calloc(sizeof(contourextract_data));
    my = (contourextract_data*) *d;

    dw_ = nearest_div( width / 8  );
    dh_ = nearest_div( height / 8 );

    my->current = (uint8_t*) vj_calloc( ru8( sizeof(uint8_t) * dw_ * dh_ * 3 ) );
    my->bitmap = (uint8_t*) vj_calloc( ru8(sizeof(uint8_t) * width * height ));

    if(static_bg == NULL)
        static_bg = (uint8_t*) vj_calloc( ru8( width + width * height * sizeof(uint8_t)) );
    if(dt_map == NULL )
        dt_map = (uint32_t*) vj_calloc( ru8(width * height * sizeof(uint32_t) + width ) );

    veejay_memset( &template_, 0, sizeof(sws_template) );
    veejay_memset( proj_, 0, sizeof(proj_) );

    template_.flags = 1;

    vj_get_yuvgrey_template( &to_shrink_, width, height );
    vj_get_yuvgrey_template( &shrinked_ , dw_, dh_ );

    shrink_ = yuv_init_swscaler(
                  &(to_shrink_),
                  &(shrinked_),
                  &template_ ,
                  yuv_sws_get_cpu_flags() );

    points = (point_t**) vj_calloc( sizeof(point_t*) * 12000 );
    int i;
    for( i = 0; i < 12000; i ++ )
    {
        points[i] = (point_t*) vj_calloc( sizeof(point_t) );
    }

    veejay_memset( x_, 0, sizeof(x_) );
    veejay_memset( y_, 0, sizeof(y_) );

    return 1;
}
コード例 #20
0
ファイル: boids.c プロジェクト: d-j-a-y/veejay-dyne-outdated
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;
}
コード例 #21
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;
}
コード例 #22
0
void	timedistort_free()
{
	if(nonmap)
		free(nonmap);
	if( planes[0])
		free(planes[0]);
	if( warptime[0] )
		free(warptime[0]);
	if( warptime[1] )
		free(warptime[1] );
	veejay_memset( planetableY, 0, PLANES);
	veejay_memset( planetableU, 0, PLANES);
	veejay_memset( planetableV, 0, PLANES);
	planes[0] = NULL;
	warptime[0] = NULL;
	warptime[1] = NULL;
	state = 0;
	plane = 0;
	nonmap = NULL;
}
コード例 #23
0
void bgsubtract_apply(VJFrame *frame,int width, int height, int threshold, int mode )
{
	VJFrame tmp;
	veejay_memset( &tmp, 0, sizeof(VJFrame));
	tmp.data[0] = frame->data[0];
	tmp.width = width;
	tmp.height = height;

	//@ 3x3 blur
	softblur_apply( &tmp, width,height,0);

	if ( mode == 0 ) {
		binarify( frame->data[0], static_bg,frame->data[0], threshold, 0, width*height );
	} else if ( mode == 1 ) {
		binarify( frame->data[0], static_bg, frame->data[0], threshold, 1,width*height );
	}

	veejay_memset( frame->data[1], 128, frame->uv_len );
	veejay_memset( frame->data[2], 128, frame->uv_len );
	
}
コード例 #24
0
void bwselect_apply(VJFrame *frame, int width, int height, int min_threshold, int max_threshold) {
	int r,c;
        const int len = frame->len;
	uint8_t *Y = frame->data[0];
	uint8_t *Cb = frame->data[1];
	uint8_t *Cr = frame->data[2];

	for(r=0; r < len; r+=width) {
		for(c=0; c < width; c++) {
			uint8_t p = Y[r+c];
			if( p > min_threshold && p < max_threshold) {
				Y[r+c] = pixel_Y_hi_;
			}
			else {
				Y[r+c] = pixel_Y_lo_;
			}
		}
	}
	veejay_memset(Cb, 128, frame->uv_len);
	veejay_memset(Cr, 128, frame->uv_len);
}
コード例 #25
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;
}
コード例 #26
0
ファイル: bgsubtract.c プロジェクト: c0ntrol/veejay
void bgsubtract_apply(VJFrame *frame,int threshold, int method, int enabled, int alpha )
{
	const int len = frame->len;
	const int uv_len = (frame->ssm ? len : frame->uv_len );

	if( auto_hist )
		vje_histogram_auto_eq( frame );

	if( enabled == 0 ) {
		switch( method ) {
			case 0:
				bgsubtract_show_bg( frame );
				break;
			case 1:
				bgsubtract_cma_frame( len, frame->data[0], bg_frame__[0] );
				bgsubtract_show_bg( frame );
				bg_n ++;
				break;
			case 2:
				bgsubtract_avg_frame( len, frame->data[0], bg_frame__[0] );
				bgsubtract_show_bg( frame );
				break;	
			default:
			break;
		}
	}
	else {
		if( alpha == 0 ) {
			veejay_memset( frame->data[1], 128, uv_len );
			veejay_memset( frame->data[2], 128, uv_len );
			vje_diff_plane( bg_frame__[0], frame->data[0], frame->data[0], threshold, len );
		}
		else {
			vje_diff_plane( bg_frame__[0], frame->data[0], frame->data[3], threshold, len );
		}
	}
}
コード例 #27
0
int	chameleonblend_prepare( uint8_t *map[4], int width, int height )
{
	if(!bgimage[0])
		return 0;
	int strides[4] = { width*height,width*height,width*height, 0 };
	vj_frame_copy( map, bgimage, strides );
	
	VJFrame tmp;
	veejay_memset( &tmp, 0, sizeof(VJFrame));
	tmp.data[0] = bgimage[0];
	tmp.width = width;
	tmp.height = height;

	//@ 3x3 blur
	softblur_apply( &tmp, width,height,0);

	veejay_msg(2, "Chameleon BlendTV: Snapped background mask");
	return 1;
}
コード例 #28
0
ファイル: contourextract.c プロジェクト: flv0/veejay
int contourextract_prepare(uint8_t *map[4], int width, int height)
{
    if(!static_bg )
    {
        return 0;
    }

    vj_frame_copy1( map[0], static_bg, (width*height));

    VJFrame tmp;
    veejay_memset( &tmp, 0, sizeof(VJFrame));
    tmp.data[0] = static_bg;
    tmp.width = width;
    tmp.height = height;
    softblur_apply( &tmp, width,height,0);

    veejay_msg(2, "Contour extraction: Snapped background frame");
    return 1;
}
コード例 #29
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;
}
コード例 #30
0
ファイル: multitrack.c プロジェクト: flv0/veejay
static	void	add_buttons( sequence_view_t *p, sequence_view_t *seqv , GtkWidget *w)
{
	int i;
	for( i = 0; i < FIRST_ROW_END;i ++ )
	{
		char path[1024];
		veejay_memset(path,0,sizeof(path));
		get_gd(path,NULL, button_template_t[i].file );
		seqv->icons[i] = gtk_image_new_from_file( path );
		seqv->buttons[i] = gtk_button_new_with_label(" ");
		gtk_widget_set_size_request_( seqv->icons[i],24,20 );
		gtk_button_set_image( GTK_BUTTON(seqv->buttons[i]), seqv->icons[i] );
		gtk_widget_set_size_request_( seqv->buttons[i],24,20 );
		gtk_box_pack_start( GTK_BOX(w), seqv->buttons[i], TRUE,TRUE, 0 );
		g_signal_connect( G_OBJECT( seqv->buttons[i] ), "clicked", G_CALLBACK( button_template_t[i].f),
				(gpointer)p );		
		gtk_widget_show( seqv->buttons[i] );

	}
}