42 #pragma warning (disable: 4996)
61 #define IO_SUCCESS (0)
66 #define NUM_COEFF "13"
71 #define DISPLAY_SIZE "10"
72 #define STR_MAX_INT "2147483647"
74 static arg_t arg[] = {
78 "Number of coefficients in the feature vector."},
82 "Number of displayed coefficients."},
86 "Whether header is shown."},
90 "Whether description will be shown."},
94 "The beginning frame 0-based."},
102 "Input feature file."},
106 int read_cep(
char const *file,
float ***cep,
int *nframes,
int numcep);
109 main(
int argc,
char *argv[])
112 int32 noframe, vsize, dsize, column;
113 int32 frm_begin, frm_end;
114 int is_header, is_describe;
128 E_FATAL(
"-i : Input vector size should be larger than 0.\n");
130 E_FATAL(
"-d : Column size should be larger than 0\n");
132 E_FATAL(
"-b : Beginning frame should be larger than 0\n");
136 if (frm_begin >= frm_end)
138 (
"Ending frame (-e) should be larger than beginning frame (-b).\n");
141 E_FATAL(
"Input file was not specified with (-f)\n");
143 if (read_cep(cepfile, &cep, &noframe, vsize) == IO_ERR)
149 column = (vsize > dsize) ? dsize : vsize;
150 frm_end = (frm_end > noframe) ? noframe : frm_end;
152 E_INFO(
"Displaying %d out of %d columns per frame\n", column, vsize);
153 E_INFO(
"Total %d frames\n\n", noframe);
160 printf(
"\n%6s",
"frame#:");
163 for (j = 0; j < column; ++j) {
164 printf(
"%3s%3d%s ",
"c[", j,
"]");
169 offset += frm_begin * vsize;
170 for (i = frm_begin; i < frm_end; ++i) {
174 for (j = 0; j < column; ++j)
175 printf(
"%7.3f ", z[offset + j]);
189 read_cep(
char const *file,
float ***cep,
int *numframes,
int cepsize)
202 if ((fp = fopen(file,
"rb")) == NULL) {
208 if (fread(&n_float,
sizeof(
int), 1, fp) != 1) {
215 if ((
int) (n_float *
sizeof(
float) + 4) != statbuf.st_size) {
219 if ((
int) (n *
sizeof(
float) + 4) != statbuf.st_size) {
220 E_ERROR(
"Header size field: %d(%08x); filesize: %d(%08x)\n",
221 n_float, n_float, (
int) statbuf.st_size,
222 (
int) statbuf.st_size);
231 E_ERROR(
"Header size field: %d\n", n_float);
237 n = n_float / cepsize;
238 if (n * cepsize != n_float) {
239 E_ERROR(
"Header size field: %d; not multiple of %d\n",
245 mfcbuf = (
float **)
ckd_calloc_2d(n, cepsize,
sizeof(float32));
248 n_float = n * cepsize;
249 if ((
int) fread(mfcbuf[0],
sizeof(
float), n_float, fp) != n_float) {
250 E_ERROR(
"Error reading mfc data from the file '%s'", file);
255 for (i = 0; i < n_float; i++)
256 SWAP_FLOAT32(&(mfcbuf[0][i]));
266 #if defined(_WIN32_WCE)
267 #pragma comment(linker,"/entry:mainWCRTStartup")
270 int wmain(int32 argc,
wchar_t *wargv[]) {
276 argv = malloc(argc*
sizeof(
char*));
277 for (i = 0; i < argc; i++){
278 wlen = lstrlenW(wargv[i]);
279 len = wcstombs(NULL, wargv[i], wlen);
280 argv[i] = malloc(len+1);
281 wcstombs(argv[i], wargv[i], wlen);
285 return main(argc, argv);
#define E_ERROR_SYSTEM(...)
Print error text; Call perror("");.
Command-line and other configurationparsing and handling.
Miscellaneous useful string functions.
#define E_INFO(...)
Print logging information to standard error stream.
#define ckd_calloc_2d(d1, d2, sz)
Macro for ckd_calloc_2d
#define E_ERROR(...)
Print error message to error log.
Sphinx's memory allocation/deallocation routines.
SPHINXBASE_EXPORT int32 stat_retry(const char *file, struct stat *statbuf)
There is no bitstream decoder, because a stream abstraction is too slow.
Cross platform binary IO to process files in sphinx3 format.
#define ARG_STRING
String argument (optional).
Basic type definitions used in Sphinx.
SPHINXBASE_EXPORT void cmd_ln_appl_exit(void)
Finalization routine corresponding to cmd_ln_appl_enter().
Implementation of logging routines.
#define E_FATAL_SYSTEM(...)
Print error text; Call perror(""); exit(errno);.
Argument definition structure.
SPHINXBASE_EXPORT void ckd_free_2d(void *ptr)
Free a 2-D array (ptr) previously allocated by ckd_calloc_2d.
#define E_FATAL(...)
Exit with non-zero status after error message.
#define cmd_ln_str(name)
Retrieve a string from the global command line.
SPHINXBASE_EXPORT void cmd_ln_appl_enter(int argc, char *argv[], char const *default_argfn, const arg_t *defn)
Old application initialization routine for Sphinx3 code.
file IO related operations.
#define cmd_ln_int32(name)
Retrieve a 32-bit integer from the global command line.