⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ssrch_09.cc

📁 这是一个从音频信号里提取特征参量的程序
💻 CC
字号:
// file: $isip/class/search/StackSearch/ssrch_09.cc// version: $Id: ssrch_09.cc,v 1.3 2002/08/02 02:07:17 jelinek Exp $//// isip include files//#include "StackSearch.h"// method: initializeLinearDecoder//// arguments: none//// return: logical error status//// initialize the lists, etc. needed to begin searching//boolean StackSearch::initializeLinearDecoder() {  // make sure that we have at least one level defined  //  if (getNumLevels() < 1) {    return Error::handle(name(), 			 L"initializeLinearDecoder - read models first",			 StackSearch::ERR_LEVELS_NOT_LOADED,			 __FILE__, __LINE__);  }    // set the current frame  //  current_frame_d = 0;   // clear the valid_hyps_d list  //  clearTraceStorage();    // clear the trace lists of all the search nodes  //  clearSearchNodesTraceLists();  // generate all initial right context traces  //  generateInitialTraces();    // exit gracefully  //  return true;}// method: generateInitialTraces//// arguments: none//// return: logical error status//// generate one trace for each right context at the top level//boolean StackSearch::generateInitialTraces() {  // get the position of the central item in the context  //  long central_pos = search_levels_d(0).getRightContext() + 1;  // get the total context length  //  long total_context_length = search_levels_d(0).getLeftContext()                                                          + central_pos;    // initialize the left context  //  Context left_context(total_context_length, central_pos);  for (long i = 0; i < central_pos; i++) {    left_context.assignAndAdvance(                   (ulong)search_levels_d(0).getSubGraph(0).getStart()		   );  }  // output the debugging information  //  if (debug_level_d >= Integral::ALL) {    left_context.print();  }    // generate all possible right contexts by extending left context to  // the depth of the right context  //  DoubleLinkedList<Context> right_context_list(DstrBase::USER);  generateRightContexts(right_context_list, left_context,			search_levels_d(0).getRightContext());    // generate trace for each of above generated right contexts  //  for (boolean more_items = right_context_list.gotoFirst();       more_items; more_items = right_context_list.gotoNext()) {        // seed the top trace list with the start node of the search graph    //    Trace* tmp_trace = new Trace();    tmp_trace ->setFrame((ulong)current_frame_d);    tmp_trace->setBackPointer((Trace*)NULL);    tmp_trace->getHistory()->push(right_context_list.getCurr());        // add the start trace to the list    //    trace_lists_d(0).insertLast(tmp_trace);        // output the debugging information    //    if (debug_level_d >= Integral::ALL) {      String out;      out.concat(L"initial trace: ");      out.concat(tmp_trace);      Console::put(out);      printNewPath(tmp_trace, (Trace*)NULL);    }  }      // clear the list of generated right contexts, since it is not needed  //  right_context_list.setAllocationMode(DstrBase::SYSTEM);  right_context_list.clear();  // exit gracefully  //  return true;}// method: initSizes//// arguments://  long total_num_frames: (input) total number of frames to decode//// return: logical error status//// set the features, initialize stacks and maximal stack scores//boolean StackSearch::initSizes(long total_num_frames_a) {  if (total_num_frames_a > MAX_NUM_FRAMES) {    return Error::handle(name(), L"initSizes - too long file to decode",			 Error::ARG, __FILE__, __LINE__);  }  // allocate and initialize maximal scores for each stack  //  for (long i = 0; i <= total_num_frames_a; i++) {    max_stack_scores_d(i) = Trace::INACTIVE_SCORE;  }  // check whether the search levels are loaded  //  if (getNumLevels() < 1) {    return Error::handle(name(), 			 L"setFeatures - read models first",			 StackSearch::ERR_LEVELS_NOT_LOADED,			 __FILE__, __LINE__);  }    // check whether the statistical models are loaded  //  long stat_models_dim =    search_levels_d(DEF_NUM_LEVELS - 1).getStatisticalModels().length();  if (stat_models_dim == 0) {    return Error::handle(name(),			 L"setFeatures - read models first",			 StackSearch::ERR_LEVELS_NOT_LOADED,			 __FILE__, __LINE__);  }  stat_model_scores_d.setDimensions(MAX_NUM_FRAMES, stat_models_dim);    // initialize maximal trace scores at each frame for all levels and  // statistical model scores for each frame and each statistical  // model  //  for (long i = 0; i < total_num_frames_a; i++) {    for (long j = 0; j < getNumLevels(); j++) {      max_frame_scores_d.setValue(i, j, Trace::INACTIVE_SCORE);    }    for (long j = 0; j < stat_models_dim; j++) {      stat_model_scores_d.setValue(i, j, Trace::INACTIVE_SCORE);    }  }    // exit gracefully  //  return true;}  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -