📄 autohf.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.
%
% ******************************************************************
% AUTOHF
%
% PORTED TO MATLAB FROM CELP 3.2a C RELEASE
% 6-8-94
%
% ******************************************************************
%
% DESCRIPTION
%
% LPC autocorrelation analysis with high frequency compensation
%
% DESIGN NOTES
%
% Subroutine to perform HF corrected autocorrelation LPC analysis.
% First, autocorrelation coefficients are calculated and high
% frequency corrected to partially compensate for the analog
% antialiasing filter. (Traditionally, this technique has only been
% applied to covariance analysis, but it applies to autocorrelation
% analysis as well). Next, the autocorrelation function is converted
% to reflection coefficients by the Schur recursion (aka LeRoux &
% Guegen). Then, the reflection coefficients are converted to LPC
% predictor coefficients. Finally, the predictors are bandwidth
% expanded by omega.
%
% 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.
%
% REFERENCES
%
% 1. Atal & Schroeder, Predictive Coding of Speech Signals
% and Subjective Error Criteria, IEEE TASSP, June 1979.
%
% VARIABLES
%
% INPUTS
% si - Input sequence (signal)
% w - Window sequence
% n - Input sequence length
% p - LPC predictor polynomial order
% omega - Bandwidth expansion factor for LPC poles
%
% OUTPUTS
% a - LPC coefficients (1 to m+1) (direct form predictor)
% rc - Reflection coefficients (1 to m)
%
% INTERNALS
% unstable - Stability flag
% atemp - Predictor coefficient temp storage
% s - Windowed signal sequence
% c0 - First autocorrelation lag
% c - Higher order autocorrelation lags
%
% GLOBALS
% MAXNO - LPC predictor order
% TRUE - Flag constant
% FALSE - Flag constant
% FrameCnt - Current frame number
%
% ******************************************************************
function [ a, rc ] = autohf( si, w, n, p, omega )
% DECLARE GLOBAL CONSTANTS
global MAXNO TRUE FALSE
% DECLARE GLOBAL VARIABLES
global FrameCnt
% INIT LOCAL VARIABLES
unstable = FALSE;
atemp = zeros( MAXNO+1, 1);
atemp(1) = 1.0;
% APPLY WINDOW TO INPUT SEQUENCE
s = si .* w;
% COMPUTE AUTOCORRELATION
[ c0, c ] = cor( s, n, p );
if c0 < 0.0
unstable = TRUE;
end
% CONVERT AUTOCORRELATIONS TO PREDICTOR COEFFICIENTS (PCs)
atemp = durbin( c0, c, atemp, p );
% BANDWIDTH EXPAND CORRECTED PCs
a = bwexp( omega, atemp, p );
% MATCH RCs to EXPANDED PCs
rc = pctorc( a, p );
% TEST RCs FOR STABILITY */
if any( abs(rc) > 1.0 )
unstable = TRUE;
end
% TRAP INSTABILITY EXCEPTIONS
if unstable == TRUE
printf( 'autohf: unstable lpc analysis at frame %d\n', FrameCnt );
a( 2:p+1 ) = 0.00;
rc( 1:p ) = 0.00;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -