⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 specdist.m

📁 FS1016源代码
💻 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.
%
% ******************************************************************
% SPECDIST
%
% PORTED TO MATLAB FROM CELP 3.2a C RELEASE
% 6-15-94
%
% ******************************************************************
%
% DESCRIPTION
%
% Compute spectral distortion caused by quantization of line spectral
% frequencies
%
% DESIGN NOTES
%
% Calculate distortions/distances (log spectral error, etc.).
% See the first reference below for a complete description.  A
% "reference" system is compared against a "test" system.  Because
% of the nonsymetric nature of the Itakura-Saito measure which some
% of these distortion measures are based, poorer measures will be
% obtained if the "reference" and "test" systems are reversed.
% Because of gain uncertainties, a few measures are reported.
% (Peter Kroon generally uses the measure DM(4).)
%
% REFERENCES
%
% 1. "Distance Measures for Speech Processing", A.h. Gray and J.D. Markel,
%    IEEE Trans. on ASSP, Vol. ASSP-24, no. 5, Oct. 1976
%
% 2. "Quantization and Bit Allocation in Speech Processing",
%    A.h. Gray and J.D. Markel,IEEE Trans. on ASSP, Vol. ASSP-24
%    no. 6, Dec. 1976
%
% 3. "A Note on Quantization and Bit Allocation in Speech Processing",
%    A.h. Gray and J.D. Markel,IEEE Trans. on ASSP, Vol. ASSP-25
%    no. 3, June 1977
%
% VARIABLES
%
% INPUTS
%   unqfreq    -     Unquantized LSPs
%   newfreq    -     Quantized LSPs
%   no         -     Predictor order
%
% OUTPUTS
%   dm         -     Distortion array, subframe
%   sumdm      -     Distortion array, current sum over all subframes
%   iframedm   -     Number of subframes
%
% INTERNALS
%   unqpc      -     Unquantized predictor coefficients
%   newpc      -     Quantized predictor coefficients
%   unqrc      -     Unquantized reflection coefficients
%   newrc      -     Quantized reflection coefficients
%   unqac      -     Unquantized autocorrelation lags
%   newac      -     Quantized autocorrelation lags
%
% ******************************************************************

function [ dm, sumdm, iframedm ] = specdist( unqfreq, newfreq, no, ...
                                             sumdm, iframedm )

% CONVERT LSPs TO AUTOCORRELATION COEFFICIENTS FOR INPUT TO DM ROUTINES
unqpc = lsptopc( unqfreq, no );
newpc = lsptopc( newfreq, no );
unqrc = pctorc( unqpc, no );
newrc = pctorc( newpc, no );
unqac = rctoac( unqrc, no );
newac = rctoac( newrc, no );

% FIND DISTANCES BETWEEN THE AUTOCORRELATION SEQUENCES
[ dm, sumdm, iframedm ] = dist( no, 4*no, unqac, newac, sumdm, iframedm );

⌨️ 快捷键说明

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