virtual void MakeResponse(const std::vector<EdgeWeight> &durations, const std::vector<PhantomNode> &phantoms, util::json::Object &response) const { auto number_of_sources = parameters.sources.size(); auto number_of_destinations = parameters.destinations.size(); ; // symmetric case if (parameters.sources.empty()) { response.values["sources"] = MakeWaypoints(phantoms); number_of_sources = phantoms.size(); } else { response.values["sources"] = MakeWaypoints(phantoms, parameters.sources); } if (parameters.destinations.empty()) { response.values["destinations"] = MakeWaypoints(phantoms); number_of_destinations = phantoms.size(); } else { response.values["destinations"] = MakeWaypoints(phantoms, parameters.destinations); } response.values["durations"] = MakeTable(durations, number_of_sources, number_of_destinations); response.values["code"] = "Ok"; }
void HarmTable::SetHarm(int harm, int type) { m_harm = harm; m_typew = type; MakeTable(); }
static void InitWindow(struct window *w) { GLint imgWidth, imgHeight; GLenum imgFormat; GLubyte *image = NULL; w->table_list = MakeTable(); MakeObjects(w->objects_list); image = LoadRGBImage( TABLE_TEXTURE, &imgWidth, &imgHeight, &imgFormat ); if (!image) { printf("Couldn't read %s\n", TABLE_TEXTURE); exit(0); } gluBuild2DMipmaps(GL_TEXTURE_2D, 3, imgWidth, imgHeight, imgFormat, GL_UNSIGNED_BYTE, image); free(image); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); glShadeModel( GL_FLAT ); glEnable( GL_LIGHT0 ); glEnable( GL_LIGHTING ); glClearColor( 0.5, 0.5, 0.9, 0.0 ); glEnable( GL_NORMALIZE ); }
UsrDefTable :: UsrDefTable() { m_L = 8; m_pvalues = 0; m_table = new float[m_L+1]; MakeTable(); }
HammingTable :: HammingTable(long L, double alpha){ m_L = L; m_alpha = alpha; m_table = new double [m_L+1]; MakeTable(); }
//////////construction / destruction /////////////////////// HammingTable :: HammingTable(){ m_L = 1024; m_alpha = .54f; m_table = new double[m_L+1]; MakeTable(); }
void SetViseme::PhonemeToViseme( vector<string> phoneme, vector<int> duration, int speakOffset ) { TRACE("SetViseme::PhonemeToViseme( vector<string> &phoneme, vector<int> &duration )"); m_viRstNo.clear(); m_viRstDur.clear(); int k = 0; //key-frame number // First step: 1ms の無音区間を生成 m_viRstNo.push_back(0); //m_viRstDur.push_back(int(1000.0 / 30) * 3 + 1); m_viRstDur.push_back(1 + speakOffset); #ifdef DEBUG_PHONEME_TO_VISEME fprintf(stderr, "Line No.00: --- First Silence --- ...Viseme No.00\t%d [ms]\n", m_viRstDur[0]); #endif k++; // VISEME No.とDulationの決定 全検索:要改善 unsigned int i, j; for( i = 0; i < phoneme.size(); i++ ) { for( j = 0; j < m_vsSrcName.size(); j++ ) { if( phoneme[i] == m_vsSrcName[j] ) { // 探索成功 m_viRstNo.push_back( m_viSrcNo[j] ); m_viRstDur.push_back( duration[i] ); #ifdef DEBUG_PHONEME_TO_VISEME fprintf( stderr, "Line No.%02d: [%s] ... Viseme No.%d:\t%d[ms]\n", i+1, phoneme[i].c_str(), m_viRstNo[k], m_viRstDur[k] ); #endif k++; break; } } if( j == m_vsSrcName.size() ) { // 探索失敗 m_viRstNo.push_back(0); m_viRstDur.push_back( duration[i] ); #ifdef DEBUG_PHONEME_TO_VISEME fprintf(stderr, "Line No.%02d : [%s] ... ?No Match? ... Viseme No.00\t%d[ms]\n", i+1, m_viRstNo[k], m_viRstDur[k]); #endif k++; } } // for Final Step: 1ms の無音区間を生成 m_viRstNo.push_back(0); m_viRstDur.push_back(1); #ifdef DEBUG_PHONEME_TO_VISEME fprintf(stderr, "Line No.%02d: --- Final Silence --- ...Viseme No.00\t%d [ms]\n", m_viRstDur.size() - 1, m_viRstDur[m_viRstDur.size() - 1]); #endif AddKeyFrame(); MakeTable(); }
void CMusikFX::ResetBands() { for ( int n = 0; n < 18; n++ ) { m_LeftBands[n] = 1.0f; m_RightBands[n] = 1.0f; } MakeTable( m_Frequency ); }
HarmTable :: HarmTable(){ m_L = 1024; m_harm = 1; m_typew = SINE; m_phase = 0.f; m_table = new float[m_L+1]; MakeTable(); }
void EnigmaCrypt::ClearFilter() { _Filter = 0; if (_SimpleDataset) { if (_Seed) MakeSimpleTable(_Seed); else MakeSimpleTable(); } else { if (_Seed) MakeTable(_Seed); else MakeTable(); } }
EnigmaCrypt::EnigmaCrypt(): _RandomizerType(LEHMER), _MaxEncChar(MAXENCCHAR), _Seed(0), _Filter(0), _SimpleDataset(0), _OneToOneEncode(1) { MakeTable(time(NULL)); }
void CMusikFX::InitEQ(float freq) { if(!m_bIsInitialized) { m_bIsInitialized = true; m_Frequency = freq; equ_init( 14 ); //--- no one knows why, 14 is the magic number ---// MakeTable( m_Frequency ); } }
void EnigmaCrypt::SetRandomizerType(int Type_) { _RandomizerType = Type_; if (_SimpleDataset) { if (_Seed) MakeSimpleTable(_Seed); else MakeSimpleTable(); } else { if (_Seed) MakeTable(_Seed); else MakeTable(); } }
void EnigmaCrypt::ClearFilter(int Attribs_) { _Filter &= ~Attribs_; if (_SimpleDataset) { if (_Seed) MakeSimpleTable(_Seed); else MakeSimpleTable(); } else { if (_Seed) MakeTable(_Seed); else MakeTable(); } }
HarmTable :: HarmTable(long L, int harm, int type, float phase){ m_L = L; m_harm = harm; m_typew = type; m_phase = (float)(phase*TWOPI); m_table = new float [m_L+1]; MakeTable(); }
void UsrDefTable::SetTable(long L, float* values) { if(m_L != L) { m_L = L; delete[] m_table; m_table = new float[m_L+1]; } m_pvalues = values; MakeTable(); }
UsrHarmTable :: UsrHarmTable(){ m_L = 1024; m_harm = 1; m_amp = new float[1]; m_amp[0] = 1.f; m_table = new float[m_L+1]; MakeTable(); }
void EnigmaCrypt::SetSimpleDataset(int Flag_) { _SimpleDataset = Flag_; _OneToOneEncode = !Flag_; if (_SimpleDataset) { if (_Seed) MakeSimpleTable(_Seed); else MakeSimpleTable(); } else { if (_Seed) MakeTable(_Seed); else MakeTable(); } }
NoteTable::NoteTable(){ m_L = 127; m_lowernote = 69; m_uppernote = 81; m_upperfreq = 880.f; m_lowerfreq = 440.f; m_table = new float[m_L+1]; MakeTable(); }
void CSampleBreakageObjects::InititialisePhysics() { neV3 gravity; gravity.Set(0.0f, -9.0f, 0.0f); neSimulatorSizeInfo sizeInfo; sizeInfo.rigidBodiesCount = NUMBER_OF_BODIES; sizeInfo.animatedBodiesCount = WALL_NUMBER; sizeInfo.geometriesCount = NUMBER_OF_BODIES + WALL_NUMBER; sizeInfo.overlappedPairsCount = MAX_OVERLAPPED_PAIR;//totalBody * (totalBody - 1) / 2; { //dont need any of these sizeInfo.rigidParticleCount = 0; sizeInfo.constraintsCount = 0; sizeInfo.terrainNodesStartCount = 0; } sim = neSimulator::CreateSimulator(sizeInfo, &all, &gravity); sim->SetBreakageCallback(BreakageCallbackFn); for (s32 i = 0; i < NUMBER_OF_BODIES; i++) { rigidBodies[i] = NULL; } neV3 position; position.SetZero(); for (s32 j = 0; j < NUMBER_OF_TABLES; j++) { position.Set(20.0f + 4.0f * j, 30.0f + 5.0f * j, 0.0f); MakeTable(position, j); } //SetUpRoom ground = sim->CreateAnimatedBody(); neGeometry * geom = ground->AddGeometry(); geom->SetBoxSize(gFloor.boxSize); ground->UpdateBoundingInfo(); ground->SetPos(gFloor.pos); groundRender.SetGraphicBox(gFloor.boxSize[0], gFloor.boxSize[1], gFloor.boxSize[2]); }
void UsrHarmTable::SetHarm(int harm, float* amps) { delete[] m_amp; m_harm = harm; m_amp = new float[harm]; for(int i = 0; i < harm; i++) m_amp[i] = amps[i]; MakeTable(); }
void CCoder::read_c_len() { int i, c, n; UInt32 mask; n = m_InBitStream.ReadBits(CBIT); if (n == 0) { c = m_InBitStream.ReadBits(CBIT); for (i = 0; i < NC; i++) c_len[i] = 0; for (i = 0; i < CTABLESIZE; i++) c_table[i] = c; } else { i = 0; while (i < n) { UInt32 bitBuf = m_InBitStream.GetValue(16); c = pt_table[bitBuf >> (8)]; if (c >= NT) { mask = 1 << (7); do { if (bitBuf & mask) c = right[c]; else c = left[c]; mask >>= 1; } while (c >= NT); } m_InBitStream.MovePos((int)(pt_len[c])); if (c <= 2) { if (c == 0) c = 1; else if (c == 1) c = m_InBitStream.ReadBits(4) + 3; else c = m_InBitStream.ReadBits(CBIT) + 20; while (--c >= 0) c_len[i++] = 0; } else c_len[i++] = (Byte)(c - 2); } while (i < NC) c_len[i++] = 0; MakeTable(NC, c_len, 12, c_table, CTABLESIZE); }
void CParameter::InitCellMapTable(const ERobMode eNewWaveMode, const ESpecOcc eNewSpecOcc) { /* Set new values and make table */ eRobustnessMode = eNewWaveMode; eSpectOccup = eNewSpecOcc; MakeTable(eRobustnessMode, eSpectOccup); // Should be done but is no good for simulation, TODO ///* Set init flags */ //DRMReceiver.InitsForAllModules(); }
UsrHarmTable :: UsrHarmTable(long L, int harm, float* amps){ m_L = L; m_harm = harm; m_amp = new float[harm]; for(int i = 0; i < harm; i++) m_amp[i] = amps[i]; m_table = new float [m_L+1]; MakeTable(); }
NoteTable::NoteTable(short lowernote, short uppernote, float lowerfreq, float upperfreq){ m_L = 127; m_lowernote = lowernote; m_uppernote = uppernote; m_lowerfreq = lowerfreq; m_upperfreq = upperfreq; m_table = new float[m_L+1]; MakeTable(); }
EnigmaCrypt::EnigmaCrypt(unsigned seed, int Attribs_): _RandomizerType(LEHMER), _MaxEncChar(MAXENCCHAR), _Seed(0), _Filter(Attribs_), _SimpleDataset(Attribs_ == SIMPLE), _OneToOneEncode(Attribs_ != SIMPLE) { if (_SimpleDataset) { if (seed) MakeSimpleTable(seed); else MakeSimpleTable(); } else { if (seed) MakeTable(seed); else MakeTable(); } }
void EnigmaCrypt::SetOneToOneEncode(int Flag_) { int TurnOff_ = _OneToOneEncode == 1 && !Flag_; _OneToOneEncode = Flag_; if (TurnOff_) { if (_SimpleDataset) { if (_Seed) MakeSimpleTable(_Seed); else MakeSimpleTable(); } else { if (_Seed) MakeTable(_Seed); else MakeTable(); } } }
void CParameter::SetSpectrumOccup(ESpecOcc eNewSpecOcc) { /* Apply changes only if new paramter differs from old one */ if (eSpectOccup != eNewSpecOcc) { /* Set new value */ eSpectOccup = eNewSpecOcc; /* This parameter change provokes update of table */ MakeTable(eRobustnessMode, eSpectOccup); /* Set init flags */ DRMReceiver.InitsForSpectrumOccup(); } }
int InicGen2D(float func(int,int),int TimeSize,int FreqSize,int Srand) { /* Inicjacja generatora liczb z 2D rozkladu p-stwa func(x,y) */ register int i,j; float sum,norma=0.0F; if((DystMatrix=MakeTable(TimeSize,FreqSize))==NULL) return -1; if((DystVector=(float *)malloc(TimeSize*sizeof(float)))==NULL) { FreeTable(DystMatrix,TimeSize); DystMatrix=NULL; return -1; } if(Srand==0) SRAND(0U); else SRAND((unsigned short)time(NULL)); GlobTimeSize=TimeSize; GlobFreqSize=FreqSize; for(i=0 ; i<TimeSize ; i++) /* Generacja rozkladu p-stwa + normalizacja */ for(j=0 ; j<FreqSize ; j++) { const float ftmp=func(i,j); /* Wartosci ujemne nie maja interpretacji */ norma+=DystMatrix[i][j]=((ftmp<0.0F) ? 1.0F : ftmp); } for(i=0,sum=0.0F ; i<FreqSize ; i++) /* Dystrybuanta brzegowa */ sum+=DystMatrix[0][i]; DystVector[0]=sum/norma; for(i=1 ; i<TimeSize ; i++) { for(j=0,sum=0.0F ; j<FreqSize ; j++) sum+=DystMatrix[i][j]; DystVector[i]=DystVector[i-1]+sum/norma; } for(i=0 ; i<TimeSize ; i++) /* Dystrybuanty warunkowe */ { for(j=0,sum=0.0F ; j<FreqSize ; j++) sum+=DystMatrix[i][j]; DystMatrix[i][0]/=sum; for(j=1 ; j<FreqSize ; j++) DystMatrix[i][j]=DystMatrix[i][j-1]+DystMatrix[i][j]/sum; } return 0; }
void CSymbInterleaver::InitInternal(CParameter& TransmParam) { int i; /* Set internal parameters */ iN_MUX = TransmParam.iNumUsefMSCCellsPerFrame; /* Allocate memory for table */ veciIntTable.Init(iN_MUX); /* Make interleaver table */ MakeTable(veciIntTable, iN_MUX, SYMB_INTERL_CONST_T_0); /* Set interleaver depth */ switch (TransmParam.eSymbolInterlMode) { case CParameter::SI_LONG: iD = D_LENGTH_LONG_INTERL; break; case CParameter::SI_SHORT: iD = D_LENGTH_SHORT_INTERL; break; } /* Always allocate memory for long interleaver case (interleaver memory) */ matcInterlMemory.Init(D_LENGTH_LONG_INTERL, iN_MUX); /* Index for addressing the buffers */ veciCurIndex.Init(D_LENGTH_LONG_INTERL); for (i = 0; i < D_LENGTH_LONG_INTERL; i++) veciCurIndex[i] = i; /* Define block-sizes for input and output */ iInputBlockSize = iN_MUX; iOutputBlockSize = iN_MUX; /* Since the MSC logical frames must not end at the end of one symbol (could be somewhere in the middle of the symbol), the output buffer must accept more cells than one logical MSC frame is long */ iMaxOutputBlockSize = 2 * iN_MUX; }