📄 readg7231stream.m
字号:
function QC = ReadG7231Stream (FName, Frames)% Read a byte stream file generated by a ITU-T G.7231 coder,% returning the code values for selected frames.% $Id: ReadG7231Stream.m 1.4 2004/08/07 G.723.1-v2r1a $if (nargin < 2) Frames = [1, Inf];endFID = fopen (FName);if (FID == -1) ErrMsg = sprintf ('Cannot open bitstream file: %s', FullName (FName)); error (ErrMsg);endfprintf ('G.723.1 Bitstream file: %s\n', FullName (FName));IFr = 1;k = 1;while (IFr <= Frames(2)) v = fread (FID, 1, 'uchar'); if (isempty (v)) break; end BT(1) = v; % Check the bit rate bits to determine the frame size (bytes) v = bitand (BT(1), 3); switch (v) case 0 % High rate N = 24; case 1 % Low rate N = 20; case 2 % SID frame N = 4; otherwise % Untransmitted frame N = 1; end if (N > 1) Data = fread (FID, N - 1, 'uchar'); if (length (Data) ~= N - 1) error ('Invalid bitstream file'); end BT(2:N) = Data; end if (IFr >= Frames(1)) ByteStream{k} = BT; k = k + 1; end IFr = IFr + 1;endfclose (FID);% Convert to codesQC = GetQCodes (ByteStream);return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -