📄 pctorc.m
字号:
% MATLAB SIMULATION OF NSA FS-1016 CELP v3.2
% COPYRIGHT (C) 1995-99 ANDREAS SPANIAS AND TED PAINTER
%
% This Copyright applies only to this particular MATLAB implementation
% of the FS-1016 CELP coder. The MATLAB software is intended only for educational
% purposes. No other use is intended or authorized. This is not a public
% domain program and distribution to individuals or networks is strictly
% prohibited. Be aware that use of the standard in any form is goverened
% by rules of the US DoD. Therefore patents and royalties may apply to
% authors, companies, or committees associated with this standard, FS-1016. For
% questions regarding the MATLAB implementation please contact Andreas
% Spanias at (602) 965-1837. For questions on rules,
% royalties, or patents associated with the standard, please contact the DoD.
%
% ALL DERIVATIVE WORKS MUST INCLUDE THIS COPYRIGHT NOTICE.
%
% ******************************************************************
% PCTORC
%
% PORTED TO MATLAB FROM CELP 3.2a C RELEASE
% 6-9-94
%
% ******************************************************************
%
% DESCRIPTION
%
% Convert from lp-polynomial (direct form) to reflection coefficients
%
% DESIGN NOTES
%
% This routine uses the Levinson recursion to compute reflection
% coefficients from the LPC coefficients. The first LPC
% coefficient is assumed to be 1, and although it is passed
% to the routine, it is not used in the calculations.
%
% LPC predictor coefficient convention is:
%
% p+1 -(i-1)
% A(z) = SUM a z where a = +1.0
% i=1 i 1
%
% The sign convention used defines the first reflection coefficient
% as the normalized first autocorrelation coefficient, which results
% in positive values of rc(1) for voiced speech.
%
% VARIABLES
%
% INPUTS
% lpc - Direct form (A(Z)) predictor coefficients (n+1)
% n - Predictor order
%
% OUTPUTS
% rc - Reflection coefficients (voiced -> +rc(1) )
%
% INTERNALS
% a - Copy of input predictor polynomial
% t - Temporary for intermediate recursion results
% i - Index of recursion
%
% GLOBALS
% MAXNO - Predictor order ( A(Z) )
%
% ******************************************************************
function rc = pctorc( lpc, n )
% DECLARE GLOBAL CONSTANTS
global MAXNO
% ALLOCATE RETURN VECTOR AND INIT LOCAL COPY OF PREDICTOR POLYNOMIAL
rc = zeros( MAXNO, 1 );
a = lpc;
% DO LEVINSON RECURSION
for i = n:-1:2
rc(i) = -a( i+1 );
t( i:-1:2 ) = ( a( i:-1:2 ) + ( rc(i) .* a(2:i) ) ) / ...
( 1.0 - ( rc(i) * rc(i) ) );
a( 2:i ) = t( 2:i );
end
rc(1) = -a(2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -