Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pre-commit autoupdate 2024-12-11 #70

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -17,12 +17,12 @@ repos:
hooks:
- id: mypy
- repo: https://github.com/PyCQA/isort
rev: 5.11.4
rev: 5.13.2
hooks:
- id: isort
args: [--profile=black]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.7
rev: v19.1.5
hooks:
- id: clang-format
types_or: [c++, c]
2 changes: 1 addition & 1 deletion include/soundswallower/bitvec.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ bitvec_t *bitvec_realloc(bitvec_t *vec, /* In: Bit vector to search */
* @param n is the number of bits
*/

#define bitvec_set_all(v, n) memset(v, (bitvec_t)-1, \
#define bitvec_set_all(v, n) memset(v, (bitvec_t) - 1, \
(((n) + BITVEC_BITS - 1) / BITVEC_BITS) * sizeof(bitvec_t))
/**
* Clear the b-th bit of bit vector v
Expand Down
118 changes: 50 additions & 68 deletions include/soundswallower/config_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,15 @@
DEBUG_OPTIONS

/** Options for debugging and logging. */
#define DEBUG_OPTIONS \
{ "logfn", \
ARG_STRING, \
NULL, \
"File to write log messages in" }, \
{ \
"loglevel", \
ARG_STRING, \
"WARN", \
"Minimum level of log messages (DEBUG, INFO, WARN, ERROR)" \
}
#define DEBUG_OPTIONS \
{ "logfn", \
ARG_STRING, \
NULL, \
"File to write log messages in" }, \
{ "loglevel", \
ARG_STRING, \
"WARN", \
"Minimum level of log messages (DEBUG, INFO, WARN, ERROR)" }

/** Options defining beam width parameters for tuning the search. */
#define BEAM_OPTIONS \
Expand All @@ -86,12 +84,10 @@
ARG_FLOATING, \
"7e-29", \
"Beam width applied to word exits" }, \
{ \
"pbeam", \
ARG_FLOATING, \
"1e-48", \
"Beam width applied to phone transitions" \
}
{ "pbeam", \
ARG_FLOATING, \
"1e-48", \
"Beam width applied to phone transitions" }

/** Options defining other parameters for tuning the search. */
#define SEARCH_OPTIONS \
Expand All @@ -107,12 +103,10 @@
ARG_BOOLEAN, \
"no", \
"Print results and backtraces to log." }, \
{ \
"maxhmmpf", \
ARG_INTEGER, \
"30000", \
"Maximum number of active HMMs to maintain at each frame (or -1 for no pruning)" \
}
{ "maxhmmpf", \
ARG_INTEGER, \
"30000", \
"Maximum number of active HMMs to maintain at each frame (or -1 for no pruning)" }

/** Command-line options for finite state grammars. */
#define FSG_OPTIONS \
Expand All @@ -132,12 +126,10 @@
ARG_BOOLEAN, \
"yes", \
"Add alternate pronunciations to FSG" }, \
{ \
"fsgusefiller", \
ARG_BOOLEAN, \
"yes", \
"Insert filler words at each state." \
}
{ "fsgusefiller", \
ARG_BOOLEAN, \
"yes", \
"Insert filler words at each state." }

/** Command-line options for statistical language models (not used) and grammars. */
#define NGRAM_OPTIONS \
Expand All @@ -161,29 +153,25 @@
ARG_FLOATING, \
"0.005", \
"Silence word transition probability" }, \
{ \
"fillprob", \
ARG_FLOATING, \
"1e-8", \
"Filler word transition probability" \
}
{ "fillprob", \
ARG_FLOATING, \
"1e-8", \
"Filler word transition probability" }

/** Command-line options for dictionaries. */
#define DICT_OPTIONS \
{ "dict", \
ARG_STRING, \
NULL, \
"Main pronunciation dictionary (lexicon) input file" }, \
{ "fdict", \
ARG_STRING, \
NULL, \
"Noise word pronunciation dictionary input file" }, \
{ \
"dictcase", \
ARG_BOOLEAN, \
"no", \
"Dictionary is case sensitive (NOTE: case insensitivity applies to ASCII characters only)" \
}
#define DICT_OPTIONS \
{ "dict", \
ARG_STRING, \
NULL, \
"Main pronunciation dictionary (lexicon) input file" }, \
{ "fdict", \
ARG_STRING, \
NULL, \
"Noise word pronunciation dictionary input file" }, \
{ "dictcase", \
ARG_BOOLEAN, \
"no", \
"Dictionary is case sensitive (NOTE: case insensitivity applies to ASCII characters only)" }

/** Command-line options for acoustic modeling */
#define ACMOD_OPTIONS \
Expand Down Expand Up @@ -263,12 +251,10 @@
ARG_FLOATING, \
"1.0001", \
"Base in which all log-likelihoods calculated" }, \
{ \
"cionly", \
ARG_BOOLEAN, \
"no", \
"Use only context-independent phones (faster, useful for alignment)" \
}
{ "cionly", \
ARG_BOOLEAN, \
"no", \
"Use only context-independent phones (faster, useful for alignment)" }

#if WORDS_BIGENDIAN
#define NATIVE_ENDIAN "big"
Expand Down Expand Up @@ -424,12 +410,10 @@
ARG_BOOLEAN, \
"no", \
"Remove noise using spectral subtraction" }, \
{ \
"verbose", \
ARG_BOOLEAN, \
"no", \
"Show input filenames" \
}
{ "verbose", \
ARG_BOOLEAN, \
"no", \
"Show input filenames" }

#define FEAT_OPTIONS \
{ "feat", \
Expand Down Expand Up @@ -460,12 +444,10 @@
ARG_INTEGER, \
"0", \
"Dimensionality of output of feature transformation (0 to use entire matrix)" }, \
{ \
"svspec", \
ARG_STRING, \
NULL, \
"Subvector specification (e.g., 24,0-11/25,12-23/26-38 or 0-12/13-25/26-38)" \
}
{ "svspec", \
ARG_STRING, \
NULL, \
"Subvector specification (e.g., 24,0-11/25,12-23/26-38 or 0-12/13-25/26-38)" }

#define CONFIG_EMPTY_OPTION \
{ \
Expand Down
2 changes: 1 addition & 1 deletion include/soundswallower/fsg_lextree.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ typedef struct fsg_pnode_s {
#define fsg_pnode_leaf(p) ((p)->leaf)
#define fsg_pnode_ctxt(p) ((p)->ctxt)

#define fsg_pnode_add_ctxt(p, c) ((p)->ctxt.bv[(c) >> 5] |= (1 << ((c)&0x001f)))
#define fsg_pnode_add_ctxt(p, c) ((p)->ctxt.bv[(c) >> 5] |= (1 << ((c) & 0x001f)))

/*
* The following is macroized because its called very frequently
Expand Down
8 changes: 4 additions & 4 deletions include/soundswallower/s3types.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ extern "C" {
*/

typedef int16 s3cipid_t; /** Ci phone id */
#define BAD_S3CIPID ((s3cipid_t)-1)
#define BAD_S3CIPID ((s3cipid_t) - 1)
#define NOT_S3CIPID(p) ((p) < 0)
#define IS_S3CIPID(p) ((p) >= 0)
#define MAX_S3CIPID 32767

/*#define MAX_S3CIPID 127*/

typedef int32 s3pid_t; /** Phone id (triphone or ciphone) */
#define BAD_S3PID ((s3pid_t)-1)
#define BAD_S3PID ((s3pid_t) - 1)
#define NOT_S3PID(p) ((p) < 0)
#define IS_S3PID(p) ((p) >= 0)
#define MAX_S3PID ((int32)0x7ffffffe)
Expand All @@ -84,13 +84,13 @@ typedef uint16 s3ssid_t; /** Senone sequence id (triphone or ciphone) */
#define MAX_S3SSID ((s3ssid_t)0xfffe)

typedef int32 s3tmatid_t; /** Transition matrix id; there can be as many as pids */
#define BAD_S3TMATID ((s3tmatid_t)-1)
#define BAD_S3TMATID ((s3tmatid_t) - 1)
#define NOT_S3TMATID(t) ((t) < 0)
#define IS_S3TMATID(t) ((t) >= 0)
#define MAX_S3TMATID ((int32)0x7ffffffe)

typedef int32 s3wid_t; /** Dictionary word id */
#define BAD_S3WID ((s3wid_t)-1)
#define BAD_S3WID ((s3wid_t) - 1)
#define NOT_S3WID(w) ((w) < 0)
#define IS_S3WID(w) ((w) >= 0)
#define MAX_S3WID ((int32)0x7ffffffe)
Expand Down
4 changes: 2 additions & 2 deletions src/hmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ hmm_normalize(hmm_t *h, int32 bestscr)
hmm_out_score(h) -= bestscr;
}

#define hmm_tprob_5st(i, j) (-tp[(i)*6 + (j)])
#define hmm_tprob_5st(i, j) (-tp[(i) * 6 + (j)])
#define nonmpx_senscr(i) (-senscore[sseq[i]])

static int32
Expand Down Expand Up @@ -477,7 +477,7 @@ hmm_vit_eval_5st_lr_mpx(hmm_t *hmm)
return bestScore;
}

#define hmm_tprob_3st(i, j) (-tp[(i)*4 + (j)])
#define hmm_tprob_3st(i, j) (-tp[(i) * 4 + (j)])

static int32
hmm_vit_eval_3st_lr(hmm_t *hmm)
Expand Down
16 changes: 8 additions & 8 deletions src/ptm_mgau.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ static mgaufuncs_t ptm_mgau_funcs = {
#define COMPUTE_GMM_MAP(_idx) \
diff[_idx] = obs[_idx] - mean[_idx]; \
sqdiff[_idx] = MFCCMUL(diff[_idx], diff[_idx]); \
compl [_idx] = MFCCMUL(sqdiff[_idx], var[_idx]);
compl[_idx] = MFCCMUL(sqdiff[_idx], var[_idx]);
#define COMPUTE_GMM_REDUCE(_idx) \
d = GMMSUB(d, compl [_idx]);
d = GMMSUB(d, compl[_idx]);

static void
insertion_sort_topn(ptm_topn_t *topn, int i, int32 d)
Expand Down Expand Up @@ -93,7 +93,7 @@ eval_topn(ptm_mgau_t *s, int cb, int feat, mfcc_t *z)
ceplen = s->g->featlen[feat];

for (i = 0; i < s->max_topn; i++) {
mfcc_t *mean, diff[4], sqdiff[4], compl [4]; /* diff, diff^2, component likelihood */
mfcc_t *mean, diff[4], sqdiff[4], compl[4]; /* diff, diff^2, component likelihood */
mfcc_t *var, d;
mfcc_t *obs;
int32 cw, j;
Expand All @@ -106,8 +106,8 @@ eval_topn(ptm_mgau_t *s, int cb, int feat, mfcc_t *z)
for (j = 0; j < ceplen % 4; ++j) {
diff[0] = *obs++ - *mean++;
sqdiff[0] = MFCCMUL(diff[0], diff[0]);
compl [0] = MFCCMUL(sqdiff[0], *var);
d = GMMSUB(d, compl [0]);
compl[0] = MFCCMUL(sqdiff[0], *var);
d = GMMSUB(d, compl[0]);
++var;
}
/* We could vectorize this but it's unlikely to make much
Expand Down Expand Up @@ -164,7 +164,7 @@ eval_cb(ptm_mgau_t *s, int cb, int feat, mfcc_t *z)
ceplen = s->g->featlen[feat];

for (detP = det; detP < detE; ++detP) {
mfcc_t diff[4], sqdiff[4], compl [4]; /* diff, diff^2, component likelihood */
mfcc_t diff[4], sqdiff[4], compl[4]; /* diff, diff^2, component likelihood */
mfcc_t d, thresh;
mfcc_t *obs;
ptm_topn_t *cur;
Expand All @@ -181,8 +181,8 @@ eval_cb(ptm_mgau_t *s, int cb, int feat, mfcc_t *z)
for (j = 0; (j < ceplen % 4) && (d >= thresh); ++j) {
diff[0] = *obs++ - *mean++;
sqdiff[0] = MFCCMUL(diff[0], diff[0]);
compl [0] = MFCCMUL(sqdiff[0], *var++);
d = GMMSUB(d, compl [0]);
compl[0] = MFCCMUL(sqdiff[0], *var++);
d = GMMSUB(d, compl[0]);
}
/* Now do 4 dimensions at a time. You'd think that GCC would
* vectorize this? Apparently not. And it's right, because
Expand Down
8 changes: 4 additions & 4 deletions src/s2_semi_mgau.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ eval_topn(s2_semi_mgau_t *s, int32 feat, mfcc_t *z)
ceplen = s->g->featlen[feat];

for (i = 0; i < s->max_topn; i++) {
mfcc_t *mean, diff, sqdiff, compl ; /* diff, diff^2, component likelihood */
mfcc_t *mean, diff, sqdiff, compl; /* diff, diff^2, component likelihood */
vqFeature_t vtmp;
mfcc_t *var, d;
mfcc_t *obs;
Expand All @@ -90,7 +90,7 @@ eval_topn(s2_semi_mgau_t *s, int32 feat, mfcc_t *z)
diff = *obs++ - *mean++;
sqdiff = MFCCMUL(diff, diff);
compl = MFCCMUL(sqdiff, *var);
d = GMMSUB(d, compl );
d = GMMSUB(d, compl);
++var;
}
if (d < (mfcc_t)MAX_NEG_INT32) /* Redundant if FIXED_POINT */
Expand Down Expand Up @@ -124,7 +124,7 @@ eval_cb(s2_semi_mgau_t *s, int32 feat, mfcc_t *z)
ceplen = s->g->featlen[feat];

for (detP = det; detP < detE; ++detP) {
mfcc_t diff, sqdiff, compl ; /* diff, diff^2, component likelihood */
mfcc_t diff, sqdiff, compl; /* diff, diff^2, component likelihood */
mfcc_t d;
mfcc_t *obs;
vqFeature_t *cur;
Expand All @@ -137,7 +137,7 @@ eval_cb(s2_semi_mgau_t *s, int32 feat, mfcc_t *z)
diff = *obs++ - *mean++;
sqdiff = MFCCMUL(diff, diff);
compl = MFCCMUL(sqdiff, *var);
d = GMMSUB(d, compl );
d = GMMSUB(d, compl);
++var;
}
if (j < ceplen) {
Expand Down
Loading