?? mdepuncturing.m
字號:
function [Out,BlkSize] = mDepuncturing(In,BlkSize,mode)
% Depuncturing for the FEC Decoder of IEEE 802.16-2004
% (WiMAX, OFDMA only)
%
% [Out,BlkSize] = mDepuncturing(In,BlkSize,mode)
%
% In : input column vector or matrix
% one column per code block
% Out : output column vector or matrix
% one column per code block
% BlkSize: row vector, length = number of code blocks
% number of data elements in each code block (or column)
% mode : depuncture mode
% 0 = omitted = rate 1/1 (for overall conv rate 1/2)
% 1 = 1 of 4 = rate 4/3 (for overall conv rate 2/3)
% 2 = 2 of 6 = rate 3/2 (for overall conv rate 3/4)
% 3 = 4 of 10 = rate 5/3 (for overall conv rate 5/6)
%
% For mode=0 the output is the same as the input.
% For mode~=0 the output block size is bigger compared to the input block
% size.
% For mode=1 the input block size must be a multiple of 3.
% For mode=2 the input block size must be a multiple of 4.
% For mode=3 the input block size must be a multiple of 6.
%
% Matlab 7 Release 14SP2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Property of Freescale
% Freescale Confidential Proprietary
% Freescale Copyright (C) 2005 All rights reserved
% ----------------------------------------------------------------------------
% $RCSfile: mDepuncturing.m.rca $
% $Revision: 1.4 $
% $Date: Thu Oct 19 17:46:45 2006 $
% Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[m,n]=size(In);
%check dimensions
[x,y]=size(BlkSize);
if ((x~=1)|(y~=n))
error('Error: BlkSize must be row vector with the same number of columns as In.');
end
switch(mode)
case 0 %1/2 (X:1 Y:1)
%do nothing
Out = In;
case 1 %2/3 (X:10 Y:11)
if (any(mod(BlkSize,3)) | mod(m,3))
error('Error: Input block size (for mode 1) is not a multiple of 3.');
end
Out = zeros(4,m/3,n,class(In));
Out([1 2 4],:,:) = reshape(In,3,m/3,n);
Out = reshape(Out, m*4/3, n);
BlkSize=BlkSize/3*4;
case 2 %3/4 (X:101 Y:110)
if (any(mod(BlkSize,4)) | mod(m,4))
error('Error: Input block size (for mode 2) is not a multiple of 4.');
end
Out = zeros(6,m/4,n,class(In));
Out([1 2 4 5],:,:) = reshape(In,4,m/4,n);
Out = reshape(Out, m*6/4, n);
BlkSize=BlkSize/4*6;
case 3 %5/6 (X:10101 Y:11010)
if (any(mod(BlkSize,6)) | mod(m,6))
error('Error: Input block size (for mode 3) is not a multiple of 6.');
end
Out = zeros(10,m/6,n,class(In));
Out([1 2 4 5 8 9],:,:) = reshape(In,6,m/6,n);
Out = reshape(Out, m*10/6, n);
BlkSize=BlkSize/6*10;
otherwise
error('Error: Depuncturing mode unknown.');
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -