📄 rctoac.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 (480) 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.
%
% ******************************************************************
% RCTOAC
%
% PORTED TO MATLAB FROM CELP 3.2a C RELEASE
% 6-16-94
%
% ******************************************************************
%
% DESCRIPTION
%
% Convert reflection coefficients to autocorrelation coefficients
%
% DESIGN NOTES
%
% Sign convention is:
%
% First reflection coefficient = +(normalized autocorrelation coefficient)
%
% REFERENCES
%
% 1. Atal & Hanauer, "Speech Analysis and Synthesis by Linear
% Prediction of the Speech Wave," JASA, Vol 50 (2), 1971.
%
% VARIABLES
%
% INPUTS
% rc - Reflection coefficients
% m - Predictor order
%
% OUTPUTS
% r - Normalized autocorrelation lags
%
% INTERNALS
% t - Predictor polynomial
% z - Upper limit for vector multiply operations
% tj - Intermediate results of the recursion
% tkj - " " "
% k - Loop counter
%
% ******************************************************************
function r = rctoac( rc, m )
% INITIALIZE LOCAL VARIABLES
r = zeros( m+1, 1 );
t = r;
r(1) = 1.0;
r(2:m+1) = rc;
% COMPUTE PREDICTOR POLYNOMIAL OF DIFFERENT DEGREE AND STORE IN T
% COMPUTE AUTOCORRELATION AND STORE IN R
t(1) = 1.0;
t(2) = -r(2);
if m > 1
for k = 2:m
z = fix(k/2);
tj = t( 2:z+1 ) - ( r( k+1 ) * t( k:-1:k-z+1 ) );
tkj = t( k:-1:k-z+1 ) - ( r( k+1 ) * t( 2:z+1 ) );
t( 2:z+1 ) = tj;
t( k:-1:k-z+1 ) = tkj;
t( k+1 ) = -r( k+1 );
r( k+1 ) = r( k+1 ) - sum( t( 2:k ) .* r( k:-1:2 ) );
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -