confg.m

来自「FS1016源代码」· M 代码 · 共 105 行

M
105
字号
% 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.
%
% ******************************************************************
% CONFG
%
% PORTED TO MATLAB FROM CELP 3.2a C RELEASE
% 6-20-94
%
% ******************************************************************
%
% DESCRIPTION
%
% Compute initial states (direct form filters)
%
% DESIGN NOTES
%
% See individual subroutines
%
% VARIABLES
%
% INPUTS
%   s          -     Speech or residual segment
%   l          -     Segment size
%   d1         -     Memory, 1/P(z)
%   d2         -     Memory, 1/A(z)
%   d3         -     Memory, A(z)
%   d4         -     Memory, 1/A(z/gamma)
%   isw1       -     1 = enable 1/P(z)
%   isw2       -     1 = enable 1/A(z)
%   isw3       -     1 = enable A(z)
%   isw4       -     1 = enable 1/A(z/gamma)
%
% OUTPUTS
%   d1         -     Memory, 1/P(z)
%   d2         -     Memory, 1/A(z)
%   d3         -     Memory, A(z)
%   d4         -     Memory, 1/A(z/gamma)
%
% INTERNALS
%   fctemp     -     Bandwidth expanded poles, 1/A(z/gamma)
%
% GLOBALS
%   idb        -     Dimension of d1a and d1b
%   no         -     LPC predictor order
%   bb         -     Pitch predictor coefficients
%   e0         -     Codebook search initial error and updated error
%   fc         -     LPC filter/weighting filter coefficients
%   gamma2     -     Weight factor, perceptual weighting filter
%
% CONSTANTS
%   MAXNO      -     Predictor order
%
% ******************************************************************

function [ d1, d2, d3, d4 ] = ...
         confg( s, l, d1, d2, d3, d4, isw1, isw2, isw3, isw4 )

% DECLARE GLOBAL CONSTANTS
global MAXNO

% DECLARE GLOBAL VARIABLES
global idb no bb e0 fc gamma2

% INITIALIZE LOCALS
fctemp = zeros( MAXNO+1, 1 );

% COMPUTE INITIAL STATE, 1/P(z)
if isw1 ~= 0
    [ e0, d1 ] = pitchvq( e0, l, d1, idb, bb, 'long' );
end

% COMPUTE INITIAL STATE, 1/A(z)
if isw2 ~= 0
    [ d2, e0 ] = polefilt( fc, no, d2, e0, l );
end

% RECOMPUTE ERROR
e0 = s - e0;

% COMPUTE INITIAL STATE, A(z)
if isw3 ~= 0
    [ d3, e0 ] = zerofilt( fc, no, d3, e0, l );
end

% COMPUTE INITIAL STATE, 1/A(z/gamma)
if isw4 ~= 0
    fctemp = bwexp( gamma2, fc, no );
    [ d4, e0 ] = polefilt( fctemp, no, d4, e0, l );
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?