DSP Blockset    
LPC to LSF/LSP Conversion

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:

     (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:

Adjusting Output Computation Time and Accuracy with Root Finding Parameters

The values  and  determine the block's output computation time and accuracy, where:

Valid Inputs and Corresponding Outputs

The following list and table summarize characteristics of valid inputs and the corresponding outputs.

Notable Input and Output Properties.   

Table 7-14: Input and Output Dimensions, Sizes, and Frame Statuses
Valid LPC Input 
LSF and LSP Outputs
(Always Sample-Based) 
Sample-based length-M+1 row vector,

Frame-based row vectors are not valid inputs.

Sample-based length-M row vector



Sample- or frame-based length-M+1 column vector,
Sample-based length-M column vector

1-D length-M+1 unoriented vector,
1-D length-M unoriented vector



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:

LSF and LSP Computation Method:
Chebyshev Polynomial Method for Root Finding

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

The block's method for choosing which points to check consists of the following two steps:

  1. Coarse Root Finding -- The block divides the interval [-1, 1] into 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:
  2. Root Finding Refinement -- When the block finds a sign change in an interval, , it searches for the root guaranteed to lie in the interval by following these steps:
    1. Check if Midpoint Is a Root -- The block checks the sign of the midpoint of the interval . 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.
    2. Stop or Continue Root Finding Refinement -- If the block has repeated Step a   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

Output
Specifies whether to convert the input linear prediction polynomial coefficients (LPCs) to LSP in range (-1 1), LSF in radians (0 pi), or LSF normalized in range (0 0.5). See Setting Outputs to LSFs or LSPs for descriptions of the three settings.
Root finding coarse grid points
The value , 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.
Root finding bisection refinement
The value , 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.
Output the validity of current output (1=valid, 0=invalid)
Setting this parameter activates a second block output port that outputs a 1 when the output is valid, and a 0 when they are invalid. For more information, see Handling and Recognizing Invalid Inputs and Outputs.
If current output is invalid, overwrite with previous output
Setting this parameter causes the block to overwrite invalid outputs with the previous output. Setting this parameter activates other parameters for taking care of initial overwrite values (when the very first output of the block is invalid). For more information, see Parameters for Handling Invalid Inputs and Outputs.
When first output is invalid, overwrite with user-defined values
If the first input is unstable, you can choose to either overwrite the invalid first output with the default values (by clearing this parameter) or with values you specify (by setting this parameter). The default initial overwrite values are the LSF or LSP representations of an all-pass filter. For more information, see Parameters for Handling Invalid Inputs and Outputs.
User-defined LSP/LSF values for overwriting invalid first output
In this parameter you specify the values for overwriting an invalid first output if you set the parameter When first output is invalid, overwrite with user-defined values. The vector or matrix of LSP/LSF values you specify should have the same dimension, size, and frame status as the other outputs, which you can look up in Table 7-14, Input and Output Dimensions, Sizes, and Frame Statuses,.
If first coefficient of input not 1
Determines what the block does when the first coefficient of an input is not 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