Go to the source code of this file.
Defines | |
#define | xcalloc(n, t) ((t*)calloc((n),sizeof(t))) |
#define | xmalloc(n, t) ((t*)malloc((n)*sizeof(t))) |
#define | xfree(p) free((char*)(p)) |
#define | max(a, b) (((a)>(b))?(a):(b)) |
#define | min(a, b) (((a)<(b))?(a):(b)) |
#define | fswap(a, b) {double tmp=(a);(a)=(b);(b)=tmp} |
#define | iswap(a, b) {long tmp=(a);(a)=(b);(b)=tmp} |
#define | sign(a) ((a)==0.0?0.0:(a)<0.0?-1.0:1.0) |
#define | setzero(p, n) memset((p),0,sizeof(p[0])*(n)) |
#define | numel(a) ((int)(sizeof(a)/sizeof(a[0]))) |
#define | bswap32(a) (((unsigned long)(a)>>24)|(((unsigned long)(a)&0x00ff0000)>>8)|(((unsigned long)(a)&0x0000ff00)<<8)|((unsigned long)(a)<<24)) |
#define | bswap16(a) (((unsigned short)(a)>>8)|((unsigned short)(a)<<8)) |
#define | TRUE (-1) |
#define | FALSE (0) |
Functions | |
double | logProb (double prob) |
Logarithmic operation for probability calculation. | |
double ** | allocDblMatrix (int nrow, int ncol) |
Allocate memory for an (nrow x ncol) matrix. | |
void | freeDblMatrix (double **mat, int nrow) |
Free memory space of a matrix. | |
int ** | allocIntMatrix (int nrow, int ncol) |
Allocate memory for an (nrow x ncol) matrix. | |
void | freeIntMatrix (int **mat, int nrow) |
Free memory space of a matrix. | |
short ** | allocShtMatrix (int nrow, int ncol) |
Allocate memory for an (nrow x ncol) matrix. | |
void | freeShtMatrix (short **mat, int nrow) |
Free memory space of a matrix. | |
long ** | allocLngMatrix (int nrow, int ncol) |
Allocate memory for an (nrow x ncol) matrix. | |
void | freeLngMatrix (long **mat, int nrow) |
Free memory space of a matrix. | |
int | countLines (FILE *) |
Count the number of lines in a text file. | |
int | probeWord (char *word, int size, FILE *fp) |
Read a word from a given file pointer without incrementing the pointer. | |
char * | allocCopyStr (char *source) |
Allocate memory space and copy a string to the space. | |
char * | extractLastDiphone (char *label) |
Extract the last diphone from a given triphone. | |
char * | extractFirstDiphone (char *label) |
Extract the first diphone included in the triphone. | |
char * | extractCentrePhone (char *label) |
Extract the centre phone of the triphone. |
char* allocCopyStr | ( | char * | source | ) |
Allocate memory space and copy a string to the space.
[in] | source |
NULL | Memory allocation error | |
otherwise | Pointer to the string copied |
double** allocDblMatrix | ( | int | nrow, | |
int | ncol | |||
) |
Allocate memory for an (nrow x ncol) matrix.
[in] | nrow | Number of rows |
[in] | ncol | Number of columns |
NULL | Memory allocation error | |
otherwise | Pointer to the matrix allocated |
int** allocIntMatrix | ( | int | nrow, | |
int | ncol | |||
) |
Allocate memory for an (nrow x ncol) matrix.
[in] | nrow | Number of rows |
[in] | ncol | Number of columns |
NULL | Memory allocation error | |
otherwise | Pointer to the matrix allocated |
long** allocLngMatrix | ( | int | nrow, | |
int | ncol | |||
) |
Allocate memory for an (nrow x ncol) matrix.
[in] | nrow | Number of rows |
[in] | ncol | Number of columns |
NULL | Memory allocation error | |
otherwise | Pointer to the matrix allocated |
short** allocShtMatrix | ( | int | nrow, | |
int | ncol | |||
) |
Allocate memory for an (nrow x ncol) matrix.
[in] | nrow | Number of rows |
[in] | ncol | Number of columns |
NULL | Memory allocation error | |
otherwise | Pointer to the matrix allocated |
int countLines | ( | FILE * | ip | ) |
Count the number of lines in a text file.
[in] | ip | File pointer to the file |
char* extractCentrePhone | ( | char * | label | ) |
Extract the centre phone of the triphone.
[in] | label | Triphone label |
char* extractFirstDiphone | ( | char * | label | ) |
Extract the first diphone included in the triphone.
[in] | label | Triphone label |
char* extractLastDiphone | ( | char * | label | ) |
Extract the last diphone from a given triphone.
[in] | label | Triphone label |
void freeDblMatrix | ( | double ** | mat, | |
int | nrow | |||
) |
Free memory space of a matrix.
[in] | mat | Pointer to the matrix |
[in] | nrow | Number of rows |
void freeIntMatrix | ( | int ** | mat, | |
int | nrow | |||
) |
Free memory space of a matrix.
[in] | mat | Pointer to the matrix |
[in] | nrow | Number of rows |
void freeLngMatrix | ( | long ** | mat, | |
int | nrow | |||
) |
Free memory space of a matrix.
[in] | mat | Pointer to the matrix |
[in] | nrow | Number of rows |
void freeShtMatrix | ( | short ** | mat, | |
int | nrow | |||
) |
Free memory space of a matrix.
[in] | mat | Pointer to the matrix |
[in] | nrow | Number of rows |
double logProb | ( | double | prob | ) |
Logarithmic operation for probability calculation.
[in] | prob | Probability |
int probeWord | ( | char * | word, | |
int | size, | |||
FILE * | fp | |||
) |
Read a word from a given file pointer without incrementing the pointer.
[in,out] | word | Pointer to an array to which a read word is stored |
[in] | size | Maximum possible length of the word in byte |
[in] | fp | File pointer from which the word is read |
ERROR_FREAD | File read error | |
ERROR_ALLOC | Memory allocation error | |
RTN_ERROR | Error: bad file format | |
NO_ERROR | Successful execution |