⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mulcodeblockseg_ctc.m

📁 OFDMA 物理层开发的matlab 源码.飞思卡尔提供.对物理层开发的工程师有帮助!
💻 M
字号:
function [OutData,BlkSize] = mULCodeBlockSeg_CTC(InData,BurstD,InPilot)


InData = InData(:);


[numRow,numCol] = size(InData);

%-- Parameters Definition
% j : parameter dependent on modulation and FEC rate 
% n : number of allocated slots
% k : floor(n/j)
% m : mod(n,j)

switch BurstD.Type
    case 0 % QPSK rate 1/2
        j = 10;
        numBytePerSlot = 6;
        rate = 2;
    case 1 % QPSK rate 3/4
        j = 6;
        numBytePerSlot = 9;
        rate = 4/3;
    case 2 % 16QAM rate 1/2
        j = 5;
        numBytePerSlot = 12;
        rate = 2;
    case 3 % 16QAM rate 3/4 
        j = 3;
        numBytePerSlot = 18;
        rate = 4/3;
   case 4 % 64QAM rate 1/2
        j = 3;
        numBytePerSlot = 18;
    case 5 % 64QAM rate 2/3
        j = 2;
        numBytePerSlot = 24;
    case 6 % 64QAM rate 3/4
        j = 2;
        numBytePerSlot = 27;
    otherwise
        error('Unknown FEC Type')
end
n = BurstD.Slots;
k = floor(n/j);
m = mod(n,j);

if n<=j & n~=7
    %1 block of n slots

%     Out = (In(:));
    BlkSize  = [n*numBytePerSlot];
    NumSlots = [n];
    
elseif n==7
    %1 block of 4 slots
    %1 block of 3 slots

    Out  = zeros(4*numBytePerSlot , 2);
    inter = 4*numBytePerSlot ; 
%     Out1 = In(1,1:inter) ; 
%     Out2 = In(1,inter+1:end) ;
%     Out(1:4*numBytePerSlot   , 1) = Out1' ;
%     Out(1:3*numBytePerSlot   , 2) = Out1' ;
    BlkSize  = [4*numBytePerSlot 3*numBytePerSlot];
    NumSlots = [4 3];
    
elseif n>j

    Lb1 = ceil((m+j)/2);
    Lb2 = floor((m+j)/2);

    if (Lb1==7) | (Lb2==7)
        Lb1=Lb1 + 1;
        Lb2=Lb2 - 1;
    end

    if mod(n,j)==0
        %k blocks of j slots
        
        Out = reshape(InData,j*numBytePerSlot*rate*8,k);
        BlkSize  = [ones(1,k)*j*numBytePerSlot]*8*rate;
        NumSlots = [ones(1,k)*j];

    else
        %k-1 blocks of j slots
        %1 blocks of Lb1 slots
        %1 blocks of Lb2 slots

        inter1 = (k-1)*j*numBytePerSlot*rate*8 ;
        inter2 = inter1 + 1*Lb1*numBytePerSlot*rate*8 ;
        inter3 = inter2 + 1*Lb2*numBytePerSlot*rate*8 ; %= "end"
        %check that intermediate3 == numCol
        if inter3 ~= numRow
            error('Wrong inters in mCodeBlkSegULTX_CTC.')
            
        end

        Out1= reshape(InData(1:inter1),j*numBytePerSlot*rate*8,k-1) ; 
        Out2= reshape(InData(inter1+1:inter2),Lb1*numBytePerSlot*rate*8,1) ; 
        Out3= reshape(InData(inter2+1:inter3),Lb2*numBytePerSlot*rate*8,1) ; 

        %Out = zeros(j*numBytePerSlot*rate*8 , k-1 + 1 + 1 );
        Out = 255*ones(j*numBytePerSlot*rate*8 , k-1 + 1 + 1 );
        Out(1:j*numBytePerSlot*rate*8   , 1:k-1  ) = Out1 ;
        Out(1:Lb1*numBytePerSlot*rate*8 , k:k    ) = Out2 ;
        Out(1:Lb2*numBytePerSlot*rate*8 , k+1:k+1) = Out3 ;
        
        BlkSize  = [ones(1,k-1)*j*numBytePerSlot Lb1*numBytePerSlot Lb2*numBytePerSlot]*8*rate;
        NumSlots = [ones(1,k-1)*j Lb1 Lb2];
        
    end
end

DataSize = BlkSize;
OutData=Out;
1+1;















⌨️ 快捷键说明

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