📄 mctc_enc.m
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Property of Freescale
% Freescale Confidential Proprietary
% Freescale Copyright (C) 2005 All rights reserved
% ----------------------------------------------------------------------------
% $RCSfile: mCTC_enc.m.rca $
% $Revision: 1.1 $
% $Date: Mon Jan 22 10:35:50 2007 $
% Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CTC encoder (INT3e version: no HARQ, no feedback, no SPID)
% Input:
% In : input data (vector or matrix)
% BlockSize : data size
% Type : FEC info
%
% Output:
% Out : output data (vector or matrix)
% BlockSize : data size
function [Out,BlkSize] = mCTC_enc (In,BlockSize,Type)
%-- Unpack data
In = mByteUnpack(In);
BlockSize=BlockSize*8;
%-- Parameters setting
switch Type
case 0 % QPSK rate 1/2
rate = 2 ;
case 1 % QPSK rate 3/4
rate = 4/3 ;
case 2 % 16QAM rate 1/2
rate = 2 ;
case 3 % 16QAM rate 3/4
rate = 4/3 ;
case 4 % 64QAM rate 1/2
%tbd
case 5 % 64QAM rate 2/3
%tbd
case 6 % 64QAM rate 3/4
%tbd
otherwise
error('Unknown FEC Type')
end
Nep = BlockSize.*rate;
% Turbo code generator polynomials
% 8.4.9.2.3.1 CTC encoder IEEE Std 802.16-2004 P.594
g = [1 1 0 1;1 0 1 1;1 0 0 1];
[n,K] = size(g);
m = K - 1;
%loop over col of In
for i=1:size(In,2)
%-- Encoder
clear inputA inputB y_rsc output1 interleaver_inputA interleaver_inputB
x = In(1:BlockSize(i),i)' ;
L_total = BlockSize(i)/2;
%-- Generate the codeword corresponding to the 1st constituent coder
for j = 1:BlockSize(i)/2
inputA(1,j) = x(1,2*j-1);
inputB(1,j) = x(1,2*j);
end
%-- CTC encoder 1
output1 = mRSC_Encode(g, inputA, inputB);
y_rsc(1,:) = inputA;
y_rsc(2,:) = inputB;
y_rsc(3,:) = output1(3:4:4*L_total); %parity bits Y1
y_rsc(5,:) = output1(4:4:4*L_total); %parity bits W1
% clear inputA & inputB
inputA = 0;
inputB = 0;
%-- CTC_IL
[ interleaver_inputA , interleaver_inputB ] = mCTC_IL(BlockSize(i),L_total,x);
%-- Generate the codeword corresponding to the 2nd constituent encoder
%-- CTC encoder 2
output2 = mRSC_Encode(g, interleaver_inputA, interleaver_inputB);
y_rsc(4,:) = output2(3:4:4*L_total); %parity bits Y2
y_rsc(6,:) = output2(4:4:4*L_total); %parity bits W2
% Subblock interleaving 8.4.9.2.3.4.2 IEEE Std 802.16-2004 P.601
inter_y = mTx_sub_inter(y_rsc);
% Symbol grouping 8.4.9.2.3.4.3 IEEE Std 802.16-2004 P.602
ori_encoder_out = mTx_grouping(inter_y);
%-- Puncturing
Out(1:Nep(i),i) = ori_encoder_out(1:Nep(i));
BlkSize(i) = Nep(i);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -