3 * Copyright 2002 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
23 #ifndef _ATSC_VITERBI_DECODER_H_
24 #define _ATSC_VITERBI_DECODER_H_
26 #define USE_SIMPLE_SLICER 0
28 #include <atsc_types.h>
29 #include <interleaver_fifo.h>
31 #if (USE_SIMPLE_SLICER)
32 #include <atsci_fake_single_viterbi.h>
33 typedef atsci_fake_single_viterbi single_viterbi_t;
35 #include <atsci_single_viterbi.h>
36 typedef atsci_single_viterbi single_viterbi_t;
40 * \brief fancy, schmancy 12-way interleaved viterbi decoder for ATSC
43 class atsci_viterbi_decoder {
45 static const int NCODERS = 12;
47 atsci_viterbi_decoder ();
48 ~atsci_viterbi_decoder ();
50 //! reset all decoder states
54 * Take 12 data segments of soft decisions (floats) and
55 * produce 12 RS encoded data segments. We work in groups of 12
56 * because that's the smallest number of segments that composes a
57 * single full cycle of the decoder mux.
59 void decode (atsc_mpeg_packet_rs_encoded out[NCODERS],
60 const atsc_soft_data_segment in[NCODERS]);
65 typedef interleaver_fifo<unsigned char> fifo_t;
67 static const int SEGMENT_SIZE = ATSC_MPEG_RS_ENCODED_LENGTH; // 207
68 static const int OUTPUT_SIZE = (SEGMENT_SIZE * 12);
69 static const int INPUT_SIZE = (ATSC_DATA_SEGMENT_LENGTH * 12);
71 void decode_helper (unsigned char out[OUTPUT_SIZE],
72 const float in[INPUT_SIZE]);
75 single_viterbi_t viterbi[NCODERS];
76 fifo_t *fifo[NCODERS];
83 #endif /* _ATSC_VITERBI_DECODER_H_ */