diff --git a/CMakeLists.txt b/CMakeLists.txt index b9c34ec2..b14e0387 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,7 @@ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) configure_file(config.h.in config.h) -configure_file(sphinx_config.h.in include/sphinxbase/sphinx_config.h) +configure_file(sphinx_config.h.in include/pocketsphinx/sphinx_config.h) add_definitions(-DHAVE_CONFIG_H) if(SKBUILD) diff --git a/include/pocketsphinx.h b/include/pocketsphinx.h index ac735859..66846658 100644 --- a/include/pocketsphinx.h +++ b/include/pocketsphinx.h @@ -424,28 +424,6 @@ ps_config_t *ps_get_config(ps_decoder_t *ps); POCKETSPHINX_EXPORT logmath_t *ps_get_logmath(ps_decoder_t *ps); -/** - * Get the feature extraction object for this decoder. - * - * @return The feature extraction object for this decoder. The - * decoder owns this pointer, so you should not attempt to - * free it manually. Use fe_retain() if you wish to reuse it - * elsewhere. - */ -POCKETSPHINX_EXPORT -fe_t *ps_get_fe(ps_decoder_t *ps); - -/** - * Get the dynamic feature computation object for this decoder. - * - * @return The dynamic feature computation object for this decoder. - * The decoder owns this pointer, so you should not attempt to - * free it manually. Use feat_retain() if you wish to reuse - * it elsewhere. - */ -POCKETSPHINX_EXPORT -feat_t *ps_get_feat(ps_decoder_t *ps); - /** * Adapt current acoustic model using a linear transform. * @@ -633,7 +611,7 @@ int ps_process_raw(ps_decoder_t *ps, */ POCKETSPHINX_EXPORT int ps_process_cep(ps_decoder_t *ps, - mfcc_t **data, + float **data, int n_frames, int no_search, int full_utt); diff --git a/include/pocketsphinx/endpointer.h b/include/pocketsphinx/endpointer.h index c4409489..5c178bd3 100644 --- a/include/pocketsphinx/endpointer.h +++ b/include/pocketsphinx/endpointer.h @@ -36,7 +36,7 @@ #define __PS_ENDPOINTER_H__ -#include +#include #include #ifdef __cplusplus @@ -46,9 +46,8 @@ extern "C" { } #endif -#include +#include #include - #include /** diff --git a/include/pocketsphinx/err.h b/include/pocketsphinx/err.h index c27e72af..5aed8e6a 100644 --- a/include/pocketsphinx/err.h +++ b/include/pocketsphinx/err.h @@ -43,6 +43,8 @@ #include #include +#include + /** * @file err.h * @brief Implementation of logging routines. @@ -138,14 +140,14 @@ typedef enum err_e { ERR_MAX } err_lvl_t; -POCKETSPHINX_EXPORT void -err_msg(err_lvl_t lvl, const char *path, long ln, const char *fmt, ...); +POCKETSPHINX_EXPORT +void err_msg(err_lvl_t lvl, const char *path, long ln, const char *fmt, ...); -POCKETSPHINX_EXPORT void -err_msg_system(err_lvl_t lvl, const char *path, long ln, const char *fmt, ...); +POCKETSPHINX_EXPORT +void err_msg_system(err_lvl_t lvl, const char *path, long ln, const char *fmt, ...); -POCKETSPHINX_EXPORT void -err_logfp_cb(void * user_data, err_lvl_t level, const char *fmt, ...); +POCKETSPHINX_EXPORT +void err_logfp_cb(void * user_data, err_lvl_t level, const char *fmt, ...); typedef void (*err_cb_f)(void* user_data, err_lvl_t, const char *, ...); diff --git a/include/pocketsphinx/lattice.h b/include/pocketsphinx/lattice.h index bca29577..c99a0d33 100644 --- a/include/pocketsphinx/lattice.h +++ b/include/pocketsphinx/lattice.h @@ -43,10 +43,7 @@ #ifndef __PS_LATTICE_H__ #define __PS_LATTICE_H__ -/* SphinxBase headers. */ -#include - -/* PocketSphinx headers. */ +#include #include #ifdef __cplusplus diff --git a/include/pocketsphinx/mllr.h b/include/pocketsphinx/mllr.h index c9fa6aa3..699cb56f 100644 --- a/include/pocketsphinx/mllr.h +++ b/include/pocketsphinx/mllr.h @@ -43,10 +43,7 @@ #ifndef __PS_MLLR_H__ #define __PS_MLLR_H__ -/* SphinxBase headers. */ -#include - -/* PocketSphinx headers. */ +#include #include #ifdef __cplusplus diff --git a/include/pocketsphinx/search.h b/include/pocketsphinx/search.h index 473115eb..a1d3b13f 100644 --- a/include/pocketsphinx/search.h +++ b/include/pocketsphinx/search.h @@ -72,8 +72,6 @@ #ifndef __PS_SEARCH_H__ #define __PS_SEARCH_H__ -#include - #ifdef __cplusplus extern "C" { #endif @@ -86,6 +84,8 @@ extern "C" { */ typedef struct ps_search_iter_s ps_search_iter_t; +/* Forward-declare this because header files are an atrocity. */ +typedef struct ps_decoder_s ps_decoder_t; /** * Actives search with the provided name. @@ -164,8 +164,9 @@ POCKETSPHINX_EXPORT const char* ps_search_iter_val(ps_search_iter_t *itor); -/* Forward declare this (not public API) */ +/* Forward declare these (not public API) */ typedef struct ngram_model_s ngram_model_t; +typedef struct fsg_model_s fsg_model_t; /** * Get the language model set object for this decoder. diff --git a/include/pocketsphinx/vad.h b/include/pocketsphinx/vad.h index b3b77a43..7a147c8a 100644 --- a/include/pocketsphinx/vad.h +++ b/include/pocketsphinx/vad.h @@ -36,7 +36,7 @@ #define __PS_VAD_H__ -#include +#include #include #ifdef __cplusplus diff --git a/programs/pocketsphinx_batch.c b/programs/pocketsphinx_batch.c index 236f1b64..92949db2 100644 --- a/programs/pocketsphinx_batch.c +++ b/programs/pocketsphinx_batch.c @@ -35,20 +35,16 @@ * */ -/* System headers. */ #include -/* SphinxBase headers. */ -#include -#include -#include -#include -#include - -/* PocketSphinx headers. */ #include -/* S3kr3t headerz. */ +#include "util/ckd_alloc.h" +#include "util/strfuncs.h" +#include "util/filename.h" +#include "util/byteorder.h" +#include "util/pio.h" +#include "lm/fsg_model.h" #include "cmdln_macro.h" #include "pocketsphinx_internal.h" diff --git a/programs/pocketsphinx_jsgf2fsg.c b/programs/pocketsphinx_jsgf2fsg.c index b26973d2..ebc87986 100644 --- a/programs/pocketsphinx_jsgf2fsg.c +++ b/programs/pocketsphinx_jsgf2fsg.c @@ -37,12 +37,11 @@ #include -#include -#include -#include -#include -#include - +#include "util/ckd_alloc.h" +#include "util/hash_table.h" +#include "util/strfuncs.h" +#include "lm/fsg_model.h" +#include "lm/jsgf.h" #include "pocketsphinx_internal.h" static const arg_t defn[] = { diff --git a/programs/pocketsphinx_lm_convert.c b/programs/pocketsphinx_lm_convert.c index 804a690e..3001722e 100644 --- a/programs/pocketsphinx_lm_convert.c +++ b/programs/pocketsphinx_lm_convert.c @@ -38,15 +38,14 @@ * \file sphinx_lm_convert.c * Language model conversion tool. */ -#include -#include -#include -#include -#include -#include -#include - +#include #include "pocketsphinx_internal.h" +#include "lm/ngram_model.h" +#include "util/ckd_alloc.h" +#include "util/cmd_ln.h" +#include "util/ckd_alloc.h" +#include "util/pio.h" +#include "util/strfuncs.h" #include #include diff --git a/programs/pocketsphinx_lm_eval.c b/programs/pocketsphinx_lm_eval.c index 4ea69807..3bcfd7bb 100644 --- a/programs/pocketsphinx_lm_eval.c +++ b/programs/pocketsphinx_lm_eval.c @@ -38,14 +38,14 @@ * \file sphinx_lm_eval.c * Language model evaluation tool. */ -#include -#include -#include -#include -#include -#include -#include +#include +#include "lm/ngram_model.h" +#include "util/ckd_alloc.h" +#include "util/cmd_ln.h" +#include "util/ckd_alloc.h" +#include "util/pio.h" +#include "util/strfuncs.h" #include "pocketsphinx_internal.h" #include diff --git a/programs/pocketsphinx_main.c b/programs/pocketsphinx_main.c index 40af8e32..5f55d045 100644 --- a/programs/pocketsphinx_main.c +++ b/programs/pocketsphinx_main.c @@ -46,6 +46,7 @@ #include +#include "util/ckd_alloc.h" #include "pocketsphinx_internal.h" static int global_done = 0; diff --git a/programs/pocketsphinx_mdef_convert.c b/programs/pocketsphinx_mdef_convert.c index c92857df..a7eeb406 100644 --- a/programs/pocketsphinx_mdef_convert.c +++ b/programs/pocketsphinx_mdef_convert.c @@ -45,6 +45,7 @@ #include +#include "util/ckd_alloc.h" #include "bin_mdef.h" int diff --git a/programs/pocketsphinx_pitch.c b/programs/pocketsphinx_pitch.c index 595c3516..15a6ac25 100644 --- a/programs/pocketsphinx_pitch.c +++ b/programs/pocketsphinx_pitch.c @@ -42,13 +42,14 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include + +#include "util/cmd_ln.h" +#include "util/ckd_alloc.h" +#include "util/byteorder.h" +#include "util/strfuncs.h" +#include "util/pio.h" +#include "fe/yin.h" #include "pocketsphinx_internal.h" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6e63dcfa..6e1bec09 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -100,12 +100,12 @@ util/pio.c util/genrand.c ) target_include_directories( - pocketsphinx PRIVATE ${CMAKE_BINARY_DIR} # config.h - pocketsphinx PRIVATE ${CMAKE_SOURCE_DIR}/include/pocketsphinx + pocketsphinx PRIVATE ${CMAKE_BINARY_DIR} pocketsphinx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} pocketsphinx PUBLIC ${CMAKE_SOURCE_DIR}/include pocketsphinx PUBLIC ${CMAKE_BINARY_DIR}/include pocketsphinx INTERFACE ${CMAKE_SOURCE_DIR}/include + pocketsphinx INTERFACE ${CMAKE_BINARY_DIR}/include ) if(APPLE) # Things we might need are here diff --git a/src/common_audio/signal_processing/include/signal_processing_library.h b/src/common_audio/signal_processing/include/signal_processing_library.h index a87a1f92..b46cca25 100644 --- a/src/common_audio/signal_processing/include/signal_processing_library.h +++ b/src/common_audio/signal_processing/include/signal_processing_library.h @@ -19,7 +19,7 @@ #include -#include +#include #ifdef HAVE_STDINT_H #include #else diff --git a/src/common_audio/signal_processing/include/spl_inl.h b/src/common_audio/signal_processing/include/spl_inl.h index 0ee247e3..f1b2db15 100644 --- a/src/common_audio/signal_processing/include/spl_inl.h +++ b/src/common_audio/signal_processing/include/spl_inl.h @@ -16,7 +16,7 @@ #include "rtc_base/compile_assert_c.h" -#include +#include #ifdef HAVE_STDINT_H #include #else diff --git a/src/common_audio/signal_processing/resample_by_2_internal.h b/src/common_audio/signal_processing/resample_by_2_internal.h index 888d6be3..f7aafe90 100644 --- a/src/common_audio/signal_processing/resample_by_2_internal.h +++ b/src/common_audio/signal_processing/resample_by_2_internal.h @@ -16,7 +16,7 @@ #ifndef COMMON_AUDIO_SIGNAL_PROCESSING_RESAMPLE_BY_2_INTERNAL_H_ #define COMMON_AUDIO_SIGNAL_PROCESSING_RESAMPLE_BY_2_INTERNAL_H_ -#include +#include #ifdef HAVE_STDINT_H #include #else diff --git a/src/common_audio/vad/include/webrtc_vad.h b/src/common_audio/vad/include/webrtc_vad.h index 84bfcc7a..543a0dc1 100644 --- a/src/common_audio/vad/include/webrtc_vad.h +++ b/src/common_audio/vad/include/webrtc_vad.h @@ -18,7 +18,7 @@ #include -#include +#include #ifdef HAVE_STDINT_H #include #else diff --git a/src/common_audio/vad/vad_gmm.h b/src/common_audio/vad/vad_gmm.h index 69b5d41f..4c13978b 100644 --- a/src/common_audio/vad/vad_gmm.h +++ b/src/common_audio/vad/vad_gmm.h @@ -13,7 +13,7 @@ #ifndef COMMON_AUDIO_VAD_VAD_GMM_H_ #define COMMON_AUDIO_VAD_VAD_GMM_H_ -#include +#include #ifdef HAVE_STDINT_H #include #else diff --git a/src/dict.c b/src/dict.c index 3cd2e9fe..b89c5f3b 100644 --- a/src/dict.c +++ b/src/dict.c @@ -38,6 +38,7 @@ #include #include "util/pio.h" +#include "util/ckd_alloc.h" #include "util/strfuncs.h" #include "dict.h" diff --git a/src/dict2pid.c b/src/dict2pid.c index 126898f0..c6bfe179 100644 --- a/src/dict2pid.c +++ b/src/dict2pid.c @@ -37,6 +37,9 @@ #include +#include "util/ckd_alloc.h" +#include "util/bitvec.h" +#include "s3types.h" #include "dict2pid.h" #include "hmm.h" diff --git a/src/fe/fe.h b/src/fe/fe.h index 03fe058a..c3c6f5ad 100644 --- a/src/fe/fe.h +++ b/src/fe/fe.h @@ -273,7 +273,6 @@ enum fe_error_e { * cmd_ln_init() in friends to create argument structures for * fe_init_auto_r(). */ -SPHINXBASE_EXPORT arg_t const *fe_get_args(void); /** @@ -284,7 +283,6 @@ arg_t const *fe_get_args(void); * fe_t, so you may free this if you no longer need it. * @return Newly created front-end object. */ -SPHINXBASE_EXPORT fe_t *fe_init_auto_r(cmd_ln_t *config); /** @@ -294,14 +292,12 @@ fe_t *fe_init_auto_r(cmd_ln_t *config); * owned by the fe_t, so you should not attempt to free it * manually. */ -SPHINXBASE_EXPORT cmd_ln_t *fe_get_config(fe_t *fe); /** * Start processing an utterance. * @return 0 for success, <0 for error (see enum fe_error_e) */ -SPHINXBASE_EXPORT int fe_start_utt(fe_t *fe); /** @@ -317,7 +313,6 @@ int fe_start_utt(fe_t *fe); * @param fe Front-end object * @return Dimensionality of front-end output. */ -SPHINXBASE_EXPORT int fe_get_output_size(fe_t *fe); /** @@ -333,7 +328,6 @@ int fe_get_output_size(fe_t *fe); * @param out_frame_shift Output: Number of samples between each frame start. * @param out_frame_size Output: Number of samples in each frame. */ -SPHINXBASE_EXPORT void fe_get_input_size(fe_t *fe, int *out_frame_shift, int *out_frame_size); @@ -351,7 +345,6 @@ void fe_get_input_size(fe_t *fe, int *out_frame_shift, * (either 0 or 1). * @return 0 for success, <0 for error (see enum fe_error_e) */ -SPHINXBASE_EXPORT int fe_end_utt(fe_t *fe, mfcc_t *out_cepvector, int32 *out_nframes); /** @@ -359,7 +352,6 @@ int fe_end_utt(fe_t *fe, mfcc_t *out_cepvector, int32 *out_nframes); * * @return pointer to the retained front end. */ -SPHINXBASE_EXPORT fe_t *fe_retain(fe_t *fe); /** @@ -369,7 +361,6 @@ fe_t *fe_retain(fe_t *fe); * * @return new reference count (0 if freed completely) */ -SPHINXBASE_EXPORT int fe_free(fe_t *fe); /** @@ -380,7 +371,6 @@ int fe_free(fe_t *fe); * @param buf_cep Buffer which will receive one frame of features. * @return 0 for success, <0 for error (see enum fe_error_e) */ -SPHINXBASE_EXPORT int fe_process_frame(fe_t *fe, int16 const *spch, int32 nsamps, mfcc_t *out_cep); @@ -431,7 +421,6 @@ int fe_process_frame(fe_t *fe, int16 const *spch, * Output: Number of frames actually generated. * @return 0 for success, <0 for failure (see enum fe_error_e) */ -SPHINXBASE_EXPORT int fe_process_frames(fe_t *fe, int16 const **inout_spch, size_t *inout_nsamps, @@ -453,7 +442,6 @@ int fe_process_frames(fe_t *fe, * * @return 0 for success, <0 for failure (see enum fe_error_e) */ -SPHINXBASE_EXPORT int fe_process_utt(fe_t *fe, /**< A front end object */ int16 const *spch, /**< The speech samples */ size_t nsamps, /**< number of samples*/ @@ -464,13 +452,11 @@ int fe_process_utt(fe_t *fe, /**< A front end object */ /** * Free the output pointer returned by fe_process_utt(). **/ -SPHINXBASE_EXPORT void fe_free_2d(void *arr); /** * Convert a block of mfcc_t to float32 (can be done in-place) **/ -SPHINXBASE_EXPORT int fe_mfcc_to_float(fe_t *fe, mfcc_t **input, float32 **output, @@ -479,7 +465,6 @@ int fe_mfcc_to_float(fe_t *fe, /** * Convert a block of float32 to mfcc_t (can be done in-place) **/ -SPHINXBASE_EXPORT int fe_float_to_mfcc(fe_t *fe, float32 **input, mfcc_t **output, @@ -508,7 +493,6 @@ int fe_float_to_mfcc(fe_t *fe, * * Also, it normalizes by 1/nfilt rather than 2/nfilt, for some reason. **/ -SPHINXBASE_EXPORT int fe_logspec_to_mfcc(fe_t *fe, /**< A fe structure */ const mfcc_t *fr_spec, /**< One frame of spectrum */ mfcc_t *fr_cep /**< One frame of cepstrum */ @@ -522,7 +506,6 @@ int fe_logspec_to_mfcc(fe_t *fe, /**< A fe structure */ * cos(0) basis vector (i.e. the one corresponding to the DC * coefficient in the output). **/ -SPHINXBASE_EXPORT int fe_logspec_dct2(fe_t *fe, /**< A fe structure */ const mfcc_t *fr_spec, /**< One frame of spectrum */ mfcc_t *fr_cep /**< One frame of cepstrum */ @@ -536,7 +519,6 @@ int fe_logspec_dct2(fe_t *fe, /**< A fe structure */ * cos(0) basis vector (i.e. the one corresponding to the DC * coefficient in the input). **/ -SPHINXBASE_EXPORT int fe_mfcc_dct3(fe_t *fe, /**< A fe structure */ const mfcc_t *fr_cep, /**< One frame of cepstrum */ mfcc_t *fr_spec /**< One frame of spectrum */ diff --git a/src/feat/cmn.h b/src/feat/cmn.h index 99744acd..957346fa 100644 --- a/src/feat/cmn.h +++ b/src/feat/cmn.h @@ -111,11 +111,9 @@ typedef enum cmn_type_e { } cmn_type_t; /** String representations of cmn_type_t values. */ -SPHINXBASE_EXPORT extern const char *cmn_type_str[]; /** Convert string representation (from command-line) to cmn_type_t */ -SPHINXBASE_EXPORT cmn_type_t cmn_type_from_str(const char *str); /** \struct cmn_t @@ -132,13 +130,11 @@ typedef struct { int refcount; } cmn_t; -SPHINXBASE_EXPORT cmn_t* cmn_init(int32 veclen); /** * CMN for the whole sentence */ -SPHINXBASE_EXPORT void cmn (cmn_t *cmn, /**< In/Out: cmn normalization, which contains the cmn_mean and cmn_var) */ mfcc_t **mfc, /**< In/Out: mfc[f] = mfc vector in frame f */ int32 varnorm,/**< In: if not FALSE, variance normalize the input vectors @@ -153,7 +149,6 @@ void cmn (cmn_t *cmn, /**< In/Out: cmn normalization, which contains the cmn_m /** * CMN for one block of data, using live mean */ -SPHINXBASE_EXPORT void cmn_live(cmn_t *cmn, /**< In/Out: cmn normalization, which contains the cmn_mean and cmn_var) */ mfcc_t **incep, /**< In/Out: mfc[f] = mfc vector in frame f*/ @@ -164,7 +159,6 @@ void cmn_live(cmn_t *cmn, /**< In/Out: cmn normalization, which contains /** * Update live mean based on observed data */ -SPHINXBASE_EXPORT void cmn_live_update(cmn_t *cmn); /** @@ -185,7 +179,6 @@ const char *cmn_update_repr(cmn_t *cmn); /** * Set the live mean from a string. */ -SPHINXBASE_EXPORT int cmn_set_repr(cmn_t *cmn, char const *repr); /** @@ -196,7 +189,6 @@ cmn_t *cmn_retain(cmn_t *cmn); /** * Release a CMN, possibly freeing it. */ -SPHINXBASE_EXPORT int cmn_free (cmn_t *cmn); #ifdef __cplusplus diff --git a/src/feat/feat.h b/src/feat/feat.h index 5c464db7..a43299f2 100644 --- a/src/feat/feat.h +++ b/src/feat/feat.h @@ -223,13 +223,11 @@ typedef struct feat_s { * NULL; and each subvec[0]..subvec[N-1] is -1 terminated vector of * feature dims. */ -SPHINXBASE_EXPORT int32 **parse_subvecs(char const *str); /** * Free array of subvector specs. */ -SPHINXBASE_EXPORT void subvecs_free(int32 **subvecs); @@ -245,7 +243,6 @@ void subvecs_free(int32 **subvecs); * NOTE: For I/O convenience, the entire data area is allocated as one contiguous block. * @return pointer to the allocated space if successful, NULL if any error. */ -SPHINXBASE_EXPORT mfcc_t ***feat_array_alloc(feat_t *fcb, /**< In: Descriptor from feat_init(), used to obtain number of streams and stream sizes */ int32 nfr /**< In: Number of frames for which to allocate */ @@ -254,7 +251,6 @@ mfcc_t ***feat_array_alloc(feat_t *fcb, /**< In: Descriptor from feat_init(), us /** * Realloate the array of features. Requires us to know the old size */ -SPHINXBASE_EXPORT mfcc_t ***feat_array_realloc(feat_t *fcb, /**< In: Descriptor from feat_init(), used to obtain number of streams and stream sizes */ mfcc_t ***old_feat, /**< Feature array. Freed */ @@ -265,7 +261,6 @@ mfcc_t ***feat_array_realloc(feat_t *fcb, /**< In: Descriptor from feat_init(), /** * Free a buffer allocated with feat_array_alloc() */ -SPHINXBASE_EXPORT void feat_array_free(mfcc_t ***feat); @@ -284,7 +279,6 @@ void feat_array_free(mfcc_t ***feat); * @return (feat_t *) descriptor if successful, NULL if error. Caller * must not directly modify the contents of the returned value. */ -SPHINXBASE_EXPORT feat_t *feat_init(char const *type,/**< In: Type of feature stream */ cmn_type_t cmn, /**< In: Type of cepstram mean normalization to be done before feature computation; can be @@ -304,7 +298,6 @@ feat_t *feat_init(char const *type,/**< In: Type of feature stream */ * Add an LDA transformation to the feature module from a file. * @return 0 for success or -1 if reading the LDA file failed. **/ -SPHINXBASE_EXPORT int32 feat_read_lda(feat_t *feat, /**< In: Descriptor from feat_init() */ const char *ldafile, /**< In: File to read the LDA matrix from. */ int32 dim /**< In: Dimensionality of LDA output. */ @@ -313,7 +306,6 @@ int32 feat_read_lda(feat_t *feat, /**< In: Descriptor from feat_init() */ /** * Transform a block of features using the feature module's LDA transform. **/ -SPHINXBASE_EXPORT void feat_lda_transform(feat_t *fcb, /**< In: Descriptor from feat_init() */ mfcc_t ***inout_feat, /**< Feature block to transform. */ uint32 nfr /**< In: Number of frames in inout_feat. */ @@ -337,13 +329,11 @@ void feat_lda_transform(feat_t *fcb, /**< In: Descriptor from feat_init() */ * @return 0 for success or -1 if the subvector specification was * invalid. */ -SPHINXBASE_EXPORT int feat_set_subvecs(feat_t *fcb, int32 **subvecs); /** * Print the given block of feature vectors to the given FILE. */ -SPHINXBASE_EXPORT void feat_print(feat_t *fcb, /**< In: Descriptor from feat_init() */ mfcc_t ***feat, /**< In: Feature data to be printed */ int32 nfr, /**< In: Number of frames of feature data above */ @@ -367,7 +357,6 @@ void feat_print(feat_t *fcb, /**< In: Descriptor from feat_init() */ * already specifies extension or absolute path, then these are not * applied. The default extension is defined by the application. */ -SPHINXBASE_EXPORT int32 feat_s2mfc2feat(feat_t *fcb, /**< In: Descriptor from feat_init() */ const char *file, /**< In: File to be read */ const char *dir, /**< In: Directory prefix for file, @@ -416,7 +405,6 @@ int32 feat_s2mfc2feat(feat_t *fcb, /**< In: Descriptor from feat_init() */ * * @return The number of output frames actually computed. **/ -SPHINXBASE_EXPORT int32 feat_s2mfc2feat_live(feat_t *fcb, /**< In: Descriptor from feat_init() */ mfcc_t **uttcep, /**< In: Incoming cepstral buffer */ int32 *inout_ncep,/**< In: Size of incoming buffer. @@ -433,7 +421,6 @@ int32 feat_s2mfc2feat_live(feat_t *fcb, /**< In: Descriptor from feat_init( * Update the normalization stats, possibly in the end of utterance * */ -SPHINXBASE_EXPORT void feat_update_stats(feat_t *fcb); @@ -442,7 +429,6 @@ void feat_update_stats(feat_t *fcb); * * @return pointer to retained feat_t. */ -SPHINXBASE_EXPORT feat_t *feat_retain(feat_t *f); /** @@ -450,14 +436,12 @@ feat_t *feat_retain(feat_t *f); * * @return new reference count (0 if freed) */ -SPHINXBASE_EXPORT int feat_free(feat_t *f /**< In: feat_t */ ); /** * Report the feat_t data structure */ -SPHINXBASE_EXPORT void feat_report(feat_t *f /**< In: feat_t */ ); #ifdef __cplusplus diff --git a/src/fsg_history.h b/src/fsg_history.h index 64556624..171845fb 100644 --- a/src/fsg_history.h +++ b/src/fsg_history.h @@ -78,7 +78,7 @@ #include #include "lm/fsg_model.h" -#include "blkarray_list.h" +#include "util/blkarray_list.h" #include "fsg_lextree.h" #include "dict.h" diff --git a/src/hmm.c b/src/hmm.c index 0e3b8819..396282ca 100644 --- a/src/hmm.c +++ b/src/hmm.c @@ -44,8 +44,9 @@ #include #include +#include + #include "util/ckd_alloc.h" -#include "util/err.h" #include "hmm.h" hmm_context_t * diff --git a/src/lm/bitarr.h b/src/lm/bitarr.h index e0619e5d..2a55cab2 100644 --- a/src/lm/bitarr.h +++ b/src/lm/bitarr.h @@ -90,7 +90,6 @@ typedef struct bitarr_address_s { * @param mask of read value * @return uint64 value that was read */ -SPHINXBASE_EXPORT uint64 bitarr_read_int57(bitarr_address_t address, uint8 length, uint64 mask); /** @@ -101,7 +100,6 @@ uint64 bitarr_read_int57(bitarr_address_t address, uint8 length, uint64 mask); * @param length amount of active bytes in value to write * @param value integer to write */ -SPHINXBASE_EXPORT void bitarr_write_int57(bitarr_address_t address, uint8 length, uint64 value); /** @@ -112,7 +110,6 @@ void bitarr_write_int57(bitarr_address_t address, uint8 length, uint64 value); * @param mask of read value * @return uint32 value that was read */ -SPHINXBASE_EXPORT uint32 bitarr_read_int25(bitarr_address_t address, uint8 length, uint32 mask); /** @@ -123,7 +120,6 @@ uint32 bitarr_read_int25(bitarr_address_t address, uint8 length, uint32 mask); * @param length amount of active bytes in value to write * @param value integer to write */ -SPHINXBASE_EXPORT void bitarr_write_int25(bitarr_address_t address, uint8 length, uint32 value); /** @@ -131,7 +127,6 @@ void bitarr_write_int25(bitarr_address_t address, uint8 length, uint32 value); * @param bit_mask mask that is filled * @param max_value bigest integer that is going to be stored using this mask */ -SPHINXBASE_EXPORT void bitarr_mask_from_max(bitarr_mask_t *bit_mask, uint32 max_value); /** @@ -139,7 +134,6 @@ void bitarr_mask_from_max(bitarr_mask_t *bit_mask, uint32 max_value); * @param max_value bigest integer that going to be stored using this amount of bits * @return amount of bits required to store integers from range with maximum provided */ -SPHINXBASE_EXPORT uint8 bitarr_required_bits(uint32 max_value); #ifdef __cplusplus diff --git a/src/lm/jsgf.c b/src/lm/jsgf.c index 679b84ac..207818d6 100644 --- a/src/lm/jsgf.c +++ b/src/lm/jsgf.c @@ -45,10 +45,10 @@ #include "util/hash_table.h" #include "util/filename.h" -#include "fe/jsgf.h" -#include "fe/jsgf_internal.h" -#include "fe/jsgf_parser.h" -#include "fe/jsgf_scanner.h" +#include "lm/jsgf.h" +#include "lm/jsgf_internal.h" +#include "lm/jsgf_parser.h" +#include "lm/jsgf_scanner.h" extern int yyparse(void *scanner, jsgf_t * jsgf); @@ -872,7 +872,6 @@ jsgf_set_search_path(jsgf_t * jsgf, const char *filename) #if !defined(_WIN32_WCE) if ((jsgf_path = getenv("JSGF_PATH")) != NULL) { char *word, *c; - /* FIXME: This should be a function in libsphinxbase. */ word = jsgf_path = ckd_salloc(jsgf_path); while ((c = strchr(word, ':'))) { *c = '\0'; diff --git a/src/lm/jsgf_internal.h b/src/lm/jsgf_internal.h index 738c293c..bd6cdb74 100644 --- a/src/lm/jsgf_internal.h +++ b/src/lm/jsgf_internal.h @@ -44,9 +44,10 @@ #include +#include + #include "util/hash_table.h" #include "util/glist.h" -#include "util/logmath.h" #include "util/strfuncs.h" #include "lm/fsg_model.h" diff --git a/src/lm/lm_trie.h b/src/lm/lm_trie.h index 0d56fc8c..e6e9e37e 100644 --- a/src/lm/lm_trie.h +++ b/src/lm/lm_trie.h @@ -39,10 +39,9 @@ #define __LM_TRIE_H__ #include "util/pio.h" -#include "util/bitarr.h" - -#include "ngram_model_internal.h" -#include "lm_trie_quant.h" +#include "lm/bitarr.h" +#include "lm/ngram_model_internal.h" +#include "lm/lm_trie_quant.h" typedef struct unigram_s { float prob; diff --git a/src/lm/lm_trie_quant.h b/src/lm/lm_trie_quant.h index 3b7f66cf..b2bc6c90 100644 --- a/src/lm/lm_trie_quant.h +++ b/src/lm/lm_trie_quant.h @@ -37,7 +37,7 @@ #ifndef __LM_TRIE_QUANT_H__ #define __LM_TRIE_QUANT_H__ -#include "util/bitarr.h" +#include "lm/bitarr.h" #include "lm/ngrams_raw.h" #ifdef HAVE_CONFIG_H diff --git a/src/mdef.c b/src/mdef.c index 5eae742f..22a1effa 100644 --- a/src/mdef.c +++ b/src/mdef.c @@ -87,6 +87,8 @@ #include #include +#include + #include "util/ckd_alloc.h" #include "mdef.h" diff --git a/src/rtc_base/checks.h b/src/rtc_base/checks.h index ea8e7824..33bf969a 100644 --- a/src/rtc_base/checks.h +++ b/src/rtc_base/checks.h @@ -37,7 +37,7 @@ RTC_NORETURN void rtc_FatalMessage(const char* file, int line, const char* msg); #ifdef __cplusplus } // extern "C" #endif */ -#include +#include #define rtc_FatalMessage(file, line, msg) E_FATAL(msg) #ifdef RTC_DISABLE_CHECK_MSG diff --git a/src/tmat.c b/src/tmat.c index 18482e42..a71014c5 100644 --- a/src/tmat.c +++ b/src/tmat.c @@ -41,9 +41,10 @@ #include "util/ckd_alloc.h" #include "util/bio.h" +#include "util/vector.h" + #include "tmat.h" #include "hmm.h" -#include "vector.h" #define TMAT_PARAM_VERSION "1.0" diff --git a/src/util/bio.c b/src/util/bio.c index 94e3630b..84632a64 100644 --- a/src/util/bio.c +++ b/src/util/bio.c @@ -68,8 +68,9 @@ #pragma warning (disable: 4996) #endif +#include + #include "util/bio.h" -#include "util/err.h" #include "util/ckd_alloc.h" diff --git a/src/util/blas_lite.c b/src/util/blas_lite.c index f730ec2d..f930b91b 100644 --- a/src/util/blas_lite.c +++ b/src/util/blas_lite.c @@ -2,7 +2,7 @@ NOTE: This is generated code. Look in README.python for information on remaking this file. */ -#include "sphinxbase/f2c.h" +#include "util/f2c.h" #ifdef HAVE_CONFIG #include "config.h" diff --git a/src/util/cmd_ln.h b/src/util/cmd_ln.h index 60cbb55c..eadf6e21 100644 --- a/src/util/cmd_ln.h +++ b/src/util/cmd_ln.h @@ -61,7 +61,7 @@ #include #include -#include +#include #include "util/hash_table.h" @@ -81,17 +81,6 @@ extern "C" { } #endif -/** - * @struct arg_t - * Argument definition structure. - */ -typedef struct arg_s { - char const *name; /**< Name of the command line switch */ - int type; /**< Type of the argument in question */ - char const *deflt; /**< Default value (as a character string), or NULL if none */ - char const *doc; /**< Documentation/description string */ -} arg_t; - /** * @struct cmd_ln_val_t * Configuration parameter structure. @@ -420,6 +409,8 @@ void cmd_ln_log_help_r (cmd_ln_t *cmdln, const arg_t *defn); */ void cmd_ln_log_values_r (cmd_ln_t *cmdln, const arg_t *defn); +cmd_ln_val_t * cmd_ln_val_init(int t, const char *name, const char *str); +void cmd_ln_val_free(cmd_ln_val_t *val); #ifdef __cplusplus } diff --git a/src/util/listelem_alloc.c b/src/util/listelem_alloc.c index 344b978d..ec6a4348 100644 --- a/src/util/listelem_alloc.c +++ b/src/util/listelem_alloc.c @@ -38,7 +38,8 @@ #include #include -#include "util/err.h" +#include + #include "util/ckd_alloc.h" #include "util/listelem_alloc.h" #include "util/glist.h" diff --git a/src/util/matrix.h b/src/util/matrix.h index 19f3ddda..b80ac000 100644 --- a/src/util/matrix.h +++ b/src/util/matrix.h @@ -74,7 +74,7 @@ extern "C" { * @param d2 dimension * @param d3 dimension **/ -SPHINXBASE_EXPORT void norm_3d(float32 ***arr, uint32 d1, uint32 d2, uint32 d3); +void norm_3d(float32 ***arr, uint32 d1, uint32 d2, uint32 d3); /** * Floor 3-d array @@ -84,15 +84,14 @@ SPHINXBASE_EXPORT void norm_3d(float32 ***arr, uint32 d1, uint32 d2, uint32 d3); * @param d2 dimension * @param d3 dimension **/ -SPHINXBASE_EXPORT void -accum_3d(float32 ***out, float32 ***in, uint32 d1, uint32 d2, uint32 d3); +void accum_3d(float32 ***out, float32 ***in, uint32 d1, uint32 d2, uint32 d3); /** Ensures that non-zero values x such that -band < x < band, band > 0 are set to -band if x < 0 and band if x > 0. * @param v array * @param d1 array size * @param band band value */ -SPHINXBASE_EXPORT void band_nz_1d(float32 *v, uint32 d1, float32 band); +void band_nz_1d(float32 *v, uint32 d1, float32 band); /** * Floor 3-d array @@ -102,7 +101,7 @@ SPHINXBASE_EXPORT void band_nz_1d(float32 *v, uint32 d1, float32 band); * @param d3 dimension * @param floor floor value **/ -SPHINXBASE_EXPORT void floor_nz_3d(float32 ***m, uint32 d1, uint32 d2, uint32 d3, float32 floor); +void floor_nz_3d(float32 ***m, uint32 d1, uint32 d2, uint32 d3, float32 floor); /** * Floor 1-d array @@ -110,7 +109,7 @@ SPHINXBASE_EXPORT void floor_nz_3d(float32 ***m, uint32 d1, uint32 d2, uint32 d3 * @param d1 dimension * @param floor floor value **/ -SPHINXBASE_EXPORT void floor_nz_1d(float32 *v, uint32 d1, float32 floor); +void floor_nz_1d(float32 *v, uint32 d1, float32 floor); /** * Calculate the determinant of a positive definite matrix.