Beispiel #1
0
SANE_Status
sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
{
  V4L_Scanner *s = handle;

  DBG (4, "sane_get_parameters\n");
  update_parameters (s);
  if (params == 0)
    {
      DBG (1, "sane_get_parameters: params == 0\n");
      return SANE_STATUS_INVAL;
    }
  if (-1 == v4l1_ioctl (s->fd, VIDIOCGWIN, &s->window))
    {
      DBG (1, "sane_control_option: ioctl VIDIOCGWIN failed "
	   "(can not get window geometry)\n");
      return SANE_STATUS_INVAL;
    }
  parms.pixels_per_line = s->window.width;
  parms.bytes_per_line = s->window.width;
  if (parms.format == SANE_FRAME_RGB)
    parms.bytes_per_line = s->window.width * 3;
  parms.lines = s->window.height;
  *params = parms;
  return SANE_STATUS_GOOD;

}
void SoundDriverDialog::check_driver_status() {
	
	if (need_param_update) {
		update_status();
		update_parameters();
		need_param_update=false;
	}
}
void MapGridCostFunction::initialize(std::string base_name, std::string plugin_name, plugin_local_planner::LocalPlannerUtil *planner_util) {
    plugin_local_planner::TrajectoryCostFunction::initialize(base_name, plugin_name, planner_util);
    stop_on_failure_ = true;

    update_parameters();
        
    map_.sizeCheck(costmap_->getSizeInCellsX(), costmap_->getSizeInCellsY());
}
void SoundDriverDialog::read_finished() {
	
	if (config_driver>=0 && config_must_enable_driver) {
		
		SoundDriverManager::init_driver(config_driver);
	}	
	
	update_parameters();
}
Beispiel #5
0
void Unison::set_bandwidth(REALTYPE bandwidth) {
    if(bandwidth < 0)
        bandwidth = 0.0;
    if(bandwidth > 1200.0)
        bandwidth = 1200.0;

    printf("bandwidth %g\n", bandwidth);
    unison_bandwidth_cents = bandwidth;
    update_parameters();
}
		cuda_running_configuration::cuda_running_configuration(
			int device_id,
			float max_global_memory_usage_ratio)
			: device_id(device_id)
			, max_global_memory_usage_ratio(max_global_memory_usage_ratio)
			, cublas_handle(0)
			, cusparse_handle(0)
		{
			update_parameters();
		}
Beispiel #7
0
void Unison::set_size(int new_size) {
    if(new_size < 1)
        new_size = 1;
    unison_size = new_size;
    if(uv)
        delete [] uv;
    uv = new UnisonVoice[unison_size];
    first_time = true;
    update_parameters();
}
void SoundDriverDialog::sound_driver_changed(int p_to_which) {

	if (updating || updating_parameters)
		return;
	
	SoundDriverManager::init_driver(p_to_which);
	update_parameters();
	update_status();
	
}
Beispiel #9
0
static PJ_COORD helmert_reverse_4d (PJ_COORD point, PJ *P) {
    struct pj_opaque_helmert *Q = (struct pj_opaque_helmert *) P->opaque;

    /* We only need to rebuild the rotation matrix if the
     * observation time is different from the last call */
    double t_obs = (point.xyzt.t == HUGE_VAL) ? Q->t_epoch : point.xyzt.t;
    if (t_obs != Q->t_obs) {
        Q->t_obs = t_obs;
        update_parameters(P);
        build_rot_matrix(P);
    }

    point.lpz = helmert_reverse_3d (point.xyz, P);

    return point;
}
void config_loudness( // Configure loudness parameters
	GAIN_PARAM_S * cur_param_ps // Pointer to structure containing gain parameters
)
{
	// Check if Gain-shaping initialised
	if (0 == gain_gs.init_done)
	{ // Initialse Gain shaping
  	init_gain( &gain_gs );	// Initialise gain data structure

		gain_gs.init_done = 1; // Signal Gain-shaping initialised
	} // if (0 == gain_gs->init_done)

//printstr("GN= "); printintln( (int)cur_param_ps->gain ); // MB~

	// Calculate gain-shaping parameters
	update_parameters( &gain_gs ,cur_param_ps );

	gain_gs.params_set = 1; // Signal Gain-shaping parameters configured

} // config_loudness 
void SoundDriverDialog::show() {

	updating=true;
	
	sound_driver->clear();
	
	for (int i=0;i<SoundDriverManager::get_driver_count();i++) {
		
		sound_driver->add_string( SoundDriverManager::get_driver(i)->get_name() );
	}
	
	sound_driver->select( SoundDriverManager::get_current_driver_index() );
	
	update_parameters();
	update_status();

	Window::show();
	
	updating=false;
}
Beispiel #12
0
Reverb::Reverb() {

	params.room_size = 0.8;
	params.damp = 0.5;
	params.dry = 1.0;
	params.wet = 0.0;
	params.mix_rate = 44100;
	params.extra_spread_base = 0;
	params.extra_spread = 1.0;
	params.predelay = 150;
	params.predelay_fb = 0.4;
	params.hpf = 0;
	hpf_h1 = 0;
	hpf_h2 = 0;

	input_buffer = memnew_arr(float, INPUT_BUFFER_MAX_SIZE);
	echo_buffer = 0;

	configure_buffers();
	update_parameters();
}
Beispiel #13
0
/* INITIALIZE_PARAMETERS
   15dec94 wmt: add params FILE *log_file_fp, FILE *stream, exit for
                "Too many classes for available data"

   This is to be applied to a classification which has just had its wts reset.
   It updates the parameters and does two base-cycle's to assure that the
   weights and parameters are in approximate agreement.  With delete-duplicates,
   it then eliminates any obvious duplicates.
   */
int initialize_parameters( clsf_DS clsf, int display_wts, int  delete_duplicates,
                          unsigned int initial_cycles_p, FILE *log_file_fp, FILE *stream)
{
  int converge_cycle_p = FALSE;

  if (clsf->n_classes > clsf_DS_max_n_classes(clsf)) {
    to_screen_and_log_file("ERROR: too many classes for available data!!!\n",
                           log_file_fp, stream, TRUE);
    exit(1);
  }
  clsf->log_p_x_h_pi_theta = 0.0;

  update_parameters(clsf);

  update_ln_p_x_pi_theta(clsf, FALSE);

  update_approximations(clsf);

  if (display_wts == TRUE)
    display_step( clsf, stream);

  if (initial_cycles_p == TRUE) {

    base_cycle(clsf, stream, display_wts, converge_cycle_p);

    if (delete_duplicates == TRUE)
      while (class_duplicatesp(clsf->n_classes, clsf->classes) == TRUE) {
        if (stream != NULL)
          fprintf( stream, "Before class_duplicatesp, n_classes is %d\n", clsf->n_classes);
        clsf->classes =
          delete_class_duplicates(&(clsf->n_classes), clsf->classes);
        if (stream != NULL)
          fprintf( stream, "After class_duplicatesp, n_classes is %d\n", clsf->n_classes);
        base_cycle(clsf, stream, display_wts, converge_cycle_p);
      }
  }
  return(clsf->n_classes);
}
Beispiel #14
0
  Implementation(common::Component& self) :
    m_self(self),
    m_ml_parameter_list(Teuchos::createParameterList()),
    m_solver_parameter_list(Teuchos::createParameterList()),
    m_xcoords(0),
    m_dim(0)
  {
    // ML default parameters
    ML_Epetra::SetDefaults("SA", *m_ml_parameter_list);
    m_ml_parameter_list->set("ML output", 10);
    m_ml_parameter_list->set("max levels",3);
    m_ml_parameter_list->set("aggregation: type", "METIS");
    m_ml_parameter_list->set("aggregation: nodes per aggregate", 16);
    m_ml_parameter_list->set("smoother: type","Chebyshev");
    m_ml_parameter_list->set("smoother: sweeps",2);
    m_ml_parameter_list->set("smoother: pre or post", "both");
    
    Amesos amesos;
    if(amesos.Query("Amesos_Mumps"))
    {
      m_ml_parameter_list->set("coarse: type","Amesos-MUMPS");
    }
    else
    {
      m_ml_parameter_list->set("coarse: type","Amesos-KLU");
    }
    
    // Default solver parameters
    m_solver_parameter_list->set( "Verbosity", Belos::TimingDetails | Belos::FinalSummary );
    m_solver_parameter_list->set( "Block Size", 1 );
    m_solver_parameter_list->set( "Num Blocks", 400 );
    m_solver_parameter_list->set( "Maximum Iterations", 500 );
    m_solver_parameter_list->set( "Convergence Tolerance", 1.0e-4 );
    m_solver_parameter_list->set( "Num Recycled Blocks", 300 );

    update_parameters();
  }
void SoundDriverDialog::disable() {
	
	SoundDriverManager::finish_driver();
	update_parameters();
	update_status();
}
void SoundDriverDialog::restart() {
	
	SoundDriverManager::init_driver();
	update_parameters();
	update_status();
}
Beispiel #17
0
int main(int argc, char* argv[]){

  if (argc != 1){
    fprintf( stderr, "Usage: %s\n", argv[0]);
    exit(EXIT_FAILURE);
  }

  int i;

  /* data directory */
  char data_dir[256];
  snprintf(data_dir, 256, "../data/");

  /* load the pointing list */
  char plist_filename[256];
  snprintf(plist_filename, 256, "%stodo_list.ascii.dat", data_dir);

  int N_plist;
  POINTING *plist;
  load_pointing_list(plist_filename, &N_plist, &plist);


  /* Read star data for each pointing */
  for(i = 0; i < N_plist; i++){
    char data_filename[256];
    snprintf(data_filename, 256, "%sstar_%s.ascii.dat", data_dir, plist[i].ID);
    load_data(data_filename, &plist[i].N_data, &plist[i].data);
  }

  fprintf(stderr, "Star data loaded from %s\n", data_dir);

  /* Read model data for each pointing,
     here each file starts with uniformly distributed random */
  for(i = 0; i < N_plist; i++){
    char model_filename[256];
    snprintf(model_filename, 256, "%suniform_%s.ascii.dat", data_dir, plist[i].ID);
    load_data(model_filename, &plist[i].N_model, &plist[i].model);
  }

  fprintf(stderr, "Uniform model data loaded from %s\n", data_dir);

  /* initialize model parameters */
  PARAMETERS params;
  params.N_parameters = 5; 	/* Total number of free paramters. */

  params.thindisk_type = 1;	/* turn on thin disk */
  params.thindisk_r0 = 2.475508;
  params.thindisk_z0 = 0.241209;
  params.thindisk_n0 = 1.0;

  params.thickdisk_type = 1;	/* turn on thick disk */
  params.thickdisk_r0 = 2.417346;
  params.thickdisk_z0 = 0.694395;
  params.thickdisk_n0 = 0.106672;

  params.halo_type = 0; 	/* turn off halo */

  fprintf(stderr, "Set initial parameters..\n");

  int mcmc_steps, efficiency_counter;
  double efficiency;
  MCMC *mcmc_chain;
  double chi2, delta_chi2;
  int dof;

  mcmc_steps = 500000;
  mcmc_chain = calloc(mcmc_steps, sizeof(MCMC));

  FILE *file_chain_realtime;
  file_chain_realtime = fopen("./data/mcmc.dat", "a");

  fprintf(stderr, "Allocate MCMC chain..Max steps = %d \n", mcmc_steps);

  /* set the first element as the initial parameters.
   Then calculate the chi2 for the initial parameters. */
  mcmc_chain[0].params = params;

  set_weights(mcmc_chain[0].params, plist, N_plist);

  /* allocate space for correlation function calculation */
  /* This also does a first time correlation calculation of initial parameters. */
  /* DD pairs may only calculated once here but not later.  */
  correlation_initialize(plist, N_plist);

  /* load the jackknife fractional errors */
  load_errors(plist, N_plist);

  mcmc_chain[0].dof = degrees_of_freedom(plist, N_plist, params);
  mcmc_chain[0].chi2 = chi_square(plist, N_plist);

  fprintf(stderr, "initial: chi2 = %le \n", mcmc_chain[0].chi2);

  fprintf(stderr, "Start MCMC calculation..\n");

  /* Markov chain loop */
  efficiency_counter = 1;
  for(i = 1; i < mcmc_steps; i++){

    /* update new positions in paramter space */
    params = update_parameters(mcmc_chain[i - 1].params);

    /* recalculate weights */
    set_weights(params, plist, N_plist);

    /* recalculate correlation functions */
    calculate_correlation(plist, N_plist);

    /* get chi squares */
    dof = degrees_of_freedom(plist, N_plist, params);

    chi2 = chi_square(plist, N_plist);

    delta_chi2 = chi2 - mcmc_chain[i - 1].chi2;

    fprintf(stderr, "delta_chi2 = %le \n", delta_chi2);

    if(delta_chi2 <= 0.0){
      /* if delta chisquare is smaller then record*/
      mcmc_chain[i].params = params;
      mcmc_chain[i].chi2 = chi2;
      mcmc_chain[i].dof = dof;
      efficiency_counter++;
    }
    else{
      /* if delta chisquare is bigger then use probability to decide */
      /* !!! replace with GSL random generator later !!! */
      double tmp = (double)rand() / (double)RAND_MAX; /* a random number in [0,1] */
      if (tmp < exp(- delta_chi2 / 2.0)){
	mcmc_chain[i].params = params;
	mcmc_chain[i].chi2 = chi2;
	mcmc_chain[i].dof = dof;
	efficiency_counter++;
      }
      else{
	/* record the old position. */
	mcmc_chain[i] = mcmc_chain[i - 1];
      }
    }

    efficiency = (float) efficiency_counter / i;
    /* print out progress */
    /* if(i % (mcmc_steps / 100) == 0){ */
    /*   fprintf(stderr, "MCMC... %d / %d: chi2 = %lf \n", i, mcmc_steps, chi2); */
    /* } */
    fprintf(stderr, "MCMC... %d / %d: efficiency = %lf \n z0_thin = %lf, r0_thin = %lf, z0_thick = %lf, r0_thick = %lf, n0_thick = %lf \n chi2 = %lf, dof = %d, chi2_reduced = %lf \n\n",
	    i, mcmc_steps, efficiency, params.thindisk_z0, params.thindisk_r0, params.thickdisk_z0, params.thickdisk_r0, params.thickdisk_n0, chi2, dof, chi2/dof);

    MCMC tmp_mc;
    PARAMETERS tmp_p;
    tmp_mc = mcmc_chain[i];
    tmp_p = tmp_mc.params;
    // fprintf(stderr, "Made it here\n");
    // fprintf(file_chain_realtime, "%d\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%d\t%lf\n",
	   //  i+50000, tmp_p.thindisk_r0, tmp_p.thindisk_z0, tmp_p.thickdisk_r0, tmp_p.thickdisk_z0, tmp_p.thickdisk_n0,
	   //  tmp_mc.chi2, (int)tmp_mc.dof, tmp_mc.chi2/dof);
    // fprintf(stderr, "Printed to file.\n");
    // if(i % 50 == 0){
    //   fflush(file_chain_realtime);
    // }

  } /* end of mcmc */


  output_mcmc(mcmc_chain, mcmc_steps);

  fprintf(stderr, "End MCMC calculation..\n");

  for(i = 0; i < N_plist; i++){
    free(plist[i].data);
    free(plist[i].model);
    free(plist[i].corr);
  }
  free(plist);

  free(mcmc_chain);

  return EXIT_SUCCESS;

}
Beispiel #18
0
SANE_Status
sane_control_option (SANE_Handle handle, SANE_Int option,
		     SANE_Action action, void *val, SANE_Int * info)
{
  V4L_Scanner *s = handle;
  SANE_Status status;
  SANE_Word cap;

  if (info)
    *info = 0;

  if (option >= NUM_OPTIONS || option < 0)
    return SANE_STATUS_INVAL;

  DBG (4, "sane_control_option: %s option %d (%s)\n",
       action == SANE_ACTION_GET_VALUE ? "get" :
       action == SANE_ACTION_SET_VALUE ? "set" :
       action == SANE_ACTION_SET_AUTO ? "auto set" :
       "(unknow action with)", option,
       s->opt[option].name ? s->opt[option].name : s->opt[option].title);

  cap = s->opt[option].cap;

  if (!SANE_OPTION_IS_ACTIVE (cap))
    {
      DBG (1, "sane_control option: option is inactive\n");
      return SANE_STATUS_INVAL;
    }

  if (action == SANE_ACTION_GET_VALUE)
    {
      switch (option)
	{
	  /* word options: */
	case OPT_NUM_OPTS:
	case OPT_TL_X:
	case OPT_TL_Y:
	case OPT_BR_X:
	case OPT_BR_Y:
	case OPT_BRIGHTNESS:
	case OPT_HUE:
	case OPT_COLOR:
	case OPT_CONTRAST:
	case OPT_WHITE_LEVEL:
	  *(SANE_Word *) val = s->val[option].w;
	  return SANE_STATUS_GOOD;
	case OPT_CHANNEL:	/* string list options */
	case OPT_MODE:
	  strcpy (val, s->val[option].s);
	  return SANE_STATUS_GOOD;
	default:
	  DBG (1, "sane_control_option: option %d unknown\n", option);
	}
    }
  else if (action == SANE_ACTION_SET_VALUE)
    {
      if (!SANE_OPTION_IS_SETTABLE (cap))
	{
	  DBG (1, "sane_control_option: option is not settable\n");
	  return SANE_STATUS_INVAL;
	}
      status = sanei_constrain_value (s->opt + option, val, info);
      if (status != SANE_STATUS_GOOD)
	{
	  DBG (1, "sane_control_option: sanei_constarin_value failed: %s\n",
	       sane_strstatus (status));
	  return status;
	}
      if (option >= OPT_TL_X && option <= OPT_BR_Y)
	{
	  s->user_corner |= 1 << (option - OPT_TL_X);
	  if (-1 == v4l1_ioctl (s->fd, VIDIOCGWIN, &s->window))
	    {
	      DBG (1, "sane_control_option: ioctl VIDIOCGWIN failed "
		   "(can not get window geometry)\n");
	      return SANE_STATUS_INVAL;
	    }
	  s->window.clipcount = 0;
	  s->window.clips = 0;
	  s->window.height = parms.lines;
	  s->window.width = parms.pixels_per_line;
	}


      switch (option)
	{
	  /* (mostly) side-effect-free word options: */
	case OPT_TL_X:
	  break;
	case OPT_TL_Y:
	  break;
	case OPT_BR_X:
	  s->window.width = *(SANE_Word *) val;
	  parms.pixels_per_line = *(SANE_Word *) val;
	  if (info)
	    *info |= SANE_INFO_RELOAD_PARAMS;
	  break;
	case OPT_BR_Y:
	  s->window.height = *(SANE_Word *) val;
	  parms.lines = *(SANE_Word *) val;
	  if (info)
	    *info |= SANE_INFO_RELOAD_PARAMS;
	  break;
	case OPT_MODE:
	  if (info)
	    *info |= SANE_INFO_RELOAD_PARAMS | SANE_INFO_RELOAD_OPTIONS;
	  s->val[option].s = strdup (val);
	  if (!s->val[option].s)
	    return SANE_STATUS_NO_MEM;
	  if (strcmp (s->val[option].s, SANE_VALUE_SCAN_MODE_GRAY) == 0)
	    s->pict.palette = VIDEO_PALETTE_GREY;
	  else
	    s->pict.palette = VIDEO_PALETTE_RGB24;
	  update_parameters (s);
	  break;
	case OPT_BRIGHTNESS:
	  s->pict.brightness = *(SANE_Word *) val *256;
	  s->val[option].w = *(SANE_Word *) val;
	  break;
	case OPT_HUE:
	  s->pict.hue = *(SANE_Word *) val *256;
	  s->val[option].w = *(SANE_Word *) val;
	  break;
	case OPT_COLOR:
	  s->pict.colour = *(SANE_Word *) val *256;
	  s->val[option].w = *(SANE_Word *) val;
	  break;
	case OPT_CONTRAST:
	  s->pict.contrast = *(SANE_Word *) val *256;
	  s->val[option].w = *(SANE_Word *) val;
	  break;
	case OPT_WHITE_LEVEL:
	  s->pict.whiteness = *(SANE_Word *) val *256;
	  s->val[option].w = *(SANE_Word *) val;
	  break;
	case OPT_CHANNEL:
	  {
	    int i;
	    struct video_channel channel;

	    s->val[option].s = strdup (val);
	    if (!s->val[option].s)
	      return SANE_STATUS_NO_MEM;
	    for (i = 0; i < MAX_CHANNELS; i++)
	      {
		if (strcmp (s->channel[i], val) == 0)
		  {
		    channel.channel = i;
		    if (-1 == v4l1_ioctl (s->fd, VIDIOCGCHAN, &channel))
		      {
			DBG (1, "sane_open: can't ioctl VIDIOCGCHAN %s: %s\n",
			     s->devicename, strerror (errno));
			return SANE_STATUS_INVAL;
		      }
		    if (-1 == v4l1_ioctl (s->fd, VIDIOCSCHAN, &channel))
		      {
			DBG (1, "sane_open: can't ioctl VIDIOCSCHAN %s: %s\n",
			     s->devicename, strerror (errno));
			return SANE_STATUS_INVAL;
		      }
		    break;
		  }
	      }
	    return SANE_STATUS_GOOD;
	    break;
	  }
	default:
	  DBG (1, "sane_control_option: option %d unknown\n", option);
	  return SANE_STATUS_INVAL;
	}
      if (option >= OPT_TL_X && option <= OPT_BR_Y)
	{
	  if (-1 == v4l1_ioctl (s->fd, VIDIOCSWIN, &s->window))
	    {
	      DBG (1, "sane_control_option: ioctl VIDIOCSWIN failed (%s)\n",
		   strerror (errno));
	      /* return SANE_STATUS_INVAL; */
	    }
	  if (-1 == v4l1_ioctl (s->fd, VIDIOCGWIN, &s->window))
	    {
	      DBG (1, "sane_control_option: ioctl VIDIOCGWIN failed (%s)\n",
		   strerror (errno));
	      return SANE_STATUS_INVAL;
	    }
	}
      if (option >= OPT_BRIGHTNESS && option <= OPT_WHITE_LEVEL)
	{
	  if (-1 == v4l1_ioctl (s->fd, VIDIOCSPICT, &s->pict))
	    {
	      DBG (1, "sane_control_option: ioctl VIDIOCSPICT failed (%s)\n",
		   strerror (errno));
	      /* return SANE_STATUS_INVAL; */
	    }
	}
      return SANE_STATUS_GOOD;
    }
  else if (action == SANE_ACTION_SET_AUTO)
    {
      if (!(cap & SANE_CAP_AUTOMATIC))
	{
	  DBG (1, "sane_control_option: option can't be set automatically\n");
	  return SANE_STATUS_INVAL;
	}
      switch (option)
	{
	case OPT_BRIGHTNESS:
	  /* not implemented yet */
	  return SANE_STATUS_GOOD;

	default:
	  break;
	}
    }
  return SANE_STATUS_INVAL;
}
Beispiel #19
0
SANE_Status
sane_open (SANE_String_Const devname, SANE_Handle * handle)
{
  V4L_Device *dev;
  V4L_Scanner *s;
  static int v4lfd;
  int i;
  struct video_channel channel;
  SANE_Status status;
  int max_channels = MAX_CHANNELS;

  if (!devname)
    {
      DBG (1, "sane_open: devname == 0\n");
      return SANE_STATUS_INVAL;
    }

  for (dev = first_dev; dev; dev = dev->next)
    if (strcmp (dev->sane.name, devname) == 0)
      {
	DBG (5, "sane_open: device %s found in devlist\n", devname);
	break;
      }
  if (!devname[0])
    dev = first_dev;
  if (!dev)
    {
      DBG (1, "sane_open: device %s doesn't seem to be a v4l "
	   "device\n", devname);
      return SANE_STATUS_INVAL;
    }

  v4lfd = v4l1_open (devname, O_RDWR);
  if (v4lfd == -1)
    {
      DBG (1, "sane_open: can't open %s (%s)\n", devname, strerror (errno));
      return SANE_STATUS_INVAL;
    }
  s = malloc (sizeof (*s));
  if (!s)
    return SANE_STATUS_NO_MEM;
  memset (s, 0, sizeof (*s));
  s->user_corner = 0;		/* ??? */
  s->devicename = devname;
  s->fd = v4lfd;

  if (v4l1_ioctl (s->fd, VIDIOCGCAP, &s->capability) == -1)
    {
      DBG (1, "sane_open: ioctl (%d, VIDIOCGCAP,..) failed on `%s': %s\n",
	   s->fd, devname, strerror (errno));
      v4l1_close (s->fd);
      return SANE_STATUS_INVAL;
    }

  DBG (5, "sane_open: %d channels, %d audio devices\n",
       s->capability.channels, s->capability.audios);
  DBG (5, "sane_open: minwidth=%d, minheight=%d, maxwidth=%d, "
       "maxheight=%d\n", s->capability.minwidth, s->capability.minheight,
       s->capability.maxwidth, s->capability.maxheight);
  if (VID_TYPE_CAPTURE & s->capability.type)
    DBG (5, "sane_open: V4L device can capture to memory\n");
  if (VID_TYPE_TUNER & s->capability.type)
    DBG (5, "sane_open: V4L device has a tuner of some form\n");
  if (VID_TYPE_TELETEXT & s->capability.type)
    DBG (5, "sane_open: V4L device supports teletext\n");
  if (VID_TYPE_OVERLAY & s->capability.type)
    DBG (5, "sane_open: V4L device can overlay its image onto the frame "
	 "buffer\n");
  if (VID_TYPE_CHROMAKEY & s->capability.type)
    DBG (5, "sane_open: V4L device uses chromakey on overlay\n");
  if (VID_TYPE_CLIPPING & s->capability.type)
    DBG (5, "sane_open: V4L device supports overlay clipping\n");
  if (VID_TYPE_FRAMERAM & s->capability.type)
    DBG (5, "sane_open: V4L device overwrites frame buffer memory\n");
  if (VID_TYPE_SCALES & s->capability.type)
    DBG (5, "sane_open: V4L device supports hardware scaling\n");
  if (VID_TYPE_MONOCHROME & s->capability.type)
    DBG (5, "sane_open: V4L device is grey scale only\n");
  if (VID_TYPE_SUBCAPTURE & s->capability.type)
    DBG (5, "sane_open: V4L device can capture parts of the image\n");

  if (s->capability.channels < max_channels)
    max_channels = s->capability.channels;
  for (i = 0; i < max_channels; i++)
    {
      channel.channel = i;
      if (-1 == v4l1_ioctl (v4lfd, VIDIOCGCHAN, &channel))
	{
	  DBG (1, "sane_open: can't ioctl VIDIOCGCHAN %s: %s\n", devname,
	       strerror (errno));
	  return SANE_STATUS_INVAL;
	}
      DBG (5, "sane_open: channel %d (%s), tuners=%d, flags=0x%x, "
	   "type=%d, norm=%d\n", channel.channel, channel.name,
	   channel.tuners, channel.flags, channel.type, channel.norm);
      if (VIDEO_VC_TUNER & channel.flags)
	DBG (5, "sane_open: channel has tuner(s)\n");
      if (VIDEO_VC_AUDIO & channel.flags)
	DBG (5, "sane_open: channel has audio\n");
      if (VIDEO_TYPE_TV == channel.type)
	DBG (5, "sane_open: input is TV input\n");
      if (VIDEO_TYPE_CAMERA == channel.type)
	DBG (5, "sane_open: input is camera input\n");
      s->channel[i] = strdup (channel.name);
      if (!s->channel[i])
	return SANE_STATUS_NO_MEM;
    }
  s->channel[i] = 0;
  if (-1 == v4l1_ioctl (v4lfd, VIDIOCGPICT, &s->pict))
    {
      DBG (1, "sane_open: can't ioctl VIDIOCGPICT %s: %s\n", devname,
	   strerror (errno));
      return SANE_STATUS_INVAL;
    }
  DBG (5, "sane_open: brightness=%d, hue=%d, colour=%d, contrast=%d\n",
       s->pict.brightness, s->pict.hue, s->pict.colour, s->pict.contrast);
  DBG (5, "sane_open: whiteness=%d, depth=%d, palette=%d\n",
       s->pict.whiteness, s->pict.depth, s->pict.palette);

  /* ??? */
  s->pict.palette = VIDEO_PALETTE_GREY;
  if (-1 == v4l1_ioctl (s->fd, VIDIOCSPICT, &s->pict))
    {
      DBG (1, "sane_open: ioctl VIDIOCSPICT failed (%s)\n", strerror (errno));
    }

  if (-1 == v4l1_ioctl (s->fd, VIDIOCGWIN, &s->window))
    {
      DBG (1, "sane_open: can't ioctl VIDIOCGWIN %s: %s\n", devname,
	   strerror (errno));
      return SANE_STATUS_INVAL;
    }
  DBG (5, "sane_open: x=%d, y=%d, width=%d, height=%d\n",
       s->window.x, s->window.y, s->window.width, s->window.height);

  /* already done in sane_start 
     if (-1 == v4l1_ioctl (v4lfd, VIDIOCGMBUF, &mbuf))
     DBG (1, "sane_open: can't ioctl VIDIOCGMBUF (no Fbuffer?)\n");
   */

  status = init_options (s);
  if (status != SANE_STATUS_GOOD)
    return status;
  update_parameters (s);

  /* insert newly opened handle into list of open handles: */
  s->next = first_handle;
  first_handle = s;

  *handle = s;

  return SANE_STATUS_GOOD;
}
Beispiel #20
0
void Reverb::set_damp(float p_damp) {

	params.damp=p_damp;
	update_parameters();

}
Beispiel #21
0
void Reverb::set_room_size(float p_size) {

	params.room_size=p_size;
	update_parameters();

}
Beispiel #22
0
void train_network_with_backprop(Network* network, Vector* training_point, Vector* teaching_point){
    Vector* network_output = compute_output_network(network, training_point);
//    printf("\t Network output: %.10lf\tTrue value: %lf\n", network_output->scalars[0], teaching_point->scalars[0]);
    update_parameters(network, teaching_point, network_output);
    delete_vec(network_output);
}
Beispiel #23
0
void Unison::set_base_frequency(REALTYPE freq) {
    base_freq = freq;
    update_parameters();
}
bool MapGridCostFunction::prepare(tf::Stamped<tf::Pose> global_pose,
                                  tf::Stamped<tf::Pose> global_vel,
                                  std::vector<geometry_msgs::Point> footprint_spec) {
    update_parameters();
    return true;
}