From: Keiichiro O. <ur...@us...> - 2016-11-14 04:09:17
|
Update of /cvsroot/sp-tk/SPTK/src/bin/mlsacheck In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv23353 Modified Files: mlsacheck.c Log Message: small modification Index: mlsacheck.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/mlsacheck/mlsacheck.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** mlsacheck.c 24 Jun 2016 12:06:58 -0000 1.20 --- mlsacheck.c 14 Nov 2016 04:09:15 -0000 1.21 *************** *** 186,190 **** double mlsacheck(double *in, double *out, int m, int fftlen, ! double a, double r, int c) { int i; --- 186,190 ---- double mlsacheck(double *in, double *out, int m, int fftlen, ! double a, double r, int c) { int i; *************** *** 207,211 **** /* check stability */ ! if (c == 0 || c == 2 || c == 3) { /* usual mode */ mag = dgetmem(fftlen); fillz(mag, sizeof(*mag), fftlen); --- 207,211 ---- /* check stability */ ! if (c != 1 && c != 4) { /* usual mode */ mag = dgetmem(fftlen); fillz(mag, sizeof(*mag), fftlen); *************** *** 222,226 **** /* modify MLSA filter coefficients */ ! if (max > r) { if (c == 2) { /* clipping */ for (i = 0; i < fftlen; i++) { --- 222,228 ---- /* modify MLSA filter coefficients */ ! if (c == 0 || c == 1 || max <= r) { ! memcpy(out, in, sizeof(*out) * (m + 1)); ! } else { if (c == 2) { /* clipping */ for (i = 0; i < fftlen; i++) { *************** *** 230,233 **** --- 232,238 ---- } } + ifft(x, y, fftlen); + x[0] += gain; + memcpy(out, x, sizeof(*out) * (m + 1)); } else if (c == 3) { /* scaling */ for (i = 0; i < fftlen; i++) { *************** *** 235,258 **** y[i] *= r / max; } } else if (c == 4) { /* fast mode */ for (i = 0; i <= m; i++) x[i] *= r / max; } } - /* store MLSA filter coefficients */ - if (c == 0 || c == 1 || max <= r) { /* no modification */ - memcpy(out, in, sizeof(*out) * (m + 1)); - } else { - if (c == 2 || c == 3) - ifft(x, y, fftlen); - x[0] += gain; - memcpy(out, x, sizeof(*out) * (m + 1)); - } - free(x); free(y); ! if (c == 0 || c == 2 || c == 3) free(mag); return max; --- 240,259 ---- y[i] *= r / max; } + ifft(x, y, fftlen); + x[0] += gain; + memcpy(out, x, sizeof(*out) * (m + 1)); } else if (c == 4) { /* fast mode */ for (i = 0; i <= m; i++) x[i] *= r / max; + x[0] += gain; + memcpy(out, x, sizeof(*out) * (m + 1)); } } free(x); free(y); ! if (c != 1 && c != 4) { free(mag); + } return max; |