| DSP Blockset | ![]() |
Convert linear prediction coefficients (LPCs) to line spectral pairs (LSPs) or line spectral frequencies (LSFs)
Library
Estimation / Linear Prediction
Description
The LPC to LSF/LSP Conversion block takes a vector of linear prediction polynomial coefficients (LPCs) and converts it to a vector of line spectral pairs (LSPs) or line spectral frequencies (LSFs). When converting LPCs to LSFs, the block outputs match those of the poly2lsf function.
The input LPCs,
, must be the denominator of the transfer function of a stable all-pole filter with the form given in Equation 7-5. A length-M+1 input yields a length-M output. Inputs can be sample- or frame-based vectors, but outputs are always sample-based vectors.
See other sections of this reference page to learn about how to ensure that you get valid outputs, how to detect invalid outputs, how the block computes the LSF/LSP values, and more.
Sections of This Reference Page
Requirements for Getting Valid Outputs
To get valid outputs, your inputs and the Root finding coarse grid points parameter value must meet these requirements:
, must come from the denominator of the following transfer function, H(z), of a stable all-pole filter (all roots of H(z) must be inside the unit circle). Note that the first term in H(z)'s denominator must be 1. If the input LPCs do not come from a transfer function of the following form, the block outputs are invalid.
|
(7-5) |
To learn about recognizing invalid inputs and outputs and parameters for dealing with them, see Handling and Recognizing Invalid Inputs and Outputs.
Setting Outputs to LSFs or LSPs
Set the Output parameter to one of the following settings to determine whether the block outputs LSFs or LSPs:
radians in increasing order. The block does not output the guaranteed LSF values, 0 and
.
radians by
. The block does not output the guaranteed normalized LSF values, 0 and 0.5.
radians. The block does not output the guaranteed LSP values, -1 and 1.
Adjusting Output Computation Time and Accuracy with Root Finding Parameters
The values
and
determine the block's output computation time and accuracy, where:
is the value of the Root finding coarse grid points parameter (choose this value with care; see the note below)
is the value of the Root finding bisection refinement parameter.
and
decreases the output computation time, but also decreases output accuracy:
| Note If the value of the Root finding coarse grid points parameter is too small relative to the number of LPCs, the block may output invalid data as described in Requirements for Getting Valid Outputs. Also see Handling and Recognizing Invalid Inputs and Outputs. |
Valid Inputs and Corresponding Outputs
The following list and table summarize characteristics of valid inputs and the corresponding outputs.
Notable Input and Output Properties.
Handling and Recognizing Invalid Inputs and Outputs
The block outputs invalid data if your input LPCs and the value of the Root finding coarse grid points parameter do not meet the requirements described in Requirements for Getting Valid Outputs. The following topics describe what invalid outputs look like, and how to set the block parameters provided for handling invalid inputs and outputs:
What Invalid Outputs Look Like. Invalid outputs have the same dimensions, sizes, and frame statuses as valid outputs, which you can look up in Table 7-14, Input and Output Dimensions, Sizes, and Frame Statuses,. However, invalid outputs do not contain all the LSP or LSF values. Instead, invalid outputs contain none or some of the LSP and LSF values and the rest of the output vector or matrix is filled with place holder values (-1, 0.5, or
depending on the Output parameter setting).
In short, all invalid outputs end in one of the place holder values (-1, 0.5, or
) as illustrated in the following table. To learn how to use the block's parameters for handling invalid inputs and outputs, see the next section.
| Output Parameter Setting |
Place Holder |
Example Invalid Outputs |
| LSF in radians (0 pi) |
![]() |
|
| LSF normalized in range (0 0.5) |
0.5 |
|
| LSP in range (-1 1) |
-1 |
Parameters for Handling Invalid Inputs and Outputs. You must set how the block handles invalid inputs and outputs by setting these parameters:
1 when the output is valid, and a 0 when they are invalid. The LSF and LSP outputs are invalid if the block fails to find all the LSF or LSP values or if the input LPCs are unstable (for details, see Requirements for Getting Valid Outputs). See the previous section to learn how to recognize invalid outputs.
LSF and LSP Computation Method:
Chebyshev Polynomial Method for Root Finding
| Note To learn the principles on which the block's LSP and LSF computation method is based, see the reference listed in Reference. |
To compute LSP outputs, the block relies on the fact that LSP values are the roots of two particular polynomials related to the input LPC polynomial; the block finds these roots using the Chebyshev polynomial root finding method, described next. To compute LSF outputs, the block computes the arccosine of the LSPs, outputting values ranging from 0 to
radians.
Root Finding Method. LSPs, which are the roots of two particular polynomials, always lie in the range (-1, 1). (The guaranteed roots at 1 and -1 are factored out.) The block finds the LSPs by looking for a sign change of the two polynomials' values between points in the range (-1, 1). The block searches a maximum of
points, where
is the value of the Root finding coarse grid points parameter
is the value of the Root finding bisection refinement parameter
The block's method for choosing which points to check consists of the following two steps:
intervals, each of length
, and checks the signs of both polynomials' values at the endpoints of the intervals. The block starts checking signs at 1, and continues checking signs at
,
, and so on at steps of length
, outputting any point if it is a root. The block stops searching in these situations:
, it searches for the root guaranteed to lie in the interval by following these steps:
. The block outputs the midpoint if it is a root, and continues Step 1, Coarse Root Finding, at the next point,
. Otherwise, the block selects the half-interval with endpoints of opposite sign (either
or
) and executes Step b, Stop or Continue Root Finding Refinement.
times (
is the value of the Root finding bisection refinement parameter), the block linearly interpolates the root by using the half-interval's endpoints, outputs the result as an LSP value, and returns to Step 1, Coarse Root Finding. Otherwise, the block repeats Step a using the half-interval.
Figure 7-13: Coarse Root Finding and Root Finding Refinement
Root Finding Method Limitations: Failure to Find Roots
The block root finding method described above can fail, causing the block to produce invalid outputs (for details on invalid outputs, see Handling and Recognizing Invalid Inputs and Outputs).
In particular, the block can fail to find some roots if the value of the Root finding coarse grid points parameter,
, is too small. If the polynomials oscillate quickly and have roots that are very close together, the root finding may be too coarse to identify roots that are very close to each other, as illustrated in Figure 7-14, Fixing a Failed Root Finding,.
For higher-order input LPC polynomials, you should increase the Root finding coarse grid points value to ensure the block finds all the roots and produces valid outputs.
Figure 7-14: Fixing a Failed Root Finding
Dialog Box
, where the block divides the interval (-1, 1) into
subintervals of equal length, and looks for roots (LSP values) in each subinterval. You must pick
large enough or the block output may be invalid as described in Requirements for Getting Valid Outputs. To learn how the block uses this parameter to compute the output, see LSF and LSP Computation Method: Chebyshev Polynomial Method for Root Finding. Also see Adjusting Output Computation Time and Accuracy with Root Finding Parameters. Tunable.
, where each LSP output is within
of the actual LSP value, where
is the value of the Root finding coarse grid points parameter. To learn how the block uses this parameter to compute the output, see LSF and LSP Computation Method: Chebyshev Polynomial Method for Root Finding. Also see Adjusting Output Computation Time and Accuracy with Root Finding Parameters. Tunable.1 when the output is valid, and a 0 when they are invalid. For more information, see Handling and Recognizing Invalid Inputs and Outputs.1. The block can either proceed with computations as if the first coefficient is 1 (Ignore); divide the input LPCs by the value of the first coefficient before computing the output (Normalize); in addition to Normalize, display a warning message at the MATLAB command line (Normalize and warn); stop the simulation and display an error message at the MATLAB command line (Error). For more information, see Parameters for Handling Invalid Inputs and Outputs.Supported Data Types
To learn how to convert to the above data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.
Reference
Kabal, P. and Ramachandran, R. "The Computation of Line Spectral Frequencies Using Chebyshev Polynomials." IEEE Transactions on Acoustics, Speech, and Signal Processing, Vol. ASSP-34 No. 6, December 1986. pp. 1419-1426.
See Also
| LSF/LSP to LPC Conversion |
DSP Blockset |
poly2lsf |
Signal Processing Toolbox |
Also see Linear Prediction for a list of all the blocks in the Linear Prediction library.
| LMS Adaptive Filter | LSF/LSP to LPC Conversion | ![]() |