summaryrefslogtreecommitdiff
path: root/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.h
blob: 92c9eb370eede60070ef17b254b729e2e5dfbcdf (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* -*- c++ -*- */
/* 
 * Copyright 2015 Free Software Foundation, Inc.
 * 
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 * 
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this software; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 */

#ifndef INCLUDED_DTV_DVB_LDPC_BB_IMPL_H
#define INCLUDED_DTV_DVB_LDPC_BB_IMPL_H

#include <gnuradio/dtv/dvb_ldpc_bb.h>
#include "dvb_defines.h"

typedef struct{
    int table_length;
    int d[LDPC_ENCODE_TABLE_LENGTH];
    int p[LDPC_ENCODE_TABLE_LENGTH];
}ldpc_encode_table;

namespace gr {
  namespace dtv {

    class dvb_ldpc_bb_impl : public dvb_ldpc_bb
    {
     private:
      unsigned int frame_size;
      unsigned int frame_size_real;
      unsigned int signal_constellation;
      unsigned int nbch;
      unsigned int code_rate;
      unsigned int q_val;
      unsigned int dvb_standard;
      void ldpc_lookup_generate(void);
      ldpc_encode_table ldpc_encode;

      const static int ldpc_tab_1_4N[45][13];
      const static int ldpc_tab_1_3N[60][13];
      const static int ldpc_tab_2_5N[72][13];
      const static int ldpc_tab_1_2N[90][9];
      const static int ldpc_tab_3_5N[108][13];
      const static int ldpc_tab_2_3N_DVBT2[120][14];
      const static int ldpc_tab_2_3N_DVBS2[120][14];
      const static int ldpc_tab_3_4N[135][13];
      const static int ldpc_tab_4_5N[144][12];
      const static int ldpc_tab_5_6N[150][14];
      const static int ldpc_tab_8_9N[160][5];
      const static int ldpc_tab_9_10N[162][5];

      const static int ldpc_tab_1_4S[9][13];
      const static int ldpc_tab_1_3S[15][13];
      const static int ldpc_tab_2_5S[18][13];
      const static int ldpc_tab_1_2S[20][9];
      const static int ldpc_tab_3_5S_DVBT2[27][13];
      const static int ldpc_tab_3_5S_DVBS2[27][13];
      const static int ldpc_tab_2_3S[30][14];
      const static int ldpc_tab_3_4S[33][13];
      const static int ldpc_tab_4_5S[35][4];
      const static int ldpc_tab_5_6S[37][14];
      const static int ldpc_tab_8_9S[40][5];

      const static int ldpc_tab_13_45N[52][13];
      const static int ldpc_tab_9_20N[81][13];
      const static int ldpc_tab_11_20N[99][14];
      const static int ldpc_tab_26_45N[104][14];
      const static int ldpc_tab_28_45N[112][12];
      const static int ldpc_tab_23_36N[115][12];
      const static int ldpc_tab_25_36N[125][12];
      const static int ldpc_tab_13_18N[130][11];
      const static int ldpc_tab_7_9N[140][13];
      const static int ldpc_tab_90_180N[90][19];
      const static int ldpc_tab_96_180N[96][21];
      const static int ldpc_tab_100_180N[100][17];
      const static int ldpc_tab_104_180N[104][19];
      const static int ldpc_tab_116_180N[116][19];
      const static int ldpc_tab_124_180N[124][17];
      const static int ldpc_tab_128_180N[128][16];
      const static int ldpc_tab_132_180N[132][16];
      const static int ldpc_tab_135_180N[135][15];
      const static int ldpc_tab_140_180N[140][16];
      const static int ldpc_tab_154_180N[154][14];
      const static int ldpc_tab_18_30N[108][20];
      const static int ldpc_tab_20_30N[120][17];
      const static int ldpc_tab_22_30N[132][16];

      const static int ldpc_tab_11_45S[11][11];
      const static int ldpc_tab_4_15S[12][22];
      const static int ldpc_tab_14_45S[14][13];
      const static int ldpc_tab_7_15S[21][25];
      const static int ldpc_tab_8_15S[24][22];
      const static int ldpc_tab_26_45S[26][14];
      const static int ldpc_tab_32_45S[32][13];

     public:
      dvb_ldpc_bb_impl(dvb_standard_t standard, dvb_framesize_t framesize, dvb_code_rate_t rate, dvb_constellation_t constellation);
      ~dvb_ldpc_bb_impl();

      void forecast (int noutput_items, gr_vector_int &ninput_items_required);

      int general_work(int noutput_items,
                       gr_vector_int &ninput_items,
                       gr_vector_const_void_star &input_items,
                       gr_vector_void_star &output_items);
    };

  } // namespace dtv
} // namespace gr

#endif /* INCLUDED_DTV_DVB_LDPC_BB_IMPL_H */