📄 decode_chase2_halfiter.m
字号:
function [decode_output,Wii]=decode_chase_halfiter(R1,Wi,n,h,t,alpha,beta)
% this function use chase algorithm、
% calculate extrinsic information,half-iteration
% decode_output is the result of binary decoding of the current
% half-iteration
% Wii is the extrinsic information of the current half-iteration
% R1 receive vector
% Wi is the extrinsic information by previous half-iteration
% n is the extended hamming code length
% h is the hamming parity matrix
% t is the hamming syndrome decoding table
% alpha & beta is the iteration constant
% step0 receive vector = R1 & extrinsic information = Wi softinput=R2
R2 = Wi*alpha + R1;
b = R2>0;
reliability = abs(R2);
for row = 1:n
% step1 search for the 4 leaset reliable binary symbols of reliability
[tmpalpha,index] = sort(reliability(row,:),2);% tmpalpha = reliability(row,index)
% step2 build 16 testcode set
for nn = 0 :15
testsque = zeros(1,n);
testsque(index(1:4)) = de2bi(nn,4);
testcode(nn+1,:) = bitxor(b(row,:),testsque);
end
for nn = 1 :16
% step3 algebra decode the testcodes
syndrome = mod(testcode(nn,:)*h',2); % syndrome
synindex = bi2de(syndrome,'left-msb');
if synindex< bi2de(h(:,1)','left-msb') % no error or more than 1 error
resultcode(nn,:) = testcode(nn,:);
else
resultcode(nn,:) = bitxor(testcode(nn,:),t(synindex+1,:)); %1 error,
end
% step4 compute the squre Euclidean distance between the resultcodes
% and the recvector R1
resultcode(nn,:) = resultcode(nn,:)*2-1; % {-1,+1}
Dist(nn) = sum((resultcode(nn,:)-R1(row,:)).^2);
%Dist(nn) = sum(abs(resultcode(nn,-R1(row,));
end
% step5 select the codeword having the minimum distance among the
% resultcods
[Distsorted,DistIndex] = sort(Dist);
D(row,:) = resultcode(DistIndex(1),:);
% step6 compute the reliability for each element of D
for ii =1:n
Bconcurent = 0;
for jj = 2:4
if D(row,ii) ~= resultcode(DistIndex(jj),ii) % competitor code
F(row,ii) = (Distsorted(jj) - Distsorted(1))/4;
Bconcurent = 1;
break;
end
end
if Bconcurent==0 % no competitor code
F(row,ii) = beta;
end
end
% step7 process extrinsic information
Wi(row,:) = F(row,:).*D(row,:) - R2(row,:);
end
decode_output = D;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -