%% 提升值和基本图,ZC>64
%     mpd(ceil(Zc/64),2)==0 |   mpd(ceil(Zc/64),2)==1
% 0	128,	256;            |
% 1	96,     384;            |   192; 
% 2;                        |   160, 320
% 3	112,    224;            |
% 4	72;                     |   144, 288
% 5	88,     352,            |	176
% 6	104,    208;            |
% 7	120,    240             |
%%

%% zc=384
% zc = 384;
% HB = BG1CheckMatrix(zc);
% disp(['class(HB)=' class(HB)]);
% GenBG1Para(zc,3,HB,'Zc384');
% case3,张欣瑜<ldpc_layered_BG1_Zc384_new_v3>
%iter1
% res = 0;
% path = 'E:\project\2022.10\LdpcDecBG1\inc\testdata\ldpc_layered_BG1_Zc384_new_v3\iter1\';
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r1.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r2.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r3.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r4.dat');
%iter2
% path = 'E:\project\2022.10\LdpcDecBG1\inc\testdata\ldpc_layered_BG1_Zc384_new_v3\iter2\';
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r1.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r2.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r3.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r4.dat');
% res = res + ChangeDec2MReg(zc,path,'9_decode.dat');
% res = res + ChangeCheck2MReg(zc,1,path,'11_r1_bytes.dat');
% res = res + ChangeCheck2MReg(zc,2,path,'11_r2_bytes.dat');
% res = res + ChangeCheck2MReg(zc,3,path,'11_r3_bytes.dat');
% res = res + ChangeCheck2MReg(zc,4,path,'11_r4_bytes.dat');
%iter3
% path = 'E:\project\2022.10\LdpcDecBG1\inc\testdata\ldpc_layered_BG1_Zc384_new_v3\iter3\';
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r1.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r2.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r3.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r4.dat');
%iter4
% path = 'E:\project\2022.10\LdpcDecBG1\inc\testdata\ldpc_layered_BG1_Zc384_new_v3\iter4\';
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r1.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r2.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r3.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r4.dat');
% res = res + ChangeDec2MReg(zc,path,'9_decode.dat');
% res = res + ChangeCheck2MReg(zc,1,path,'11_r1_bytes.dat');
% res = res + ChangeCheck2MReg(zc,2,path,'11_r2_bytes.dat');
% res = res + ChangeCheck2MReg(zc,3,path,'11_r3_bytes.dat');
% res = res + ChangeCheck2MReg(zc,4,path,'11_r4_bytes.dat');
% iter5
% path = 'E:\project\2022.10\LdpcDecBG1\inc\testdata\ldpc_layered_BG1_Zc384_new_v3\iter5\';
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r1.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r2.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r3.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r4.dat');
% iter6
% path = 'E:\project\2022.10\LdpcDecBG1\inc\testdata\ldpc_layered_BG1_Zc384_new_v3\iter6\';
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r1.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r2.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r3.dat');
% res = res + ChangeZn2MReg(zc,path,'8_Zn_r4.dat');
% res = res + ChangeDec2MReg(zc,path,'9_decode.dat');
% res = res + ChangeCheck2MReg(zc,1,path,'11_r1_bytes.dat');
% res = res + ChangeCheck2MReg(zc,2,path,'11_r2_bytes.dat');
% res = res + ChangeCheck2MReg(zc,3,path,'11_r3_bytes.dat');
% res = res + ChangeCheck2MReg(zc,4,path,'11_r4_bytes.dat');
% if res
%     fprintf('err. res = %d.\n',res);
% end

%% snr = 6; iter = 6; zc = 384; layer = 46
zc = 384;
row = [1, 2, 3, 4, 5, 6, 8, 10, 13, 18, 23, 26, 31, 35, 40, 45];
res = 0;
for iter = 1:6
    path = sprintf('E:/project/2022.10/LdpcDecBG1/inc/testdata/66Zc384_Iter6/iter%d/',iter);
    for r = row
        filename = sprintf('8_Zn_r%d.dat',r);
        res = res + ChangeZn2MReg(zc,path,filename);
    end
    if ~mod(iter,2)
        res = res + ChangeCheck2MReg(zc,1,path,'11_r1_bytes.dat');
        res = res + ChangeCheck2MReg(zc,2,path,'11_r2_bytes.dat');
        res = res + ChangeCheck2MReg(zc,3,path,'11_r3_bytes.dat');
        res = res + ChangeCheck2MReg(zc,4,path,'11_r4_bytes.dat');
    end
end