📄 dcodcbi.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.
%
% ******************************************************************
% DCODCBI
%
% PORTED TO MATLAB FROM CELP 3.2a C RELEASE
% 8-4-94
%
% ******************************************************************
%
% DESCRIPTION
%
% Decodes all stochastic code book indicies for a frame
%
% DESIGN NOTES
%
% Converts code book index bits from the bit stream to actual indicies.
%
% VARIABLES
%
% INPUTS
% cbbits - Number of bits allocated for index quantization
% bitsum1 - Number of bits for odd subframes
% bitsum2 - Number of bits for even subframes
% bitpointer - Number of bits used
% nn - Number of subframes
% stream - Bit stream
%
% OUTPUTS
% cbi - Vector of codebook indicies
%
% INTERNALS
% i - Subframe counter
%
% ******************************************************************
function [ cbi, bitpointer ] = dcodcbi( cbbits, bitsum1, bitsum2, ...
bitpointer, nn, stream )
% INIT RETURN VECTOR
cbi = zeros( nn, 1 );
% ESTABLISH STARTING BIT STREAM POSITION
pointer = bitpointer;
% RUN DECODING FOR ALL SUBFRAMES
for i = 1:nn
[ cbi(i), pointer ] = unpack( stream, cbbits, pointer );
% MAINTAIN BITSTREAM POINTER
if any( [ 1 3 5 ] == i )
pointer = pointer + bitsum2 - cbbits;
elseif any( [ 2 4 6 ] == i )
pointer = pointer + bitsum1 - cbbits;
else
fprintf( 'dcodcbi: Error in decoding code book indicies\n' );
end
end
% OFFSET INDICIES TO MATCH UP WITH C SIMULATION
cbi = cbi + 1;
% UPDATE BIT STREAM INDEX
bitpointer = bitpointer + cbbits;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -