summaryrefslogtreecommitdiff
path: root/viterbi_generator/tests/utils/make_stops.m
blob: 98734c9d5102ab0c615227809381b114e095fd92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function [ STOPS ] = make_stops(Lh,SYMBOLS)
%
% MAKE_STOPS:
%           This code returns a statenumber corresponding to the set of
%           legal stop states as found from Lh. The method is to use the table
%           of symbolic stop states as it is listed in the report made 
%           by 95gr870T. For the table lookups are made in SYMBOLS. in 
%           order to map from the symbol representation to the state number 
%           representation.
%
% SYNTAX:   [ STOPS ] = make_stops(Lh,SYMBOLS)
%
% INPUT:    SYMBOLS: The table of symbols corresponding the the state-
%                    numbers.
%           Lh:      Length of the estimated impulseresponse.
%
% OUTPUT:   STOPS:   The number representation of the set of legal stop 
%                    states.
%
% SUB_FUNC: None
%
% WARNINGS: The table of symbolic representations has not been verified
%           but is used directly as it is listed in the report made 
%           by 95gr870T.
%
% TEST(S):  The function has been verified to return a state number
%           which matches the symbolic representation.
%
% AUTOR:    Jan H. Mikkelsen / Arne Norre Ekstrøm
% EMAIL:    hmi@kom.auc.dk / aneks@kom.auc.dk
%
% $Id: make_stops.m,v 1.2 1997/09/22 11:44:21 aneks Exp $

% OBTAIN THE SYMBOLS FROM Lh. THIS IS THE TABLE LISTED IN THE REPORT MADE 
% BY 95gr870T. (SATEREPRESENTATION IS SLIGHTLY CHANGED).
%
if Lh==1,
  stop_symbols = [ -1 ];
  count=1;
elseif Lh==2,
  stop_symbols = [ -1 j ];
  count=1;
elseif Lh==3,
  stop_symbols = [ -1 j 1 ];
  count=1;
elseif Lh==4,
  stop_symbols = [  [ -1 j 1 j ] ; [ -1 j 1 -j ] ];
  count=2;
elseif Lh==5,
  stop_symbols = [ [ -1 j 1 j -1] ; [ -1 j 1 -j -1] ; [ -1 j 1 j 1] ; [ -1 j 1 -j 1] ];
  count=2;
else
  fprintf('\n\nError: Illegal value of Lh, terminating...');
end

% NOW THAT WE HAVE THE SYMBOL REPRESENTATION THE REMAINING JOB IS
% TO MAP THE MSK SYMBOLS TO STATE NUMBERS
%
index = 0;
stops_found=0;
while stops_found < count,
  index=index+1;
  if sum(SYMBOLS(index,:)==stop_symbols(stops_found+1,:))==Lh,
    stops_found=stops_found+1;
    STOPS(stops_found)=index;
  end
end
personal git repositories of Harald Welte. Your mileage may vary