Skip to content

Commit fdfa5f2

Browse files
committed
pre-commit autoupdate 2024-12-11
1 parent df323e7 commit fdfa5f2

File tree

8 files changed

+73
-91
lines changed

8 files changed

+73
-91
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v3.2.0
5+
rev: v5.0.0
66
hooks:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
@@ -17,12 +17,12 @@ repos:
1717
hooks:
1818
- id: mypy
1919
- repo: https://github.com/PyCQA/isort
20-
rev: 5.11.4
20+
rev: 5.13.2
2121
hooks:
2222
- id: isort
2323
args: [--profile=black]
2424
- repo: https://github.com/pre-commit/mirrors-clang-format
25-
rev: v15.0.7
25+
rev: v19.1.5
2626
hooks:
2727
- id: clang-format
2828
types_or: [c++, c]

include/soundswallower/bitvec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ bitvec_t *bitvec_realloc(bitvec_t *vec, /* In: Bit vector to search */
9696
* @param n is the number of bits
9797
*/
9898

99-
#define bitvec_set_all(v, n) memset(v, (bitvec_t)-1, \
99+
#define bitvec_set_all(v, n) memset(v, (bitvec_t) - 1, \
100100
(((n) + BITVEC_BITS - 1) / BITVEC_BITS) * sizeof(bitvec_t))
101101
/**
102102
* Clear the b-th bit of bit vector v

include/soundswallower/config_defs.h

Lines changed: 50 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,15 @@
6464
DEBUG_OPTIONS
6565

6666
/** Options for debugging and logging. */
67-
#define DEBUG_OPTIONS \
68-
{ "logfn", \
69-
ARG_STRING, \
70-
NULL, \
71-
"File to write log messages in" }, \
72-
{ \
73-
"loglevel", \
74-
ARG_STRING, \
75-
"WARN", \
76-
"Minimum level of log messages (DEBUG, INFO, WARN, ERROR)" \
77-
}
67+
#define DEBUG_OPTIONS \
68+
{ "logfn", \
69+
ARG_STRING, \
70+
NULL, \
71+
"File to write log messages in" }, \
72+
{ "loglevel", \
73+
ARG_STRING, \
74+
"WARN", \
75+
"Minimum level of log messages (DEBUG, INFO, WARN, ERROR)" }
7876

7977
/** Options defining beam width parameters for tuning the search. */
8078
#define BEAM_OPTIONS \
@@ -86,12 +84,10 @@
8684
ARG_FLOATING, \
8785
"7e-29", \
8886
"Beam width applied to word exits" }, \
89-
{ \
90-
"pbeam", \
91-
ARG_FLOATING, \
92-
"1e-48", \
93-
"Beam width applied to phone transitions" \
94-
}
87+
{ "pbeam", \
88+
ARG_FLOATING, \
89+
"1e-48", \
90+
"Beam width applied to phone transitions" }
9591

9692
/** Options defining other parameters for tuning the search. */
9793
#define SEARCH_OPTIONS \
@@ -107,12 +103,10 @@
107103
ARG_BOOLEAN, \
108104
"no", \
109105
"Print results and backtraces to log." }, \
110-
{ \
111-
"maxhmmpf", \
112-
ARG_INTEGER, \
113-
"30000", \
114-
"Maximum number of active HMMs to maintain at each frame (or -1 for no pruning)" \
115-
}
106+
{ "maxhmmpf", \
107+
ARG_INTEGER, \
108+
"30000", \
109+
"Maximum number of active HMMs to maintain at each frame (or -1 for no pruning)" }
116110

117111
/** Command-line options for finite state grammars. */
118112
#define FSG_OPTIONS \
@@ -132,12 +126,10 @@
132126
ARG_BOOLEAN, \
133127
"yes", \
134128
"Add alternate pronunciations to FSG" }, \
135-
{ \
136-
"fsgusefiller", \
137-
ARG_BOOLEAN, \
138-
"yes", \
139-
"Insert filler words at each state." \
140-
}
129+
{ "fsgusefiller", \
130+
ARG_BOOLEAN, \
131+
"yes", \
132+
"Insert filler words at each state." }
141133

142134
/** Command-line options for statistical language models (not used) and grammars. */
143135
#define NGRAM_OPTIONS \
@@ -161,29 +153,25 @@
161153
ARG_FLOATING, \
162154
"0.005", \
163155
"Silence word transition probability" }, \
164-
{ \
165-
"fillprob", \
166-
ARG_FLOATING, \
167-
"1e-8", \
168-
"Filler word transition probability" \
169-
}
156+
{ "fillprob", \
157+
ARG_FLOATING, \
158+
"1e-8", \
159+
"Filler word transition probability" }
170160

171161
/** Command-line options for dictionaries. */
172-
#define DICT_OPTIONS \
173-
{ "dict", \
174-
ARG_STRING, \
175-
NULL, \
176-
"Main pronunciation dictionary (lexicon) input file" }, \
177-
{ "fdict", \
178-
ARG_STRING, \
179-
NULL, \
180-
"Noise word pronunciation dictionary input file" }, \
181-
{ \
182-
"dictcase", \
183-
ARG_BOOLEAN, \
184-
"no", \
185-
"Dictionary is case sensitive (NOTE: case insensitivity applies to ASCII characters only)" \
186-
}
162+
#define DICT_OPTIONS \
163+
{ "dict", \
164+
ARG_STRING, \
165+
NULL, \
166+
"Main pronunciation dictionary (lexicon) input file" }, \
167+
{ "fdict", \
168+
ARG_STRING, \
169+
NULL, \
170+
"Noise word pronunciation dictionary input file" }, \
171+
{ "dictcase", \
172+
ARG_BOOLEAN, \
173+
"no", \
174+
"Dictionary is case sensitive (NOTE: case insensitivity applies to ASCII characters only)" }
187175

188176
/** Command-line options for acoustic modeling */
189177
#define ACMOD_OPTIONS \
@@ -263,12 +251,10 @@
263251
ARG_FLOATING, \
264252
"1.0001", \
265253
"Base in which all log-likelihoods calculated" }, \
266-
{ \
267-
"cionly", \
268-
ARG_BOOLEAN, \
269-
"no", \
270-
"Use only context-independent phones (faster, useful for alignment)" \
271-
}
254+
{ "cionly", \
255+
ARG_BOOLEAN, \
256+
"no", \
257+
"Use only context-independent phones (faster, useful for alignment)" }
272258

273259
#if WORDS_BIGENDIAN
274260
#define NATIVE_ENDIAN "big"
@@ -424,12 +410,10 @@
424410
ARG_BOOLEAN, \
425411
"no", \
426412
"Remove noise using spectral subtraction" }, \
427-
{ \
428-
"verbose", \
429-
ARG_BOOLEAN, \
430-
"no", \
431-
"Show input filenames" \
432-
}
413+
{ "verbose", \
414+
ARG_BOOLEAN, \
415+
"no", \
416+
"Show input filenames" }
433417

434418
#define FEAT_OPTIONS \
435419
{ "feat", \
@@ -460,12 +444,10 @@
460444
ARG_INTEGER, \
461445
"0", \
462446
"Dimensionality of output of feature transformation (0 to use entire matrix)" }, \
463-
{ \
464-
"svspec", \
465-
ARG_STRING, \
466-
NULL, \
467-
"Subvector specification (e.g., 24,0-11/25,12-23/26-38 or 0-12/13-25/26-38)" \
468-
}
447+
{ "svspec", \
448+
ARG_STRING, \
449+
NULL, \
450+
"Subvector specification (e.g., 24,0-11/25,12-23/26-38 or 0-12/13-25/26-38)" }
469451

470452
#define CONFIG_EMPTY_OPTION \
471453
{ \

include/soundswallower/fsg_lextree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ typedef struct fsg_pnode_s {
149149
#define fsg_pnode_leaf(p) ((p)->leaf)
150150
#define fsg_pnode_ctxt(p) ((p)->ctxt)
151151

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

154154
/*
155155
* The following is macroized because its called very frequently

include/soundswallower/s3types.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ extern "C" {
6464
*/
6565

6666
typedef int16 s3cipid_t; /** Ci phone id */
67-
#define BAD_S3CIPID ((s3cipid_t)-1)
67+
#define BAD_S3CIPID ((s3cipid_t) - 1)
6868
#define NOT_S3CIPID(p) ((p) < 0)
6969
#define IS_S3CIPID(p) ((p) >= 0)
7070
#define MAX_S3CIPID 32767
7171

7272
/*#define MAX_S3CIPID 127*/
7373

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

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

9292
typedef int32 s3wid_t; /** Dictionary word id */
93-
#define BAD_S3WID ((s3wid_t)-1)
93+
#define BAD_S3WID ((s3wid_t) - 1)
9494
#define NOT_S3WID(w) ((w) < 0)
9595
#define IS_S3WID(w) ((w) >= 0)
9696
#define MAX_S3WID ((int32)0x7ffffffe)

src/hmm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ hmm_normalize(hmm_t *h, int32 bestscr)
160160
hmm_out_score(h) -= bestscr;
161161
}
162162

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

166166
static int32
@@ -477,7 +477,7 @@ hmm_vit_eval_5st_lr_mpx(hmm_t *hmm)
477477
return bestScore;
478478
}
479479

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

482482
static int32
483483
hmm_vit_eval_3st_lr(hmm_t *hmm)

src/ptm_mgau.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ static mgaufuncs_t ptm_mgau_funcs = {
6363
#define COMPUTE_GMM_MAP(_idx) \
6464
diff[_idx] = obs[_idx] - mean[_idx]; \
6565
sqdiff[_idx] = MFCCMUL(diff[_idx], diff[_idx]); \
66-
compl [_idx] = MFCCMUL(sqdiff[_idx], var[_idx]);
66+
compl[_idx] = MFCCMUL(sqdiff[_idx], var[_idx]);
6767
#define COMPUTE_GMM_REDUCE(_idx) \
68-
d = GMMSUB(d, compl [_idx]);
68+
d = GMMSUB(d, compl[_idx]);
6969

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

9595
for (i = 0; i < s->max_topn; i++) {
96-
mfcc_t *mean, diff[4], sqdiff[4], compl [4]; /* diff, diff^2, component likelihood */
96+
mfcc_t *mean, diff[4], sqdiff[4], compl[4]; /* diff, diff^2, component likelihood */
9797
mfcc_t *var, d;
9898
mfcc_t *obs;
9999
int32 cw, j;
@@ -106,8 +106,8 @@ eval_topn(ptm_mgau_t *s, int cb, int feat, mfcc_t *z)
106106
for (j = 0; j < ceplen % 4; ++j) {
107107
diff[0] = *obs++ - *mean++;
108108
sqdiff[0] = MFCCMUL(diff[0], diff[0]);
109-
compl [0] = MFCCMUL(sqdiff[0], *var);
110-
d = GMMSUB(d, compl [0]);
109+
compl[0] = MFCCMUL(sqdiff[0], *var);
110+
d = GMMSUB(d, compl[0]);
111111
++var;
112112
}
113113
/* We could vectorize this but it's unlikely to make much
@@ -164,7 +164,7 @@ eval_cb(ptm_mgau_t *s, int cb, int feat, mfcc_t *z)
164164
ceplen = s->g->featlen[feat];
165165

166166
for (detP = det; detP < detE; ++detP) {
167-
mfcc_t diff[4], sqdiff[4], compl [4]; /* diff, diff^2, component likelihood */
167+
mfcc_t diff[4], sqdiff[4], compl[4]; /* diff, diff^2, component likelihood */
168168
mfcc_t d, thresh;
169169
mfcc_t *obs;
170170
ptm_topn_t *cur;
@@ -181,8 +181,8 @@ eval_cb(ptm_mgau_t *s, int cb, int feat, mfcc_t *z)
181181
for (j = 0; (j < ceplen % 4) && (d >= thresh); ++j) {
182182
diff[0] = *obs++ - *mean++;
183183
sqdiff[0] = MFCCMUL(diff[0], diff[0]);
184-
compl [0] = MFCCMUL(sqdiff[0], *var++);
185-
d = GMMSUB(d, compl [0]);
184+
compl[0] = MFCCMUL(sqdiff[0], *var++);
185+
d = GMMSUB(d, compl[0]);
186186
}
187187
/* Now do 4 dimensions at a time. You'd think that GCC would
188188
* vectorize this? Apparently not. And it's right, because

src/s2_semi_mgau.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ eval_topn(s2_semi_mgau_t *s, int32 feat, mfcc_t *z)
7575
ceplen = s->g->featlen[feat];
7676

7777
for (i = 0; i < s->max_topn; i++) {
78-
mfcc_t *mean, diff, sqdiff, compl ; /* diff, diff^2, component likelihood */
78+
mfcc_t *mean, diff, sqdiff, compl; /* diff, diff^2, component likelihood */
7979
vqFeature_t vtmp;
8080
mfcc_t *var, d;
8181
mfcc_t *obs;
@@ -90,7 +90,7 @@ eval_topn(s2_semi_mgau_t *s, int32 feat, mfcc_t *z)
9090
diff = *obs++ - *mean++;
9191
sqdiff = MFCCMUL(diff, diff);
9292
compl = MFCCMUL(sqdiff, *var);
93-
d = GMMSUB(d, compl );
93+
d = GMMSUB(d, compl);
9494
++var;
9595
}
9696
if (d < (mfcc_t)MAX_NEG_INT32) /* Redundant if FIXED_POINT */
@@ -124,7 +124,7 @@ eval_cb(s2_semi_mgau_t *s, int32 feat, mfcc_t *z)
124124
ceplen = s->g->featlen[feat];
125125

126126
for (detP = det; detP < detE; ++detP) {
127-
mfcc_t diff, sqdiff, compl ; /* diff, diff^2, component likelihood */
127+
mfcc_t diff, sqdiff, compl; /* diff, diff^2, component likelihood */
128128
mfcc_t d;
129129
mfcc_t *obs;
130130
vqFeature_t *cur;
@@ -137,7 +137,7 @@ eval_cb(s2_semi_mgau_t *s, int32 feat, mfcc_t *z)
137137
diff = *obs++ - *mean++;
138138
sqdiff = MFCCMUL(diff, diff);
139139
compl = MFCCMUL(sqdiff, *var);
140-
d = GMMSUB(d, compl );
140+
d = GMMSUB(d, compl);
141141
++var;
142142
}
143143
if (j < ceplen) {

0 commit comments

Comments
 (0)