From: fujishita t. <fjs...@us...> - 2017-02-02 05:25:53
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv23267 Modified Files: fft.cc fftr.cc ifft.cc levdur.cc lpc.cc lpc2par.cc mgc2sp.cc Log Message: fix code format Index: lpc2par.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc2par.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lpc2par.cc 13 Jan 2017 03:19:10 -0000 1.1 --- lpc2par.cc 2 Feb 2017 05:25:50 -0000 1.2 *************** *** 63,66 **** --- 63,67 ---- const int kDefaultNumOrder(25); const double kDefaultGamma(1.0); + const int kDefaultBehaviorForUnstableCoefficient(kIgnore); void PrintUsage(std::ostream* stream) { *************** *** 75,79 **** *stream << " -g g : gamma of generalized cepstrum [" << kDefaultGamma << "]" << std::endl; // NOLINT *stream << " -c c : gamma of generalized cepstrum = -1 / (int) c" << std::endl; // NOLINT ! *stream << " -e e : check whether the derived PARCOR [0]" << std::endl; // NOLINT *stream << " coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 76,80 ---- *stream << " -g g : gamma of generalized cepstrum [" << kDefaultGamma << "]" << std::endl; // NOLINT *stream << " -c c : gamma of generalized cepstrum = -1 / (int) c" << std::endl; // NOLINT ! *stream << " -e e : check whether the derived PARCOR [" << kDefaultBehaviorForUnstableCoefficient << "]" << std::endl; // NOLINT *stream << " coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; *************** *** 101,105 **** int num_order(kDefaultNumOrder); double gamma(kDefaultGamma); ! BehaviorForUnstableCoefficients behavior(kIgnore); for (;;) { --- 102,108 ---- int num_order(kDefaultNumOrder); double gamma(kDefaultGamma); ! BehaviorForUnstableCoefficients behavior( ! static_cast<BehaviorForUnstableCoefficients>( ! kDefaultBehaviorForUnstableCoefficient)); for (;;) { *************** *** 141,162 **** } case 'e': { - int tmp; - if (!sptk::ConvertStringToInteger(optarg, &tmp)) { - std::ostringstream error_message; - error_message << "The argument for the -e option must be an integer"; - sptk::PrintErrorMessage("lpc2par", error_message); - return 1; - } - const int min(0); const int max(static_cast<int>(kNumKindsOfBehavior) - 1); ! if (!sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be in range" ! << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("lpc2par", error_message); return 1; } - behavior = static_cast<BehaviorForUnstableCoefficients>(tmp); break; --- 144,158 ---- } case 'e': { const int min(0); const int max(static_cast<int>(kNumKindsOfBehavior) - 1); ! int tmp; ! if (!sptk::ConvertStringToInteger(optarg, &tmp) || ! !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be an integer " ! << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("lpc2par", error_message); return 1; } behavior = static_cast<BehaviorForUnstableCoefficients>(tmp); break; Index: fft.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fft.cc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** fft.cc 22 Dec 2016 16:09:07 -0000 1.10 --- fft.cc 2 Feb 2017 05:25:50 -0000 1.11 *************** *** 65,68 **** --- 65,69 ---- const int kDefaultFftSize(256); + const int kDefaultOutputFormat(kOutputRealAndImaginaryParts); void PrintUsage(std::ostream* stream) { *************** *** 76,80 **** *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT *stream << " -m m : order of sequence [l-1]" << std::endl; ! *stream << " -o o : output format [0]" << std::endl; *stream << " 0 (real and imaginary parts)" << std::endl; *stream << " 1 (real part)" << std::endl; --- 77,81 ---- *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT *stream << " -m m : order of sequence [l-1]" << std::endl; ! *stream << " -o o : output format [" << kDefaultOutputFormat << "]" << std::endl; // NOLINT *stream << " 0 (real and imaginary parts)" << std::endl; *stream << " 1 (real part)" << std::endl; *************** *** 99,103 **** int num_order(kDefaultFftSize - 1); bool is_num_order_specified(false); ! OutputFormats output_format(kOutputRealAndImaginaryParts); for (;;) { --- 100,104 ---- int num_order(kDefaultFftSize - 1); bool is_num_order_specified(false); ! OutputFormats output_format(static_cast<OutputFormats>(kDefaultOutputFormat)); for (;;) { *************** *** 128,150 **** } case 'o': { - int given_integer(-1); - if (!sptk::ConvertStringToInteger(optarg, &given_integer)) { - std::ostringstream error_message; - error_message << "The argument for the -o option must be an integer"; - sptk::PrintErrorMessage("fft", error_message); - return 1; - } - const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! if (!sptk::IsInRange(given_integer, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be in range" ! << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("fft", error_message); return 1; } ! ! output_format = static_cast<OutputFormats>(given_integer); break; } --- 129,144 ---- } case 'o': { const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! int tmp; ! if (!sptk::ConvertStringToInteger(optarg, &tmp) || ! !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be an integer " ! << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("fft", error_message); return 1; } ! output_format = static_cast<OutputFormats>(tmp); break; } Index: lpc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** lpc.cc 14 Jan 2017 08:05:53 -0000 1.6 --- lpc.cc 2 Feb 2017 05:25:50 -0000 1.7 *************** *** 65,68 **** --- 65,69 ---- const int kDefaultNumOrder(25); const double kDefaultEpsilon(1.0e-6); + const int kDefaultBehaviorForUnstableCoefficient(kIgnore); void PrintUsage(std::ostream* stream) { *************** *** 78,82 **** *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [0]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 79,83 ---- *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [" << kDefaultBehaviorForUnstableCoefficient << "]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; *************** *** 103,107 **** int num_order(kDefaultNumOrder); double epsilon(kDefaultEpsilon); ! BehaviorForUnstableCoefficients behavior(kIgnore); for (;;) { --- 104,110 ---- int num_order(kDefaultNumOrder); double epsilon(kDefaultEpsilon); ! BehaviorForUnstableCoefficients behavior( ! static_cast<BehaviorForUnstableCoefficients>( ! kDefaultBehaviorForUnstableCoefficient)); for (;;) { *************** *** 143,165 **** } case 'e': { - int given_integer(-1); - if (!sptk::ConvertStringToInteger(optarg, &given_integer)) { - std::ostringstream error_message; - error_message << "The argument for the -e option must be an integer"; - sptk::PrintErrorMessage("lpc", error_message); - return 1; - } - const int min(0); const int max(static_cast<int>(kNumKindsOfBehavior) - 1); ! if (!sptk::IsInRange(given_integer, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be in range" ! << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("lpc", error_message); return 1; } ! ! behavior = static_cast<BehaviorForUnstableCoefficients>(given_integer); break; } --- 146,161 ---- } case 'e': { const int min(0); const int max(static_cast<int>(kNumKindsOfBehavior) - 1); ! int tmp; ! if (!sptk::ConvertStringToInteger(optarg, &tmp) || ! !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be an integer " ! << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("lpc", error_message); return 1; } ! behavior = static_cast<BehaviorForUnstableCoefficients>(tmp); break; } Index: ifft.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ifft.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ifft.cc 22 Dec 2016 16:09:07 -0000 1.6 --- ifft.cc 2 Feb 2017 05:25:50 -0000 1.7 *************** *** 62,65 **** --- 62,66 ---- const int kDefaultFftSize(256); + const int kDefaultOutputFormat(kOutputRealAndImaginaryParts); void PrintUsage(std::ostream* stream) { *************** *** 72,76 **** *stream << " options:" << std::endl; *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT ! *stream << " -o o : output format [0]" << std::endl; *stream << " 0 (real and imaginary parts)" << std::endl; *stream << " 1 (real part)" << std::endl; --- 73,77 ---- *stream << " options:" << std::endl; *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT ! *stream << " -o o : output format [" << kDefaultOutputFormat << "]" << std::endl; // NOLINT *stream << " 0 (real and imaginary parts)" << std::endl; *stream << " 1 (real part)" << std::endl; *************** *** 91,95 **** int main(int argc, char* argv[]) { int fft_size(kDefaultFftSize); ! OutputFormats output_format(kOutputRealAndImaginaryParts); for (;;) { --- 92,96 ---- int main(int argc, char* argv[]) { int fft_size(kDefaultFftSize); ! OutputFormats output_format(static_cast<OutputFormats>(kDefaultOutputFormat)); for (;;) { *************** *** 108,130 **** } case 'o': { - int given_integer(-1); - if (!sptk::ConvertStringToInteger(optarg, &given_integer)) { - std::ostringstream error_message; - error_message << "The argument for the -o option must be an integer"; - sptk::PrintErrorMessage("ifft", error_message); - return 1; - } - const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! if (!sptk::IsInRange(given_integer, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be in range" ! << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("ifft", error_message); return 1; } ! ! output_format = static_cast<OutputFormats>(given_integer); break; } --- 109,124 ---- } case 'o': { const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! int tmp; ! if (!sptk::ConvertStringToInteger(optarg, &tmp) || ! !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be an integer " ! << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("ifft", error_message); return 1; } ! output_format = static_cast<OutputFormats>(tmp); break; } Index: levdur.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/levdur.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** levdur.cc 13 Jan 2017 03:21:09 -0000 1.7 --- levdur.cc 2 Feb 2017 05:25:50 -0000 1.8 *************** *** 63,66 **** --- 63,67 ---- const int kDefaultNumOrder(25); const double kDefaultEpsilon(1.0e-6); + const int kDefaultBehaviorForUnstableCoefficient(kIgnore); void PrintUsage(std::ostream* stream) { *************** *** 76,80 **** *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [0]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 77,81 ---- *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [" << kDefaultBehaviorForUnstableCoefficient << "]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; *************** *** 100,104 **** int num_order(kDefaultNumOrder); double epsilon(kDefaultEpsilon); ! BehaviorForUnstableCoefficients behavior(kIgnore); for (;;) { --- 101,107 ---- int num_order(kDefaultNumOrder); double epsilon(kDefaultEpsilon); ! BehaviorForUnstableCoefficients behavior( ! static_cast<BehaviorForUnstableCoefficients>( ! kDefaultBehaviorForUnstableCoefficient)); for (;;) { *************** *** 129,151 **** } case 'e': { - int given_integer(-1); - if (!sptk::ConvertStringToInteger(optarg, &given_integer)) { - std::ostringstream error_message; - error_message << "The argument for the -e option must be an integer"; - sptk::PrintErrorMessage("levdur", error_message); - return 1; - } - const int min(0); const int max(static_cast<int>(kNumKindsOfBehavior) - 1); ! if (!sptk::IsInRange(given_integer, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be in range" ! << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("levdur", error_message); return 1; } ! ! behavior = static_cast<BehaviorForUnstableCoefficients>(given_integer); break; } --- 132,147 ---- } case 'e': { const int min(0); const int max(static_cast<int>(kNumKindsOfBehavior) - 1); ! int tmp; ! if (!sptk::ConvertStringToInteger(optarg, &tmp) || ! !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be an integer " ! << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("levdur", error_message); return 1; } ! behavior = static_cast<BehaviorForUnstableCoefficients>(tmp); break; } Index: fftr.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fftr.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** fftr.cc 13 Jan 2017 06:49:33 -0000 1.1 --- fftr.cc 2 Feb 2017 05:25:50 -0000 1.2 *************** *** 65,68 **** --- 65,69 ---- const int kDefaultFftSize(256); + const int kDefaultOutputFormat(kOutputRealAndImaginaryParts); const bool kDefaultHalfSizeOutputFlag(false); *************** *** 77,81 **** *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT *stream << " -m m : order of sequence [l-1]" << std::endl; ! *stream << " -o o : output format [0]" << std::endl; *stream << " 0 (real and imaginary parts)" << std::endl; *stream << " 1 (real part)" << std::endl; --- 78,82 ---- *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT *stream << " -m m : order of sequence [l-1]" << std::endl; ! *stream << " -o o : output format [" << kDefaultOutputFormat << "]" << std::endl; // NOLINT *stream << " 0 (real and imaginary parts)" << std::endl; *stream << " 1 (real part)" << std::endl; *************** *** 101,106 **** int num_order(kDefaultFftSize - 1); bool is_num_order_specified(false); bool half_size_output_flag(kDefaultHalfSizeOutputFlag); - OutputFormats output_format(kOutputRealAndImaginaryParts); for (;;) { --- 102,107 ---- int num_order(kDefaultFftSize - 1); bool is_num_order_specified(false); + OutputFormats output_format(static_cast<OutputFormats>(kDefaultOutputFormat)); bool half_size_output_flag(kDefaultHalfSizeOutputFlag); for (;;) { *************** *** 131,153 **** } case 'o': { - int given_integer(-1); - if (!sptk::ConvertStringToInteger(optarg, &given_integer)) { - std::ostringstream error_message; - error_message << "The argument for the -o option must be an integer"; - sptk::PrintErrorMessage("fftr", error_message); - return 1; - } - const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! if (!sptk::IsInRange(given_integer, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be in range" ! << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("fftr", error_message); return 1; } ! ! output_format = static_cast<OutputFormats>(given_integer); break; } --- 132,147 ---- } case 'o': { const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! int tmp; ! if (!sptk::ConvertStringToInteger(optarg, &tmp) || ! !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be an integer " ! << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("fftr", error_message); return 1; } ! output_format = static_cast<OutputFormats>(tmp); break; } Index: mgc2sp.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2sp.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mgc2sp.cc 26 Dec 2016 07:41:20 -0000 1.1 --- mgc2sp.cc 2 Feb 2017 05:25:50 -0000 1.2 *************** *** 74,77 **** --- 74,78 ---- const bool kDefaultMultiplicationFlag(false); const int kDefaultFftSize(256); + const int kDefaultOutputFormat(kLogAmplitudeSpectrumInDecibels); void PrintUsage(std::ostream* stream) { *************** *** 91,95 **** *stream << " -u : regard input as multiplied by gamma [" << sptk::ConvertBooleanToString(kDefaultMultiplicationFlag) << "]" << std::endl; // NOLINT *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT ! *stream << " -o o : output format [0]" << std::endl; // NOLINT *stream << " 0 (20*log|H(z)|)" << std::endl; *stream << " 1 (ln|H(z)|)" << std::endl; --- 92,96 ---- *stream << " -u : regard input as multiplied by gamma [" << sptk::ConvertBooleanToString(kDefaultMultiplicationFlag) << "]" << std::endl; // NOLINT *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT ! *stream << " -o o : output format [" << kDefaultOutputFormat << "]" << std::endl; // NOLINT *stream << " 0 (20*log|H(z)|)" << std::endl; *stream << " 1 (ln|H(z)|)" << std::endl; *************** *** 122,126 **** bool multiplication_flag(kDefaultMultiplicationFlag); int fft_size(kDefaultFftSize); ! OutputFormats output_format(kLogAmplitudeSpectrumInDecibels); for (;;) { --- 123,127 ---- bool multiplication_flag(kDefaultMultiplicationFlag); int fft_size(kDefaultFftSize); ! OutputFormats output_format(static_cast<OutputFormats>(kDefaultOutputFormat)); for (;;) { *************** *** 188,205 **** } case 'o': { - int tmp; - if (!sptk::ConvertStringToInteger(optarg, &tmp)) { - std::ostringstream error_message; - error_message << "The argument for the -o option must be an integer"; - sptk::PrintErrorMessage("mgc2sp", error_message); - return 1; - } - const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! if (!sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be in range" ! << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; --- 189,200 ---- } case 'o': { const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! int tmp; ! if (!sptk::ConvertStringToInteger(optarg, &tmp) || ! !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be an integer " ! << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; |