示例#1
0
/* HTS_ModelSet_load_gv: load GV model */
void HTS_ModelSet_load_gv(HTS_ModelSet * ms, FILE ** pdf_fp, FILE ** tree_fp,
                          int stream_index, int interpolation_size)
{
   int i;

   /* check */
   if (pdf_fp == NULL)
      HTS_error(1,
                "HTS_ModelSet_load_gv: File for GV pdfs is not specified.\n");
   /* initialize */
   if (!ms->gv) {
      ms->gv = (HTS_Stream *) HTS_calloc(ms->nstream, sizeof(HTS_Stream));
      for (i = 0; i < ms->nstream; i++)
         HTS_Stream_initialize(&ms->gv[i]);
   }
   if (tree_fp)
      HTS_Stream_load_pdf_and_tree(&ms->gv[stream_index], pdf_fp, tree_fp,
                                   FALSE, interpolation_size);
   else
      HTS_Stream_load_pdf(&ms->gv[stream_index], pdf_fp, 1, FALSE,
                          interpolation_size);
}
示例#2
0
/* HTS_ModelSet_load_gv: load GV model */
HTS_Boolean HTS_ModelSet_load_gv(HTS_ModelSet * ms, HTS_File ** pdf_fp, HTS_File ** tree_fp, int stream_index, int interpolation_size)
{
   int i;

   /* check */
   if (ms == NULL) {
      return FALSE;
   }
   if (stream_index < 0 || stream_index >= ms->nstream || interpolation_size <= 0) {
      HTS_ModelSet_clear(ms);
      return FALSE;
   }
   if (pdf_fp == NULL) {
      HTS_error(1, "HTS_ModelSet_load_gv: File for GV pdfs is not specified.\n");
      HTS_ModelSet_clear(ms);
      return FALSE;
   }
   /* initialize */
   if (!ms->gv) {
      ms->gv = (HTS_Stream *) HTS_calloc(ms->nstream, sizeof(HTS_Stream));
      for (i = 0; i < ms->nstream; i++)
         HTS_Stream_initialize(&ms->gv[i]);
   }
   if (tree_fp) {
      if (HTS_Stream_load_pdf_and_tree(&ms->gv[stream_index], pdf_fp, tree_fp, interpolation_size) == FALSE) {
         HTS_ModelSet_clear(ms);
         return FALSE;
      }
   } else {
      if (HTS_Stream_load_pdf(&ms->gv[stream_index], pdf_fp, 1, interpolation_size) == FALSE) {
         HTS_ModelSet_clear(ms);
         return FALSE;
      }
   }

   return TRUE;
}