📄 puthex.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.
%
% ******************************************************************
% PUTHEX
%
% PORTED TO MATLAB FROM CELP 3.2a C RELEASE
% 7-28-94
%
% ******************************************************************
%
% DESCRIPTION
%
% Convert binary bit stream input to hex bit stream output
%
% DESIGN NOTES
%
% Pack an array of binary bits into a string of hex characters,
% where each character represents 4 bits. The character stream is
% nb/4 characters long.
%
% VARIABLES
%
% INPUTS
% nb - Number of bits in the input bit stream
% bits - Bit stream input data (binary)
%
% OUTPUTS
% line - Bit stream output data (hex)
%
% INTERNALS
% WordStart - Indicies of high-order bits for each hex word
% w - Current 4-bit word (1 to nb/4)
%
% ******************************************************************
function line = puthex( nb, bits )
% INIT HEX WORD BASE INDICIES
WordStart = 1:4:nb;
% PACK 4-BIT BINARY WORDS INTO HEX DIGITS
% NOTE THE USE OF LEADING 0 TO FORCE UNSIGNED CONVERSIONS
for w = 1:fix(nb/4)
line(w) = sprintf( '%X', bin2int( [0,bits(WordStart(w):WordStart(w)+3)'] ) );
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -