Exemplo n.º 1
0
void    ZoomAnimation::OnAnimate( const unsigned long delta )
{
    if( getPause() )
        return;

    Animation::OnAnimate( delta );

    // zoom계산.
    m_curZoom = getCurrentFrame() * (m_maxZoom - m_minZoom) / getMaxFrames() + m_minZoom;
}
Exemplo n.º 2
0
void VSCache::adjustSize(bool needMemory) {
    if (!fixedSize) {
        if (!needMemory) {
            switch (recommendSize()) {
            case VSCache::caClear:
                clear();
                break;
            case VSCache::caGrow:
                setMaxFrames(getMaxFrames() + 2);
                break;
            case VSCache::caShrink:
                setMaxFrames(std::max(getMaxFrames() - 1, 1));
                break;
            default:;
            }
        } else {
            switch (recommendSize()) {
            case VSCache::caClear:
                clear();
                break;
            case VSCache::caShrink:
                if (getMaxFrames() <= 2)
                    clear();
                setMaxFrames(std::max(getMaxFrames() - 2, 1));
                break;
            case VSCache::caNoChange:
                if (getMaxFrames() <= 1)
                    clear();
                setMaxFrames(std::max(getMaxFrames() - 1, 1));
                break;
            default:;
            }
        }
    }
}
Exemplo n.º 3
0
void BkgFitterTracker::ThreadedInitialization (
    RawWells &rawWells, 
    const CommandLineOpts &inception_state, 
    const ComplexMask &a_complex_mask, 
    const char *results_folder,
    const ImageSpecClass &my_image_spec, 
    const std::vector<float> &smooth_t0_est, 
    std::vector<Region> &regions,
		const std::vector<RegionTiming> &region_timing,
    const SeqListClass &my_keys,
    bool restart,
    int num_flow_blocks )
{
  int totalRegions = regions.size();
  // a debugging file if needed
  int max_frames = getMaxFrames(my_image_spec, region_timing);

  global_defaults.signal_process_control.set_max_frames(max_frames);
  if (inception_state.bkg_control.pest_control.bkg_debug_files) { 
    all_params_hdf.Init(  inception_state.sys_context.results_folder,
                          inception_state.loc_context,  
                          my_image_spec, inception_state.flow_context.GetNumFlows(),
                          inception_state.bkg_control.pest_control.bkgModelHdf5Debug, max_frames,
                          inception_state.bkg_control.signal_chunks.flow_block_sequence.MaxFlowsInAnyFlowBlock(), 
                          num_flow_blocks
                       );
  }
  
  // designate a set of reads that will be processed regardless of whether they pass filters
  set<int> randomLibSet;
  MaskSample<int> randomLib (*a_complex_mask.my_mask, MaskLib, inception_state.bkg_control.unfiltered_library_random_sample);
  randomLibSet.insert (randomLib.Sample().begin(), randomLib.Sample().end());

  InitCacheMath();
    
  if (inception_state.bkg_control.pest_control.bkg_debug_files)
    TrivialDebugGaussExp(inception_state.sys_context.analysisLocation, regions,region_timing);

  ImageInitBkgWorkInfo *linfo = new ImageInitBkgWorkInfo[numFitters];
  for (int r = 0; r < numFitters; r++)
  {
    // load up the entire image, and do standard image processing (maybe all this 'standard' stuff could be on one call?)
    linfo[r].type = imageInitBkgModel;
    linfo[r].r = r;
    // data holders and fitters
    linfo[r].signal_proc_fitters = &signal_proc_fitters[0];
    linfo[r].sliced_chip = &sliced_chip[0];
    linfo[r].sliced_chip_extras = &sliced_chip_extras[0];
    linfo[r].emptyTraceTracker = all_emptytrace_track;

    // context same for all regions 
    linfo[r].inception_state = &inception_state;  // why do global variables plague me so
    linfo[r].rows = my_image_spec.rows;
    linfo[r].cols = my_image_spec.cols;
    linfo[r].maxFrames = inception_state.img_control.maxFrames;
    linfo[r].uncompFrames = my_image_spec.uncompFrames;
    linfo[r].timestamps = my_image_spec.timestamps;
    
    linfo[r].nokey = inception_state.bkg_control.nokey;
    linfo[r].seqList = my_keys.seqList;
    linfo[r].numSeqListItems= my_keys.numSeqListItems;

    // global state across chip
    linfo[r].maskPtr = a_complex_mask.my_mask;
    linfo[r].pinnedInFlow = a_complex_mask.pinnedInFlow;
    linfo[r].global_defaults = &global_defaults;
    linfo[r].washout_flow = &washout_flow[0];
    // prequel data
    linfo[r].regions = &regions[0];
    linfo[r].numRegions = (int)totalRegions;
    //linfo[r].kic = keyIncorporation;
    linfo[r].t_mid_nuc = region_timing[r].t_mid_nuc;
    linfo[r].t0_frame = region_timing[r].t0_frame;
    linfo[r].t_sigma = region_timing[r].t_sigma;
    linfo[r].sep_t0_estimate = &smooth_t0_est;
    
    // fix tauB,tauE passing later
    linfo[r].math_poiss = &poiss_cache;
    linfo[r].sample = &randomLibSet;

    // i/o state
    linfo[r].results_folder = results_folder;
    linfo[r].rawWells = &rawWells;

    if (inception_state.bkg_control.pest_control.bkgModelHdf5Debug)
    {
      linfo[r].ptrs = &all_params_hdf.ptrs;
    }
    else
    {
      linfo[r].ptrs = NULL;
    }
    linfo[r].restart = restart;


    // now put me on the queue
    analysis_queue.item.finished = false;
    analysis_queue.item.private_data = (void *) &linfo[r];
    analysis_queue.GetCpuQueue()->PutItem (analysis_queue.item);

  }
  // wait for all of the images to be loaded and initially processed
  analysis_queue.GetCpuQueue()->WaitTillDone();

  delete[] linfo;

  // set up for flow-by-flow fitting
  bkinfo = new BkgModelWorkInfo[numFitters];
  for (int r = 0; r < numFitters; r++)
    bkinfo[r].polyclonal_filter_opts = inception_state.bkg_control.polyclonal_filter;

}
Exemplo n.º 4
0
/**
 * Initialize the channel structure.
 *
 * Description:\n
 * 	This is called exactly once by the parent activity the first time
 * 	the activity is used.
 * 	A channel is encapsulated inside an activity, so it is created when
 *	the activity is created at startup.  The data buffers (input, cw, cd
 *  and baseline) are created by a subsequent init call by the parent
 * 	activity.  The buffers are allocated for the maximum activity length
 * 	specified at startup and are retained by the channel throughout the
 * 	execution of the program.
 */
void
Channel::init()
{
	// if we've already done initialization, nothing to do
	if (initialized)
		return;

	args = Args::getInstance();
	Assert(args);
	msgList = MsgList::getInstance();
	Assert(msgList);
	partitionSet = PartitionSet::getInstance();
	Assert(partitionSet);
	pktList = ChannelPacketList::getInstance(CHANNEL_PACKETS);
	Assert(pktList);
//	state = State::getInstance();
//	Assert(state);
	workQ = WorkQ::getInstance();
	Assert(workQ);

#ifdef notdef
	// set the parent activity
	activity = parent_;

	swap = args->swapInputs();
#endif

	// allocate all buffers except the detection buffer, which is shared
	// between activities

	// set up the DFB
	if (args->useCustomFilter()) {
		const FilterSpec& filter = args->getFilter();
		dfb.setCoeff(filter.coeff, filter.fftLen, filter.foldings);
	}
	dfb.setup(getTotalSubchannels(),
			getTotalSubchannels() * getSubchannelOversampling(),
			getFoldings(), getSamplesPerSubchannelHalfFrame());
	dfb.getInfo(&dfbInfo);

#ifdef notdef
	// allocate the input buffers
	size_t size = BUF_COUNT * dfbInfo.fftLen * dfbInfo.samplesPerChan;
	left = new InputBuffer(size, sizeof(ComplexInt16));
	if (!left)
		Fatal(ERR_MAF);
	right = new InputBuffer(size, sizeof(ComplexInt16));
	if (!right)
		Fatal(ERR_MAF);
#endif
	// allocate the cd buffers for the channel
	size_t size = getCdSamplesPerSubchannelHalfFrame() * state->getCdBytesPerSample()
			* getUsableSubchannels() * getMaxHalfFrames();
	cdBuf = new BufPair("cdBuf", size, false, NULL);
	if (!cdBuf)
		Fatal(ERR_NBA);

	// allocate the cw buffers for the channel
	size = getCwBytesPerSpectrum(RES_1HZ) * getSpectraPerFrame(RES_1HZ)
			* getMaxFrames();
	cwBuf = new BufPair("cwBuf", size, false, NULL);
	if (!cwBuf)
		Fatal(ERR_NBA);

	// allocate the baseline buffers
	size = getBlBytesPerHalfFrame();
	blBuf = new BufPair("blBuf", size, true, NULL);
	if (!blBuf)
		Fatal(ERR_NBA);
	newBlBuf = new BufPair("newBlBuf", size, true, NULL);
	if (!newBlBuf)
		Fatal(ERR_NBA);
	initialized = true;
}