diff options
Diffstat (limited to 'gr-dtv/lib/dvb/dvb_ldpc_bb_impl.cc')
-rw-r--r-- | gr-dtv/lib/dvb/dvb_ldpc_bb_impl.cc | 289 |
1 files changed, 278 insertions, 11 deletions
diff --git a/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.cc b/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.cc index c1738e1245..b5b9065f93 100644 --- a/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.cc +++ b/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2015 Free Software Foundation, Inc. + * Copyright 2015,2016 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 @@ -41,8 +41,12 @@ namespace gr { dvb_ldpc_bb_impl::dvb_ldpc_bb_impl(dvb_standard_t standard, dvb_framesize_t framesize, dvb_code_rate_t rate, dvb_constellation_t constellation) : gr::block("dvb_ldpc_bb", gr::io_signature::make(1, 1, sizeof(unsigned char)), - gr::io_signature::make(1, 1, sizeof(unsigned char))) + gr::io_signature::make(1, 1, sizeof(unsigned char))), + Xs(0), + P(0), + Xp(0) { + frame_size_type = framesize; if (framesize == FECFRAME_NORMAL) { frame_size = FRAME_SIZE_NORMAL; frame_size_real = FRAME_SIZE_NORMAL; @@ -91,6 +95,14 @@ namespace gr { nbch = 58320; q_val = 18; break; + case C2_9_VLSNR: + nbch = 14400; + q_val = 140; + frame_size -= 3240; + frame_size_real -= 3240; + P = 15; + Xp = 3240; + break; case C13_45: nbch = 18720; q_val = 128; @@ -189,7 +201,7 @@ namespace gr { break; } } - else { + else if (framesize == FECFRAME_SHORT) { frame_size = FRAME_SIZE_SHORT; frame_size_real = FRAME_SIZE_SHORT; switch (rate) { @@ -261,6 +273,76 @@ namespace gr { nbch = 11520; q_val = 13; break; + case C1_5_VLSNR_SF2: + nbch = 2680; + q_val = 135; + frame_size -= 810; + frame_size_real -= 810; + Xs = 560; + P = 30; + Xp = 250; + break; + case C11_45_VLSNR_SF2: + nbch = 3960; + q_val = 34; + frame_size -= 810; + frame_size_real -= 810; + P = 15; + Xp = 810; + break; + case C1_5_VLSNR: + nbch = 3240; + q_val = 135; + frame_size -= 1224; + frame_size_real -= 1224; + P = 10; + Xp = 1224; + break; + case C4_15_VLSNR: + nbch = 4320; + q_val = 33; + frame_size -= 1224; + frame_size_real -= 1224; + P = 8; + Xp = 1224; + break; + case C1_3_VLSNR: + nbch = 5400; + q_val = 120; + frame_size -= 1224; + frame_size_real -= 1224; + P = 8; + Xp = 1224; + break; + default: + nbch = 0; + q_val = 0; + break; + } + } + else { + frame_size = FRAME_SIZE_MEDIUM - 1620; + frame_size_real = FRAME_SIZE_MEDIUM - 1620; + switch (rate) { + case C1_5_MEDIUM: + nbch = 5840; + q_val = 72; + Xs = 640; + P = 25; + Xp = 980; + break; + case C11_45_MEDIUM: + nbch = 7920; + q_val = 68; + P = 15; + Xp = 1620; + break; + case C1_3_MEDIUM: + nbch = 10800; + q_val = 60; + P = 13; + Xp = 1620; + break; default: nbch = 0; q_val = 0; @@ -312,10 +394,10 @@ for (int row = 0; row < ROWS; row++) { \ index = 0; im = 0; - pbits = frame_size - nbch; //number of parity bits + pbits = (frame_size_real + Xp) - nbch; //number of parity bits q = q_val; - if (frame_size_real == FRAME_SIZE_NORMAL) { + if (frame_size_type == FECFRAME_NORMAL) { if (code_rate == C1_4) { LDPC_BF(ldpc_tab_1_4N, 45); } @@ -354,6 +436,9 @@ for (int row = 0; row < ROWS; row++) { \ if (code_rate == C9_10) { LDPC_BF(ldpc_tab_9_10N, 162); } + if (code_rate == C2_9_VLSNR) { + LDPC_BF(ldpc_tab_2_9N, 40); + } if (code_rate == C13_45) { LDPC_BF(ldpc_tab_13_45N, 52); } @@ -424,7 +509,7 @@ for (int row = 0; row < ROWS; row++) { \ LDPC_BF(ldpc_tab_154_180N, 154); } } - else { + else if (frame_size_type == FECFRAME_SHORT) { if (code_rate == C1_4) { LDPC_BF(ldpc_tab_1_4S, 9); } @@ -481,6 +566,32 @@ for (int row = 0; row < ROWS; row++) { \ if (code_rate == C32_45) { LDPC_BF(ldpc_tab_32_45S, 32); } + if (code_rate == C1_5_VLSNR_SF2) { + LDPC_BF(ldpc_tab_1_4S, 9); + } + if (code_rate == C11_45_VLSNR_SF2) { + LDPC_BF(ldpc_tab_11_45S, 11); + } + if (code_rate == C1_5_VLSNR) { + LDPC_BF(ldpc_tab_1_4S, 9); + } + if (code_rate == C4_15_VLSNR) { + LDPC_BF(ldpc_tab_4_15S, 12); + } + if (code_rate == C1_3_VLSNR) { + LDPC_BF(ldpc_tab_1_3S, 15); + } + } + else { + if (code_rate == C1_5_MEDIUM) { + LDPC_BF(ldpc_tab_1_5M, 18); + } + if (code_rate == C11_45_MEDIUM) { + LDPC_BF(ldpc_tab_11_45M, 22); + } + if (code_rate == C1_3_MEDIUM) { + LDPC_BF(ldpc_tab_1_3M, 30); + } } ldpc_encode.table_length = index; } @@ -495,24 +606,54 @@ for (int row = 0; row < ROWS; row++) { \ unsigned char *out = (unsigned char *) output_items[0]; const unsigned char *d; unsigned char *p; + unsigned char *b; + unsigned char *s; // Calculate the number of parity bits - int plen = frame_size_real - nbch; + int plen = (frame_size_real + Xp) - nbch; d = in; p = &out[nbch]; int consumed = 0; + int puncture, index; for (int i = 0; i < noutput_items; i += frame_size) { + if (Xs != 0) { + s = &shortening_buffer[0]; + memset(s, 0, sizeof(unsigned char) * Xs); + memcpy(&s[Xs], &in[consumed], sizeof(unsigned char) * nbch); + d = s; + } + if (P != 0) { + p = &puncturing_buffer[nbch]; + b = &out[i + nbch]; + } // First zero all the parity bits - memset(p, 0, sizeof(unsigned char)*plen); - for(int j = 0; j < (int)nbch; j++) { + memset(p, 0, sizeof(unsigned char) * plen); + for (int j = 0; j < (int)nbch; j++) { out[i + j] = in[consumed]; consumed++; } // now do the parity checking - for(int j = 0; j < ldpc_encode.table_length; j++) { + for (int j = 0; j < ldpc_encode.table_length; j++) { p[ldpc_encode.p[j]] ^= d[ldpc_encode.d[j]]; } - for(int j = 1; j < plen; j++) { + if (P != 0) { + puncture = 0; + for (int j = 0; j < plen; j += P) { + p[j] = 0x55; + puncture++; + if (puncture == Xp) { + break; + } + } + index = 0; + for (int j = 0; j < plen; j++) { + if (p[j] != 0x55) { + b[index++] = p[j]; + } + } + p = &out[nbch]; + } + for (int j = 1; j < (plen - Xp); j++) { p[j] ^= p[j-1]; } if (signal_constellation == MOD_128APSK) { @@ -1946,6 +2087,50 @@ for (int row = 0; row < ROWS; row++) { \ {3,17,3392,1991,0} }; + const int dvb_ldpc_bb_impl::ldpc_tab_2_9N[40][12]= + { + {11,5332,8018,35444,13098,9655,41945,44273,22741,9371,8727,43219}, + {11,41410,43593,14611,46707,16041,1459,29246,12748,32996,676,46909}, + {11,9340,35072,35640,17537,10512,44339,30965,25175,9918,21079,29835}, + {11,3332,12088,47966,25168,50180,42842,40914,46726,17073,41812,34356}, + {11,15159,2209,7971,22590,20020,27567,4853,10294,38839,15314,49808}, + {11,20936,14497,23365,22630,38728,28361,34659,956,8559,44957,22222}, + {11,28043,4641,25208,47039,30612,25796,14661,44139,27335,12884,6980}, + {11,32584,33453,1867,20185,36106,30357,809,28513,46045,27862,4802}, + {11,43744,13375,36066,23604,30766,6233,45051,23660,20815,19525,25207}, + {11,27522,3854,9311,21925,41107,25773,26323,24237,24344,46187,44503}, + {11,10256,20038,12177,26635,5214,14191,34404,45807,4938,4173,31344}, + {11,32043,26501,46725,4648,16718,31060,26633,19036,14222,13886,26535}, + {11,18103,8498,36814,34600,36495,36712,29833,27396,11877,42861,1834}, + {11,36592,1645,3649,30521,14674,3630,890,13307,41412,24682,9907}, + {11,4401,44543,13784,5828,32862,25179,29736,39614,5186,49749,38317}, + {11,41460,39101,50080,40137,32691,26528,35332,44067,8467,14286,10470}, + {11,12211,34019,37870,36918,36419,33153,50070,41498,47741,30538,12342}, + {11,33751,23988,33624,41882,34075,25552,3106,17611,13190,29336,312}, + {11,5667,35483,35460,16153,37267,28308,50009,46345,34204,32756,38243}, + {11,5657,24157,36834,6890,49576,46244,43875,16738,47225,2944,36882}, + {3,30341,48485,3700,0,0,0,0,0,0,0,0}, + {3,14451,20438,18875,0,0,0,0,0,0,0,0}, + {3,13634,41138,42962,0,0,0,0,0,0,0,0}, + {3,46459,13369,27974,0,0,0,0,0,0,0,0}, + {3,21493,14629,2369,0,0,0,0,0,0,0,0}, + {3,11351,40226,42457,0,0,0,0,0,0,0,0}, + {3,34749,39000,3912,0,0,0,0,0,0,0,0}, + {3,18128,46776,47055,0,0,0,0,0,0,0,0}, + {3,2221,26806,11345,0,0,0,0,0,0,0,0}, + {3,35143,630,2229,0,0,0,0,0,0,0,0}, + {3,44009,41295,34646,0,0,0,0,0,0,0,0}, + {3,32163,16657,26544,0,0,0,0,0,0,0,0}, + {3,31770,23641,43623,0,0,0,0,0,0,0,0}, + {3,45826,10902,39490,0,0,0,0,0,0,0,0}, + {3,7514,20480,28511,0,0,0,0,0,0,0,0}, + {3,11429,19834,35430,0,0,0,0,0,0,0,0}, + {3,50112,38163,5738,0,0,0,0,0,0,0,0}, + {3,16191,16862,6783,0,0,0,0,0,0,0,0}, + {3,6085,39149,34988,0,0,0,0,0,0,0,0}, + {3,41497,32023,28688,0,0,0,0,0,0,0,0} + }; + const int dvb_ldpc_bb_impl::ldpc_tab_13_45N[52][13]= { {12,15210,4519,18217,34427,18474,16813,28246,17687,44527,31465,13004,43601}, @@ -5178,6 +5363,88 @@ for (int row = 0; row < ROWS; row++) { \ {3,1523,3311,389,0,0,0,0,0,0,0,0,0} }; + const int dvb_ldpc_bb_impl::ldpc_tab_1_5M[18][14]= + { + {13,18222,6715,4908,21568,22821,11708,4769,4495,22243,25872,9051,19072,13956}, + {13,2038,5205,21215,21009,9584,2403,23652,20866,20130,677,9509,6136,773}, + {13,19936,14590,17829,473,4432,23171,11386,17937,22084,24450,267,8822,19335}, + {13,16376,16769,5111,9794,18907,827,12385,12370,21647,10938,23619,11633,15865}, + {13,23417,7631,12243,21546,4192,22117,14757,4118,9686,17021,8531,15989,8807}, + {13,15533,16584,18529,19699,17821,4252,1254,5952,3163,20295,6944,1022,19743}, + {13,129,16579,23524,25897,14690,11222,16250,9925,4268,999,7102,24528,152}, + {13,18361,3708,3454,16604,1551,5809,20324,4775,22418,19091,19674,10975,7327}, + {13,24133,10950,22779,11388,13818,20668,7556,12333,16446,19684,12510,25118,8162}, + {3,17026,6850,1269,0,0,0,0,0,0,0,0,0,0}, + {3,21895,7137,25270,0,0,0,0,0,0,0,0,0,0}, + {3,11858,24153,13303,0,0,0,0,0,0,0,0,0,0}, + {3,7885,16438,12805,0,0,0,0,0,0,0,0,0,0}, + {3,10473,15004,8052,0,0,0,0,0,0,0,0,0,0}, + {3,2088,10379,10067,0,0,0,0,0,0,0,0,0,0}, + {3,21438,13426,10440,0,0,0,0,0,0,0,0,0,0}, + {3,17696,727,12164,0,0,0,0,0,0,0,0,0,0}, + {3,22623,8408,17849,0,0,0,0,0,0,0,0,0,0} + }; + + const int dvb_ldpc_bb_impl::ldpc_tab_11_45M[22][11]= + { + {10,20617,6867,14845,11974,22563,190,17207,4052,7406,16007}, + {10,21448,14846,2543,23380,16633,20365,16869,13411,19853,795}, + {10,5200,2330,2775,23620,20643,10745,14742,6493,14222,20939}, + {10,9445,9523,12769,7332,21792,18717,16397,14016,9481,22162}, + {10,2922,6427,4497,4116,17658,2581,14364,3781,18851,22974}, + {10,10383,2184,1433,3889,12828,17424,17580,20936,1390,21374}, + {10,425,2063,22398,20907,9445,14790,4457,723,7048,4072}, + {10,11771,9640,23212,9613,12042,8335,21386,20129,13521,16301}, + {10,14867,12501,1086,21526,17701,17731,20907,8790,19224,5784}, + {10,7107,19690,17616,5800,9501,23320,16878,794,15931,17539}, + {3,4556,21783,1524,0,0,0,0,0,0,0}, + {3,20100,11706,23663,0,0,0,0,0,0,0}, + {3,2535,15530,6116,0,0,0,0,0,0,0}, + {3,12078,3867,2663,0,0,0,0,0,0,0}, + {3,19629,20246,7024,0,0,0,0,0,0,0}, + {3,11748,11426,19802,0,0,0,0,0,0,0}, + {3,15942,12333,5316,0,0,0,0,0,0,0}, + {3,11521,3170,17818,0,0,0,0,0,0,0}, + {3,2289,23780,16575,0,0,0,0,0,0,0}, + {3,6649,16991,13025,0,0,0,0,0,0,0}, + {3,20050,10619,10250,0,0,0,0,0,0,0}, + {3,3944,13063,5656,0,0,0,0,0,0,0} + }; + + const int dvb_ldpc_bb_impl::ldpc_tab_1_3M[30][13]= + { + {12,7416,4093,16722,1023,20586,12219,9175,16284,1554,10113,19849,17545}, + {12,13140,3257,2110,13888,3023,1537,1598,15018,18931,13905,10617,1014}, + {12,339,14366,3309,15360,18358,3196,4412,6023,7070,17380,2777,6691}, + {12,12720,17634,4141,1400,8247,18201,16077,11314,11928,3494,3155,2865}, + {12,21038,6928,3860,1943,20292,6526,12939,15182,3957,5651,356,2673}, + {12,20555,17905,5724,13932,1218,17763,5912,5164,6233,6220,1277,19209}, + {12,19190,4498,4950,6645,5482,5667,13701,16334,15231,735,8589,12344}, + {12,679,17849,17807,16033,10181,3368,5778,8275,2736,14042,17506,6005}, + {12,1576,10259,10525,3007,16522,697,7726,8641,14323,2893,8168,11070}, + {12,17270,10180,18740,847,4969,14715,19316,5530,17428,11193,9861,13562}, + {3,6156,18787,10467,0,0,0,0,0,0,0,0,0}, + {3,2422,3723,10769,0,0,0,0,0,0,0,0,0}, + {3,8015,18716,13406,0,0,0,0,0,0,0,0,0}, + {3,5969,15949,3084,0,0,0,0,0,0,0,0,0}, + {3,6855,13990,3764,0,0,0,0,0,0,0,0,0}, + {3,10351,15779,10392,0,0,0,0,0,0,0,0,0}, + {3,16078,19034,11279,0,0,0,0,0,0,0,0,0}, + {3,11747,6608,4188,0,0,0,0,0,0,0,0,0}, + {3,19699,8928,8045,0,0,0,0,0,0,0,0,0}, + {3,4598,7219,11391,0,0,0,0,0,0,0,0,0}, + {3,19766,11871,5692,0,0,0,0,0,0,0,0,0}, + {3,7487,15905,17621,0,0,0,0,0,0,0,0,0}, + {3,8554,7751,16516,0,0,0,0,0,0,0,0,0}, + {3,4981,20250,16146,0,0,0,0,0,0,0,0,0}, + {3,12524,21364,10793,0,0,0,0,0,0,0,0,0}, + {3,17083,2051,8862,0,0,0,0,0,0,0,0,0}, + {3,1315,6246,7721,0,0,0,0,0,0,0,0,0}, + {3,18043,16652,5502,0,0,0,0,0,0,0,0,0}, + {3,1432,5674,2224,0,0,0,0,0,0,0,0,0}, + {3,11257,1312,8453,0,0,0,0,0,0,0,0,0} + }; + } /* namespace dtv */ } /* namespace gr */ |