小块长度的编码
小快编码长度的编码分为三种,第一种是长度为1,第二种是长度为2,第三种是长度为3~11.有不一样的处理方式。
1.长度为1或者2的编码
x,y是占位符,在加扰的时候,占位符和正常的数据的处理是不一样的。
这块对与Qm和调制方式的关系对应关系做一个介绍
% Encode, with placeholder bits
x = -1;
y = -2;
if length(uciBits)==1 % A=1
if Qm==1
out = uciBits;
else
out = [uciBits; y; repmat(x,Qm-2,1)];
end
else % A=2
c2 = xor(uciBits(1),uciBits(2));
if Qm==1
out = [uciBits; c2];
else
ib = reshape(repmat([uciBits; c2],2,1),2,3);
xb = repmat(x,Qm-2,3);
out = reshape([ib;xb],[],1);
end
end
2.长度为3~11使用RM编码
%#codegen
% Table 5.3.3.3-1, Section 5.3.3.3, TS 38.212.
basisSeq = [1 1 0 0 0 0 0 0 0 0 1
1 1 1 0 0 0 0 0 0 1 1
1 0 0 1 0 0 1 0 1 1 1
1 0 1 1 0 0 0 0 1 0 1
1 1 1 1 0 0 0 1 0 0 1
1 1 0 0 1 0 1 1 1 0 1
1 0 1 0 1 0 1 0 1 1 1
1 0 0 1 1 0 0 1 1 0 1
1 1 0 1 1 0 0 1 0 1 1
1 0 1 1 1 0 1 0 0 1 1
1 0 1 0 0 1 1 1 0 1 1
1 1 1 0 0 1 1 0 1 0 1
1 0 0 1 0 1 0 1 1 1 1
1 1 0 1 0 1 0 1 0 1 1
1 0 0 0 1 1 0 1 0 0 1
1 1 0 0 1 1 1 1 0 1 1
1 1 1 0 1 1 1 0 0 1 0
1 0 0 1 1 1 0 0 1 0 0
1 1 0 1 1 1 1 1 0 0 0
1 0 0 0 0 1 1 0 0 0 0
1 0 1 0 0 0 1 0 0 0 1
1 1 0 1 0 0 0 0 0 1 1
1 0 0 0 1 0 0 1 1 0 1
1 1 1 0 1 0 0 0 1 1 1
1 1 1 1 1 0 1 1 1 1 0
1 1 0 0 0 1 1 1 0 0 1
1 0 1 1 0 1 0 0 1 1 0
1 1 1 1 0 1 0 1 1 1 0
1 0 1 0 1 1 1 0 1 0 0
1 0 1 1 1 1 1 1 1 0 0
1 1 1 1 1 1 1 1 1 1 1
1 0 0 0 0 0 0 0 0 0 0];
uciBitsD = cast(uciBits,'double');
out = zeros(32,1);
for idx = 1:length(uciBits)
out = out + uciBitsD(idx).*basisSeq(:,idx);
end
cout = cast(mod(out,2),class(uciBits));
end