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

📄 gauss_main.cpp

📁 Intel开发的IPP库的应用实例
💻 CPP
📖 第 1 页 / 共 2 页
字号:
   dec->Close_Decoder();
   dec->Get_Statistics(&stat_dec);
   cache->Get_Statistics(&stat_cache);
   delete dec;
   delete cache;
   delete calc;
   delete feat;

   printf("Feature type                        %s\n", (featfile[0]==0)?"    fake":
                                                                       "     HTK");
   printf("\n");
   printf("Calculation type                    %s\n", (hint==calcNone)?"    none":
                                                      (hint==calcVect)?"    vector":
                                                      (hint==calcVecM)?"    vecmax":
                                                      (hint==calcMix) ?"    mixture":
                                                      (hint==calcMMix)?"    multimix vector":
                                                      (hint==calcVectLow)?"  vector low":
                                                      (hint==calcVecMLow)?"  vecmax low":
                                                      (hint==calcMixLow) ?" mixture low":
                                                      (hint==calcMMixLow)?"   multimix low":
                                                                       " unknown");
   printf("Active states per frame               %6i\n",avrmix);
   printf("Max activity interval                 %6i\n",actlen);
   printf("Cache size                            %6i\n",cachelen);
   printf("Probability vector length             %6i\n",veclen);
   printf("\n");

   printf("Model type                          %s\n", (model==0)      ?"    fake":
                                                      (model==1)      ?"    file":
                                                                       " unknown");
   printf("States                                %6i\n",mixnum);
   printf("Gaussians per mixture                 %6i\n",gaussnum);
   printf("Observation vector length             %6i\n",dimension);

   printf("\n");
   printf("Decoder statistics\n");
   printf("Frames                                %6i\n",framenum);
   if (delay<=0)
   printf("Delay                                   full\n");
   else
   printf("Delay                                 %6i\n",delay);
   printf("Active states per frame             %8.2f\n",((float)stat_dec.all)/framenum);
   printf("Requested probabilities per frame   %8.2f\n",((float)(stat_dec.all+stat_dec.lost))/framenum);
   for (avl=num=t=0; t<stat_dec.len; t++) {
      avl+=(t+1)*stat_dec.nums[t];
      num+=stat_dec.nums[t];
   }
   printf("Average state activity interval     %8.2f\n",((float)avl)/num);
   printf("\n\nCache statistics\n");
   printf("Calculated mixtures per frame       %8.2f\n",((float)stat_cache.all)/framenum);
   printf("Wasted mixtures per frame           %8.2f  %6.2f%%\n",
      ((float)stat_cache.lost)/framenum,((float)stat_cache.lost)/stat_cache.all*100);
   for (avl=num=t=0; t<stat_cache.len; t++) {
      avl+=(t+1)*stat_cache.nums[t];
      num+=stat_cache.nums[t];
   }
   printf("Average probability vector length   %8.2f\n",((float)avl)/num);

   printf("\n");
   printf("Frequency                           %8.2f MHz\n",freq);
   printf("Speech time                         %8.2f sec\n", speech_sec);
   printf("Decoding time                       %8.2f sec\n", sec_time/freq);
   printf("Speed                               %8.2f MHz %6.2f RT\n",
      sec_time/speech_sec,sec_time/speech_sec/freq);
   printf("\n");
   printf("\n");

   free(stat_cache.nums);
   free(stat_dec.nums);

   return "OK\n";
}



int main(int argc, char* argv[]) {

   ParseCommLine (argc-1, argv+1);  // get frequency, default - 500

   char *HMM_36f="../data/hmm_36.param";
   char *HMM_39f="../data/hmm_39.param";
   char *HMM_36="../data/hmm_36.param_16s";
   char *HMM_39="../data/hmm_39.param_16s";
   char *MFC_13="../data/feature_13.mfc";
   char *PRO_36="../data/prob_36_s.log";
   char *PRO_39="../data/prob_39_s.log";
   char *MFC_36="../data/feature_36.mfc";
   char *MFC_39="../data/feature_39.mfc";

   num_err=0;

   switch(TypeTest){

       case 1:
// arguments                    ( hint   ,paramf, featf,mixnum,gaussn,dimens,calcmx,calcmn,framen, delay,cachel,veclen,actlen,avrmix,problog,featlog,meanFact,varFact)
printf("\n verification of vector calculation\n");
printf("%s\n",Fake_Decoder_Test (calcVect,HMM_36f,MFC_13,     6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,  1000,"../data/prob_36.log","",meanSc, varSc,probSc));
       break;
       case 2:
printf("\n verification of mixture calculation\n");
printf("%s\n",Fake_Decoder_Test (calcMix,HMM_36f,MFC_13,     6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,  1000,"../data/prob_36.log","",meanSc, varSc,probSc));
       break;
       case 3:
printf("\n verification of multimix vector calculation\n");
printf("%s\n",Fake_Decoder_Test (calcMMix,HMM_36f,MFC_13,     6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,  1000,"../data/prob_36.log","",meanSc, varSc,probSc));
       break;
       case 4:
printf("\n verification of vecmax calculation\n");
printf("%s\n",Fake_Decoder_Test (calcVecM,HMM_36f,MFC_13,     6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,  1000,"../data/prob_36.log","",meanSc, varSc,probSc));
       break;
       case 5:
printf("\n verification of vector low calculation\n");
printf("%s\n",Fake_Decoder_Test (calcVectLow,HMM_36f,MFC_13,     6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,  1000,"../data/prob_36.log","",meanSc-4, varSc-4,probSc));
       break;
       case 6:
printf("\n verification of mixture low calculation\n");
printf("%s\n",Fake_Decoder_Test (calcMixLow,HMM_36f,MFC_13,     6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,  1000,"../data/prob_36.log","",meanSc-4, varSc-4,probSc));
       break;
       case 7:
printf("\n verification of multimix vector low calculation\n");
printf("%s\n",Fake_Decoder_Test (calcMMixLow,HMM_36f,MFC_13,     6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,  1000,"../data/prob_36.log","",meanSc-4, varSc-4,probSc));
       break;
       case 8:
printf("\n verification of vecmax low calculation\n");
printf("%s\n",Fake_Decoder_Test (calcVecMLow,HMM_36f,MFC_13,     6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,  1000,"../data/prob_36.log","",meanSc-4, varSc-4,probSc));
       break;
       case 0:
// test vector calculation with different vector length
printf("%s\n",Fake_Decoder_Test (calcVect,    "",    "",  6000,    24,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,    "",    "",  6000,    12,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,    "",    "",  6000,     4,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,    "",    "",  6000,     1,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
// test mixture calculation with different vector length
printf("%s\n",Fake_Decoder_Test (calcMix ,    "",    "",  6000,    24,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcMix ,    "",    "",  6000,    12,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcMix ,    "",    "",  6000,     4,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcMix ,    "",    "",  6000,     1,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
// test multimix vector calculation with different vector length
printf("%s\n",Fake_Decoder_Test (calcMMix ,    "",    "",  6000,    24,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcMMix ,    "",    "",  6000,    12,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcMMix ,    "",    "",  6000,     4,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcMMix ,    "",    "",  6000,     1,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
// test vecmax calculation with different vector length
printf("%s\n",Fake_Decoder_Test (calcVecM ,    "",    "",  6000,    24,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVecM ,    "",    "",  6000,    12,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVecM ,    "",    "",  6000,     4,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVecM ,    "",    "",  6000,     1,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));

// test vector low calculation with different vector length
printf("%s\n",Fake_Decoder_Test (calcVectLow ,    "",    "",  6000,    24,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVectLow ,    "",    "",  6000,    12,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVectLow ,    "",    "",  6000,     4,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVectLow ,    "",    "",  6000,     1,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
// test calcMixLow calculation with different vector length
printf("%s\n",Fake_Decoder_Test (calcMixLow ,    "",    "",  6000,    24,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcMixLow ,    "",    "",  6000,    12,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcMixLow ,    "",    "",  6000,     4,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcMixLow ,    "",    "",  6000,     1,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
// test multimix vector Low calculation with different vector length
printf("%s\n",Fake_Decoder_Test (calcMMixLow ,    "",    "",  6000,    24,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcMMixLow ,    "",    "",  6000,    12,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcMMixLow ,    "",    "",  6000,     4,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcMMixLow ,    "",    "",  6000,     1,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
// test vecmax low calculation with different vector length
printf("%s\n",Fake_Decoder_Test (calcVecMLow ,    "",    "",  6000,    24,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVecMLow ,    "",    "",  6000,    12,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVecMLow ,    "",    "",  6000,     4,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVecMLow ,    "",    "",  6000,     1,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
// test fake calculation with different vector length
printf("%s\n",Fake_Decoder_Test (calcNone,    "",    "",  6000,    24,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcNone,    "",    "",  6000,    12,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcNone,    "",    "",  6000,     4,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcNone,    "",    "",  6000,     1,    36,   100,    12,   455,    20,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
// test different models and feature files
printf("%s\n",Fake_Decoder_Test (calcNone,HMM_36f, MFC_13, 6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,HMM_36f, MFC_13, 6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcNone,HMM_36f, MFC_13, 6000,     4,    36,   100,    12,   455,     0,  1000,     1,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,HMM_36f, MFC_13, 6000,     4,    36,   100,    12,   455,     0,  1000,     1,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcNone,HMM_39f, MFC_13, 6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,  1500,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,HMM_39f, MFC_13, 6000,     4,    39,   100,    12,   455,     0,  1000,    12,    40,  1500,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcNone,HMM_39f, MFC_13, 6000,     4,    39,   100,    12,   455,     0,  1000,     1,    40,  1500,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,HMM_39f, MFC_13, 6000,     4,    39,   100,    12,   455,     0,  1000,     1,    40,  1500,    "",    "",meanSc, varSc,probSc));
// test delta calculation and energy cutting
printf("%s\n",Fake_Decoder_Test (calcVect,    "", MFC_13, 6000,    12,    36,   100,    12,   455,     0,  1000,    12,    40,  1500,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,    "", MFC_13, 6000,    12,    24,   100,    12,   455,     0,  1000,    12,    40,  1500,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,    "", MFC_13, 6000,    12,    12,   100,    12,   455,     0,  1000,    12,    40,  1500,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,    "", MFC_13, 6000,    12,    39,   100,    12,   455,     0,  1000,    12,    40,  1500,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,    "", MFC_13, 6000,    12,    26,   100,    12,   455,     0,  1000,    12,    40,  1500,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,    "", MFC_13, 6000,    12,    13,   100,    12,   455,     0,  1000,    12,    40,  1500,    "",    "",meanSc, varSc,probSc));
 // test different active state number
printf("%s\n",Fake_Decoder_Test (calcVect,HMM_36f, MFC_13, 6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,  2000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,HMM_36f, MFC_13, 6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,  1500,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,HMM_36f, MFC_13, 6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,HMM_36f, MFC_13, 6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,   500,    "",    "",meanSc, varSc,probSc));
// test different state activity intervals
printf("%s\n",Fake_Decoder_Test (calcVect,HMM_36f, MFC_13, 6000,     4,    36,   100,    12,   455,     0,  1000,    12,   100,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,HMM_36f, MFC_13, 6000,     4,    36,   100,    12,   455,     0,  1000,    12,    40,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,HMM_36f, MFC_13, 6000,     4,    36,   100,    12,   455,     0,  1000,    12,    10,  1000,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,HMM_36f, MFC_13, 6000,     4,    36,   100,    12,   455,     0,  1000,    12,     2,  1000,    "",    "",meanSc, varSc,probSc));
// test different state number
printf("%s\n",Fake_Decoder_Test (calcVect,    "",    "",  6000,    12,    39,   100,    12,   455,     0,  1000,    12,   100,   500,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,    "",    "",  3000,    12,    39,   100,    12,   455,     0,  1000,    12,   100,   500,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,    "",    "",  1000,    12,    39,   100,    12,   455,     0,  1000,    12,   100,   500,    "",    "",meanSc, varSc,probSc));
printf("%s\n",Fake_Decoder_Test (calcVect,    "",    "",   500,    12,    39,   100,    12,   455,     0,  1000,    12,   100,   500,    "",    "",meanSc, varSc,probSc));
       break;
       default:
           printf("Algorithm isn't define");
       break;
   }


   if(num_err>0){
       printf("\n There were an %d errors during this run. See output above. \n",num_err);
   }
   return 0;
}

⌨️ 快捷键说明

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