Esempio n. 1
0
DsdDecimator::DsdDecimator(DsdSampleReader *r, dsf2flac_uint32 rate)
{
	reader = r;
	outputSampleRate = rate;
	valid = true;;
	errorMsg = "";
	
	// ratio of out to in sampling rates
	ratio = r->getSamplingFreq() / outputSampleRate;
	// how many bytes to skip after each out sample calc.
	nStep = ratio/8; 
	
	// load the required filter into the lookuptable based on in and out sample rate
	if (ratio == 8)
		initLookupTable(nCoefs_352,coefs_352,tzero_352);
	else if (ratio == 16)
		initLookupTable(nCoefs_176,coefs_176,tzero_176);
	else if (ratio == 32)
		initLookupTable(nCoefs_88,coefs_88,tzero_88);
	else
	{
		valid = false;
		errorMsg = "Sorry, incompatible sample rate combination";
		return;
	}
	// set the buffer to the length of the table if not long enough
	if (nLookupTable > reader->getBufferLength())
		reader->setBufferLength(nLookupTable);
}
Esempio n. 2
0
	/***************************************************************
	 * initEntityTable:
	 ***************************************************************/
static int   initEntityTable(	/* Return: num entities defined		*/
    void  *entTop		/* <r> top of paramList or qualList	*/
   ,struct cmd_struct  **addrTable /* <m> top of entity "lookup" table	*/
   )
   {
    int   i;
    int   icnt;
    int   sts;
    struct cduEntity  *e;

    if (!entTop)
        return(0);

		/*=====================================================
		 * Check size of entLookup[] list ...
		 *====================================================*/
    icnt = initLookupTable(entTop,addrTable);

    e = entTop;
    for (i=1 ; i<=icnt ; i++,e++)
       {
        sts = init_value(e->entA_value);
        e->entL_status =
                (e->entL_flags & ENT_M_DEFAULTED) ? CLI_STS_DEFAULTED : sts;
       }
    return(icnt);
   }
Esempio n. 3
0
void gpuNUFFT::GpuNUFFTOperator::initDeviceMemory(int n_coils)
{
  if (gpuMemAllocated)
    return;

  gi_host = initAndCopyGpuNUFFTInfo();//

  int			data_count          = (int)this->kSpaceTraj.count();
  IndType imdata_count        = this->imgDims.count();
  int			sector_count        = (int)this->gridSectorDims.count();
    
  if (DEBUG)
    printf("allocate and copy data indices of size %d...\n",dataIndices.count());
  allocateAndCopyToDeviceMem<IndType>(&data_indices_d,dataIndices.data,dataIndices.count());
  
  if (DEBUG)
    printf("allocate and copy data of size %d...\n",data_count);
  allocateDeviceMem<DType2>(&data_sorted_d,data_count);
  
  if (DEBUG)
    printf("allocate and copy gdata of size %d...\n",gi_host->grid_width_dim);
  allocateDeviceMem<CufftType>(&gdata_d,gi_host->grid_width_dim);

  if (DEBUG)
    printf("allocate and copy coords of size %d...\n",getImageDimensionCount()*data_count);
  allocateAndCopyToDeviceMem<DType>(&crds_d,this->kSpaceTraj.data,getImageDimensionCount()*data_count);

  if (DEBUG)
    printf("allocate and copy kernel in const memory of size %d...\n",this->kernel.count());

  initLookupTable();

  //allocateAndCopyToDeviceMem<DType>(&kernel_d,kernel,kernel_count);
  if (DEBUG)
    printf("allocate and copy sectors of size %d...\n",sector_count+1);
  allocateAndCopyToDeviceMem<IndType>(&sectors_d,this->sectorDataCount.data,sector_count+1);

  if (DEBUG)
    printf("allocate and copy sector_centers of size %d...\n",getImageDimensionCount()*sector_count);
  allocateAndCopyToDeviceMem<IndType>(&sector_centers_d,(IndType*)this->getSectorCentersData(),getImageDimensionCount()*sector_count);

  if (this->applyDensComp())	
  {
    if (DEBUG)
      printf("allocate and copy density compensation of size %d...\n",data_count);
    allocateAndCopyToDeviceMem<DType>(&density_comp_d,this->dens.data,data_count);
  }

  if (this->applySensData())	
  {
    if (DEBUG)
      printf("allocate sens data of size %d...\n",imdata_count);
    allocateDeviceMem<DType2>(&sens_d,imdata_count);
  }
  
  if (n_coils > 1)
  {
    if (DEBUG)
      printf("allocate precompute deapofunction of size %d...\n",imdata_count);
    allocateDeviceMem<DType>(&deapo_d,imdata_count);
    precomputeDeapodization(deapo_d,gi_host);
  }
  if (DEBUG)
    printf("sector pad width: %d\n",gi_host->sector_pad_width);

  //Inverse fft plan and execution
  if (DEBUG)
    printf("creating cufft plan with %d,%d,%d dimensions\n",DEFAULT_VALUE(gi_host->gridDims.z),gi_host->gridDims.y,gi_host->gridDims.x);
  cufftResult res = cufftPlan3d(&fft_plan, (int)DEFAULT_VALUE(gi_host->gridDims.z),(int)gi_host->gridDims.y,(int)gi_host->gridDims.x, CufftTransformType) ;
  if (res != CUFFT_SUCCESS) 
    fprintf(stderr,"error on CUFFT Plan creation!!! %d\n",res);
  gpuMemAllocated = true;
}
Esempio n. 4
0
QualityQuantizer::QualityQuantizer(char const spec[])
{
    if (!initLookupTable(lookup, spec))
        clearLookupTable(lookup);
}