GNU Radio's DVBS2RX Package
ldpc_decoder_cb_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2018,2019 Ahmet Inan, Ron Economos.
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef INCLUDED_DVBS2RX_LDPC_DECODER_CB_IMPL_H
22 #define INCLUDED_DVBS2RX_LDPC_DECODER_CB_IMPL_H
23 
25 #include "dvb_defines.h"
26 #include "psk.hh"
27 #include "qam.hh"
28 #include "ldpc.hh"
29 #include "dvb_s2_tables.hh"
30 #include "dvb_s2x_tables.hh"
31 #include "dvb_t2_tables.hh"
32 #include "simd.hh"
33 #include "algorithms.hh"
34 
35 #define FACTOR 2
36 
37 #ifdef __AVX2__
38 const int SIZEOF_SIMD = 32;
39 #else
40 const int SIZEOF_SIMD = 16;
41 #endif
42 
43 typedef int8_t code_type;
44 const int SIMD_WIDTH = SIZEOF_SIMD / sizeof(code_type);
45 typedef SIMD<code_type, SIMD_WIDTH> simd_type;
46 
47 #if 0
48 #include "flooding_decoder.hh"
49 typedef SelfCorrectedUpdate<simd_type> update_type;
50 typedef MinSumAlgorithm<simd_type, update_type> algorithm_type;
51 const int TRIALS = 50;
52 #else
53 #include "layered_decoder.hh"
54 typedef NormalUpdate<simd_type> update_type;
55 typedef OffsetMinSumAlgorithm<simd_type, update_type, FACTOR> algorithm_type;
56 const int TRIALS = 25;
57 #endif
58 
59 namespace gr {
60  namespace dvbs2rx {
61 
63  {
64  private:
65  unsigned int frame_size;
66  unsigned int signal_constellation;
67  unsigned int code_rate;
68  unsigned int nbch;
69  unsigned int q_val;
70  unsigned int dvb_standard;
71  unsigned int output_mode;
72  unsigned int info_mode;
73  unsigned int frame;
74  unsigned int chunk;
75  unsigned int total_trials;
76  float snr;
77  float precision;
78  float total_snr;
79  unsigned int rowaddr0;
80  unsigned int rowaddr1;
81  unsigned int rowaddr2;
82  unsigned int rowaddr3;
83  unsigned int rowaddr4;
84  unsigned int rowaddr5;
85  unsigned int rowaddr6;
86  unsigned int rowaddr7;
87  LDPCInterface *ldpc;
88  Modulation<gr_complex, int8_t> *mod;
89  LDPCDecoder<simd_type, algorithm_type> decode;
90  int8_t *soft;
91  int8_t *dint;
92  int8_t *tempu;
93  int8_t *tempv;
94  void *aligned_buffer;
95 
96  int interleave_lookup_table[FRAME_SIZE_NORMAL];
97  int deinterleave_lookup_table[FRAME_SIZE_NORMAL];
98 
99  void generate_interleave_lookup();
100  void generate_deinterleave_lookup();
101  inline void interleave_parity_bits(int *tempu, const int *&in);
102  inline void twist_interleave_columns(int* tempv, int* tempu, int rows, int mod, const int *twist);
103  inline void twist_deinterleave_columns(int* tempv, int* tempu, int rows, int mod, const int *twist);
104 
105  const static int twist16n[8];
106  const static int twist64n[12];
107  const static int twist256n[16];
108 
109  const static int twist16s[8];
110  const static int twist64s[12];
111  const static int twist256s[8];
112 
113  const static int mux16[8];
114  const static int mux64[12];
115  const static int mux256[16];
116 
117  const static int mux16_35[8];
118  const static int mux16_13[8];
119  const static int mux16_25[8];
120  const static int mux64_35[12];
121  const static int mux64_13[12];
122  const static int mux64_25[12];
123  const static int mux256_35[16];
124  const static int mux256_23[16];
125 
126  const static int mux256s[8];
127  const static int mux256s_13[8];
128  const static int mux256s_25[8];
129 
130  public:
131  ldpc_decoder_cb_impl(dvb_standard_t standard, dvb_framesize_t framesize, dvb_code_rate_t rate, dvb_constellation_t constellation, dvb_outputmode_t outputmode, dvb_infomode_t infomode);
133 
134  void forecast (int noutput_items, gr_vector_int &ninput_items_required);
135 
136  int general_work(int noutput_items,
137  gr_vector_int &ninput_items,
138  gr_vector_const_void_star &input_items,
139  gr_vector_void_star &output_items);
140  };
141 
142  } // namespace dvbs2rx
143 } // namespace gr
144 
145 #endif /* INCLUDED_DVBS2RX_LDPC_DECODER_CB_IMPL_H */
146 
ldpc_decoder_cb_impl(dvb_standard_t standard, dvb_framesize_t framesize, dvb_code_rate_t rate, dvb_constellation_t constellation, dvb_outputmode_t outputmode, dvb_infomode_t infomode)
OffsetMinSumAlgorithm< simd_type, update_type, FACTOR > algorithm_type
Definition: ldpc_decoder_cb_impl.h:55
void forecast(int noutput_items, gr_vector_int &ninput_items_required)
SIMD< code_type, SIMD_WIDTH > simd_type
Definition: ldpc_decoder_cb_impl.h:45
#define FRAME_SIZE_NORMAL
Definition: dvb_defines.h:47
dvb_framesize_t
Definition: dvb_config.h:85
dvb_constellation_t
Definition: dvb_config.h:91
const int SIZEOF_SIMD
Definition: ldpc_decoder_cb_impl.h:40
dvb_outputmode_t
Definition: dvb_config.h:124
Definition: ldpc_decoder_cb_impl.h:62
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
Definition: bbdeheader_bb.h:30
const int SIMD_WIDTH
Definition: ldpc_decoder_cb_impl.h:44
dvb_infomode_t
Definition: dvb_config.h:129
NormalUpdate< simd_type > update_type
Definition: ldpc_decoder_cb_impl.h:54
int8_t code_type
Definition: ldpc_decoder_cb_impl.h:43
dvb_code_rate_t
Definition: dvb_config.h:31
const int TRIALS
Definition: ldpc_decoder_cb_impl.h:56
<+description of block+>
Definition: ldpc_decoder_cb.h:37
dvb_standard_t
Definition: dvb_config.h:26