"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "base_class/EST_FMatrix.cc" between
speech_tools-2.4-release.tar.gz and speech_tools-2.5.0-release.tar.gz

About: The speech_tools - Edinburgh Speech Tools Library (used by the Festival Speech Synthesis System).

EST_FMatrix.cc  (speech_tools-2.4-release):EST_FMatrix.cc  (speech_tools-2.5.0-release)
skipping to change at line 610 skipping to change at line 610
EST_FVector& EST_FVector::operator/=(const float f) EST_FVector& EST_FVector::operator/=(const float f)
{ {
for (int i = 0; i < n(); ++i) for (int i = 0; i < n(); ++i)
(*this)[i] /= f; (*this)[i] /= f;
return *this; return *this;
} }
EST_read_status EST_FVector::est_load(const EST_String &filename) EST_read_status EST_FVector::est_load(const EST_String &filename)
{ {
// ascii/binary load with short header for byte swap and sizes // ascii/binary load with short header for byte swap and sizes
int i,k; int i,k;
int l, swap; int l, swap;
EST_TokenStream ts; EST_TokenStream ts;
EST_read_status r; EST_read_status r;
EST_EstFileType t; EST_EstFileType t;
EST_Option hinfo; EST_Option hinfo;
bool ascii; bool ascii;
if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0) if (((filename == "-") ? ts.open(cin) : ts.open(filename)) != 0)
{ {
cerr << "FVector: can't open FVector input file " cerr << "FVector: can't open FVector input file "
<< filename << endl; << filename << endl;
return misc_read_error; return misc_read_error;
} }
if ((r = read_est_header(ts, hinfo, ascii, t)) != format_ok) if ((r = read_est_header(ts, hinfo, ascii, t)) != format_ok)
return r; return r;
if (t != est_file_fvector) if (t != est_file_fvector)
return misc_read_error; return misc_read_error;
if (hinfo.ival("version") != 1) if (hinfo.ival("version") != 1)
{ {
cerr << "FVector load: " << ts.pos_description() << cerr << "FVector load: " << ts.pos_description() <<
" wrong version of FVector format expected 1 but found " << " wrong version of FVector format expected 1 but found " <<
hinfo.ival("version") << endl; hinfo.ival("version") << endl;
return misc_read_error; return misc_read_error;
} }
l = hinfo.ival("length"); l = hinfo.ival("length");
resize(l); resize(l);
if (ascii) if (ascii)
{ // an ascii file { // an ascii file
for (i = 0; i < length(); ++i) for (i = 0; i < length(); ++i)
a_no_check(i) = atof(ts.get().string()); a_no_check(i) = atof(ts.get().string());
} }
else else
{ // a binary file { // a binary file
float *buff; float *buff;
if ((EST_BIG_ENDIAN && (hinfo.sval("ByteOrder")=="LittleEndian")) || if ((EST_BIG_ENDIAN && (hinfo.sval("ByteOrder")=="LittleEndian")) ||
(EST_LITTLE_ENDIAN && (hinfo.sval("ByteOrder") == "BigEndian"))) (EST_LITTLE_ENDIAN && (hinfo.sval("ByteOrder") == "BigEndian")))
swap = TRUE; swap = TRUE;
else else
swap = FALSE; swap = FALSE;
buff = walloc(float,l); buff = walloc(float,l);
// A single read is *much* faster than multiple reads // A single read is *much* faster than multiple reads
if (ts.fread(buff,sizeof(float),l) != l) if (ts.fread(buff,sizeof(float),l) != l)
{ {
cerr << "EST_FVector: binload: short file in \"" cerr << "EST_FVector: binload: short file in \""
<< filename << "\"" << endl; << filename << "\"" << endl;
return misc_read_error; return misc_read_error;
} }
if (swap) if (swap)
swap_bytes_float(buff,l); swap_bytes_float(buff,l);
for (k = i = 0; i < length(); ++i) for (k = i = 0; i < length(); ++i)
a_no_check(i) = buff[k++]; a_no_check(i) = buff[k++];
wfree(buff); wfree(buff);
} }
ts.close(); ts.close();
return read_ok; return read_ok;
} }
EST_read_status EST_FVector::load(const EST_String &filename) EST_read_status EST_FVector::load(const EST_String &filename)
{ {
EST_read_status r; EST_read_status r;
 End of changes. 18 change blocks. 
31 lines changed or deleted 31 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)