diff --git a/include/SPTK/conversion/linear_predictive_coefficients_to_line_spectral_pairs.h b/include/SPTK/conversion/linear_predictive_coefficients_to_line_spectral_pairs.h index 2098f66..e268f23 100644 --- a/include/SPTK/conversion/linear_predictive_coefficients_to_line_spectral_pairs.h +++ b/include/SPTK/conversion/linear_predictive_coefficients_to_line_spectral_pairs.h @@ -68,7 +68,7 @@ class LinearPredictiveCoefficientsToLineSpectralPairs { /** * @param[in] num_order Order of coefficients, @f$M@f$. - * @param[in] num_split Number of splits of unit circle. + * @param[in] num_split Number of splits of unit circle quadrant. * @param[in] num_iteration Number of iterations. * @param[in] convergence_threshold Convergence threshold. */ diff --git a/src/conversion/linear_predictive_coefficients_to_line_spectral_pairs.cc b/src/conversion/linear_predictive_coefficients_to_line_spectral_pairs.cc index 99f4ac8..14c6730 100644 --- a/src/conversion/linear_predictive_coefficients_to_line_spectral_pairs.cc +++ b/src/conversion/linear_predictive_coefficients_to_line_spectral_pairs.cc @@ -51,7 +51,7 @@ LinearPredictiveCoefficientsToLineSpectralPairs:: num_iteration_(num_iteration), convergence_threshold_(convergence_threshold), is_valid_(true) { - if (num_order_ < 0 || num_split_ <= 0 || num_iteration_ <= 0 || + if (num_order_ < 0 || num_split_ <= 0 || num_iteration_ < 0 || convergence_threshold_ < 0.0) { is_valid_ = false; return; @@ -123,9 +123,7 @@ bool LinearPredictiveCoefficientsToLineSpectralPairs::Run( // Search roots of polynomials. const double delta(1.0 / num_split_); - const double x_max(1.0 - delta); - const double x_min(-1.0 - delta); - for (double x(x_max); x_min < x; x -= delta) { + for (double x(1.0 - delta); -1.0 <= x; x -= delta) { double y(CalculateChebyshevPolynomial(*c, x)); if (y * y_prev <= 0.0) { diff --git a/src/main/lpc2lsp.cc b/src/main/lpc2lsp.cc index d93d1af..e168ade 100644 --- a/src/main/lpc2lsp.cc +++ b/src/main/lpc2lsp.cc @@ -73,7 +73,7 @@ void PrintUsage(std::ostream* stream) { *stream << " -h : print this message" << std::endl; *stream << " (level 2)" << std::endl; *stream << " -n n : number of splits of unit circle ( int)[" << std::setw(5) << std::right << kDefaultNumSplit << "][ 1 <= n <= ]" << std::endl; // NOLINT - *stream << " -i i : maximum number of iterations ( int)[" << std::setw(5) << std::right << kDefaultNumIteration << "][ 1 <= i <= ]" << std::endl; // NOLINT + *stream << " -i i : maximum number of iterations ( int)[" << std::setw(5) << std::right << kDefaultNumIteration << "][ 0 <= i <= ]" << std::endl; // NOLINT *stream << " -d d : convergence threshold (double)[" << std::setw(5) << std::right << kDefaultConvergenceThreshold << "][ 0.0 <= d <= ]" << std::endl; // NOLINT *stream << " infile:" << std::endl; *stream << " linear predictive coefficients (double)[stdin]" << std::endl; // NOLINT @@ -106,9 +106,9 @@ void PrintUsage(std::ostream* stream) { * \arg @c 2 frequency in kHz * \arg @c 3 frequency in Hz * - @b -n @e int - * - number of splits of unit circle @f$(1 \le S)@f$ + * - number of splits of unit circle quadrant @f$(1 \le S)@f$ * - @b -i @e int - * - maximum number of iterations @f$(1 \le N)@f$ + * - maximum number of iterations @f$(0 \le N)@f$ * - @b -d @e double * - convergence threshold @f$(0 \le \epsilon)@f$ * - @b infile @e str @@ -206,10 +206,10 @@ int main(int argc, char* argv[]) { } case 'i': { if (!sptk::ConvertStringToInteger(optarg, &num_iteration) || - num_iteration <= 0) { + num_iteration < 0) { std::ostringstream error_message; - error_message - << "The argument for the -i option must be a positive integer"; + error_message << "The argument for the -i option must be a " + << "non-negative integer"; sptk::PrintErrorMessage("lpc2lsp", error_message); return 1; } diff --git a/test/test_lpc2lsp.bats b/test/test_lpc2lsp.bats index 8e3c4e0..d1ffaa3 100755 --- a/test/test_lpc2lsp.bats +++ b/test/test_lpc2lsp.bats @@ -52,7 +52,7 @@ teardown() { @test "lpc2lsp: reversibility" { $sptk3/nrand -l 400 | $sptk3/lpc -l 400 -m 12 > $tmp/1 - $sptk4/lpc2lsp -m 12 $tmp/1 | $sptk4/lsp2lpc -m 12 > $tmp/2 + $sptk4/lpc2lsp -m 12 -i 4 $tmp/1 | $sptk4/lsp2lpc -m 12 > $tmp/2 run $sptk4/aeq $tmp/1 $tmp/2 [ "$status" -eq 0 ] }