gethex.m

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

M
51
字号
% 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.
%
% ******************************************************************
% GETHEX
%
% PORTED TO MATLAB FROM CELP 3.2a C RELEASE
% 8-2-94
%
% ******************************************************************
%
% DESCRIPTION
%
% Convert packed hex input to binary bit stream output
%
% DESIGN NOTES
%
% Unpack a string of hex characters into an array of binary bits,
% where each character represents 4 bits.  The character stream is
% nb/4 characters long.
%
% VARIABLES
%
% INPUTS
%   nb         -     Number of bits in the output bit stream
%   line       -     Packed hex stream input data
%
% OUTPUTS
%   bits       -     Bit stream output data (binary)
%
% ******************************************************************

function bits = gethex( nb, line )

% UNPACK HEX DIGITS INTO 4-BIT BINARY WORDS, THEN
% REFORMAT BINARY WORDS INTO SINGLE BIT STREAM
bits = reshape( int2bin( sscanf( line, '%1X\n', nb/4 ), 4 )', nb, 1 );

⌨️ 快捷键说明

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