PageRenderTime 58ms CodeModel.GetById 39ms app.highlight 10ms RepoModel.GetById 6ms app.codeStats 1ms

/drm/trunk/debug/mm/ml/ml_rs_model_xxbm/bm.m

http://github.com/zaqwes8811/decoder-reed-solomon
Objective C | 75 lines | 74 code | 1 blank | 0 comment | 7 complexity | ed447144e5fb64e77fed0b7e7b720e01 MD5 | raw file
 1  % ???????????????? ??????? ????????? ?.-?????
 2 % "High-Speed Low-Complexity Reed-Solomon Decoder
 3 % using Pipelined Berlekamp-Massey Algorithm and Its 
 4 % Folded Architecture"
 5 clear;  clc;
 6%  K = 9;  t = 3;  % ?????????????? ????????, ??????? ?????? ????? ?????????
 7%  p_sourse = [1 0 0 1 1];  % x4+x+1 gf(16)
 8 K = 207;  t = 24;				
 9  p_sourse = [1 0 0 0 1 1 1 0 1];  % x8+x+1
10 p = bitroute(p_sourse, length(p_sourse));	% ??? ????????? ?????? ??????????? ???? ? ???????
11 ip = arbit2dec(p); 	% ????????? ? uint
12 m = length(p)-1;	% ??????? ????????????? ??????????
13 GF = 2^m;			% ????? ????????? ? ???? 2^(??????? ???????? ??????????)
14 % ???????? 
15 % 1. ?????? ???? ? ????? ? ??????? ????? ?????????? ??????
16 % 2. ??? ??? ??
17 T = 2*t; 		% ????? ??????????? ????????
18 N = T+K;		% ????? ???????? ? ??????? ?????
19 j0 = 1;			% ????????? ???????
20 % ????????? ???????
21 [index_of alpha_to] = getLook_up(p_sourse);
22 % ??????????? ?????????
23 % ? ???????? ?? ????? ???? ??????????, ??????? ?? ????????? ??????????? ??? ????????
24 unicalc{1,1} = index_of; 
25 unicalc{1,2} = alpha_to; 
26 unicalc{1,3} = GF; 
27 unicalc{1,4} = m; 
28 %%% ???????? ????????? %%%%%%%%
29 load sindroms;
30 load lambdas;
31 load omegas; 
32
33% ?????? ??????????
34  lambda_deg = 0;  l_er = 0; 
35  discrep = 0;  % ???????
36  % ????????? ?????????
37  lambda = [1 zeros(1, T/2)];
38  prev_lambda = [0 1 zeros(1, T/2-1)]; % B(x) ????? ????????
39  tau = zeros(1, T); 
40  % ???????? ?????????? (????)
41  for i_round = 1:T  % ???? ?? ??????????? ????????
42    discrep = 0;  % ??????? ????????
43    for i = 1:l_er+1
44      mpp = gmult(s(i_round-i+1),lambda(i), unicalc);
45      discrep = myxor(discrep, mpp,8);  % ??????? ???????
46    end
47    % ????????? ???????. ???????????? ????
48    if discrep ~= 0
49      for k = 1:T/2+1 % ????? ?? ????? ?????? 
50        mpp = gmult(discrep, prev_lambda(k), unicalc);
51        tau(k) = myxor(lambda(k), mpp, 8);
52        if tau(k) ~= 0  % ?????? ???????
53          lambda_deg = k-1; % ????? ??????? ??????? ??????
54        end
55      end
56      % ????? ?????????
57      if 2*l_er < i_round 
58        l_er = i_round-l_er;
59        for k = 1:T/2+1
60          prev_lambda(k) = gdiv(lambda(k), discrep, unicalc);
61        end
62      end 
63      % ????????? ???? ??????
64      lambda = tau;
65      tau = zeros(1, length(tau));    % ????????
66    end
67    % ???????? ?????? ???????
68    prev_lambda = [0 prev_lambda];
69    prev_lambda(:,end) = []; % ???????? ????????? ????????
70    % prev_lambda_deg = prev_lambda_deg+1; 
71  end
72  % ?????? ???????? ????????
73  % ????? ?? ????????? ??????????? ??????????? ?????? ? ????????
74  % ????????
75lambda_deg