memcpy(working,video,tw*th*3);
memcpy(working,video,tw*th*4);
int DIA_getBSMearParams(		uint32_t *w,uint32_t 	*w2, uint32_t *h,uint32_t *h2,uint32_t tw,uint32_t th,									uint8_t *video){	// Allocate space for green-ised video	working=new uint8_t [tw*(th)*4];	memcpy(working,video,tw*th*4);	uint8_t ret=0;	dialog=create_dialog1();	gtk_transient(dialog);	original=video;	left=*w;	right=*w2;	top=*h;	bottom=*h2;	width=tw;	height=th;	gtk_widget_set_usize(WID(drawingarea1), tw,th);	gtk_widget_show(dialog);	upload(dialog);	update(working, tw,th);	 gtk_signal_connect(GTK_OBJECT(WID(drawingarea1)), "expose_event",		       GTK_SIGNAL_FUNC(gui_draw),		       NULL);	gtk_signal_connect(GTK_OBJECT(WID(buttonAutoCrop)), "clicked",                      GTK_SIGNAL_FUNC(autocrop),                   NULL);	draw(dialog,tw,th);	ret=0;	int response;	while( (response=gtk_dialog_run(GTK_DIALOG(dialog)))==GTK_RESPONSE_APPLY)	{		read(dialog);		memcpy(working,video,tw*th*3);		update(working, tw,th);		draw(dialog,tw,th);	}	if(response==GTK_RESPONSE_OK)        {		read(dialog);		*w=left;		*w2=right;		*h=top;		*h2=bottom;		ret=1;	}	gtk_widget_destroy(dialog);	delete working;	working=NULL;	dialog=NULL;	original=NULL;	return ret;}