[Julius-cvs 776] CVS update: julius4/libsent/src/hmminfo

Back to archive index

sumom****@users***** sumom****@users*****
2012年 8月 5日 (日) 10:26:54 JST


Index: julius4/libsent/src/hmminfo/read_binhmm.c
diff -u julius4/libsent/src/hmminfo/read_binhmm.c:1.8 julius4/libsent/src/hmminfo/read_binhmm.c:1.9
--- julius4/libsent/src/hmminfo/read_binhmm.c:1.8	Fri Jul 27 17:44:50 2012
+++ julius4/libsent/src/hmminfo/read_binhmm.c	Sun Aug  5 10:26:54 2012
@@ -22,7 +22,7 @@
  * @author Akinobu LEE
  * @date   Wed Feb 16 05:23:59 2005
  *
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
  * 
  */
 /*
@@ -137,10 +137,22 @@
   jlog("Stat: rd_para: found embedded acoutic parameter (ver.%d)\n", version);
 
   /* read parameters */
-  rdn(fp, &(para->smp_period), sizeof(long), 1);      
-  rdn(fp, &(para->smp_freq), sizeof(long), 1);	
+  rdn(fp, &(para->smp_period), sizeof(int), 1);      
+  rdn(fp, &(para->smp_freq), sizeof(int), 1);
   rdn(fp, &(para->framesize), sizeof(int), 1);        
   rdn(fp, &(para->frameshift), sizeof(int), 1);       
+  /* tweak to read 64bit binhmm with older version (smp_period, smp_freq = 8byte) */
+  if (para->smp_period == 0 && para->framesize == 0 &&
+      para->smp_freq != 0 && para->frameshift != 0) {
+    jlog("Warning: rd_para: smp_period=%d, smp_freq=%d, framesize=%d, frameshift=%d\n", para->smp_period, para->smp_freq, para->framesize, para->frameshift);
+    jlog("Warning: rd_para: wrong values, may be reading binhmm created at 64bit?\n");
+    jlog("Warning: rd_para: try to re-parse values from 64bit to 32bit...\n");
+    para->smp_period = para->smp_freq;
+    para->smp_freq = para->frameshift;
+    rdn(fp, &(para->framesize), sizeof(int), 1);
+    rdn(fp, &(para->frameshift), sizeof(int), 1);
+    jlog("Warning: rd_para: smp_period=%d, smp_freq=%d, framesize=%d, frameshift=%d\n", para->smp_period, para->smp_freq, para->framesize, para->frameshift);
+  }
   rdn(fp, &(para->preEmph), sizeof(float), 1);        
   rdn(fp, &(para->lifter), sizeof(int), 1);           
   rdn(fp, &(para->fbank_num), sizeof(int), 1);        
Index: julius4/libsent/src/hmminfo/write_binhmm.c
diff -u julius4/libsent/src/hmminfo/write_binhmm.c:1.6 julius4/libsent/src/hmminfo/write_binhmm.c:1.7
--- julius4/libsent/src/hmminfo/write_binhmm.c:1.6	Fri Jul 27 17:44:50 2012
+++ julius4/libsent/src/hmminfo/write_binhmm.c	Sun Aug  5 10:26:54 2012
@@ -22,7 +22,7 @@
  * @author Akinobu LEE
  * @date   Wed Feb 16 06:03:36 2005
  *
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
  * 
  */
 /*
@@ -31,7 +31,7 @@
  * All rights reserved
  */
 
-/* $Id: write_binhmm.c,v 1.6 2012/07/27 08:44:50 sumomo Exp $ */
+/* $Id: write_binhmm.c,v 1.7 2012/08/05 01:26:54 sumomo Exp $ */
 
 #include <sent/stddefs.h>
 #include <sent/htk_param.h>
@@ -146,8 +146,8 @@
   version = VALUE_VERSION;
   wrt(fp, &version, sizeof(short), 1);
 
-  wrt(fp, &(para->smp_period), sizeof(long), 1);      
-  wrt(fp, &(para->smp_freq), sizeof(long), 1);	
+  wrt(fp, &(para->smp_period), sizeof(int), 1);      
+  wrt(fp, &(para->smp_freq), sizeof(int), 1);	
   wrt(fp, &(para->framesize), sizeof(int), 1);        
   wrt(fp, &(para->frameshift), sizeof(int), 1);       
   wrt(fp, &(para->preEmph), sizeof(float), 1);        



Julius-cvs メーリングリストの案内
Back to archive index