diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-05-17 17:48:22 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-05-20 21:39:37 +0200 |
commit | 8a4f546b85d0887d1d5af0a428753c7d31304b72 (patch) | |
tree | 220fddd2933e3b0ab93944552d44fe904a34e2ec /src/dabOutput/edi/PFT.h | |
parent | 598bee55402280ff4ca6dedcbd212017a57e482e (diff) | |
download | dabmux-8a4f546b85d0887d1d5af0a428753c7d31304b72.tar.gz dabmux-8a4f546b85d0887d1d5af0a428753c7d31304b72.tar.bz2 dabmux-8a4f546b85d0887d1d5af0a428753c7d31304b72.zip |
add non-working PFT layer
Diffstat (limited to 'src/dabOutput/edi/PFT.h')
-rw-r--r-- | src/dabOutput/edi/PFT.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/dabOutput/edi/PFT.h b/src/dabOutput/edi/PFT.h new file mode 100644 index 0000000..713170f --- /dev/null +++ b/src/dabOutput/edi/PFT.h @@ -0,0 +1,77 @@ +/* + Copyright (C) 2013 Matthias P. Braendli + http://mpb.li + + EDI output, + Protection, Fragmentation and Transport. (PFT) + + Are supported: + Reed-Solomon and Fragmentation + + This implements part of PFT as defined ETSI TS 102 821. + + */ +/* + This file is part of CRC-DabMux. + + CRC-DabMux 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 of the + License, or (at your option) any later version. + + CRC-DabMux 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 CRC-DabMux. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _PFT_H_ +#define _PFT_H_ + +#include "config.h" +#include <vector> +#include <list> +#include <stdint.h> +#include "AFPacket.h" +#include "Log.h" +#include "ReedSolomon.h" + +typedef std::vector<uint8_t> RSPacket; + +class PFT +{ + public: + static const int ParityBytes = 255 - 207; + + PFT(unsigned int RSDataWordLength, unsigned int NumRecoverableFragments) : + m_k(RSDataWordLength), m_m(NumRecoverableFragments), m_encoder(255, 207) + { + if (m_m > 5) { + etiLog.level(warn) << + "EDI PFT: high number of recoverable fragments" + " may lead to large overhead"; + // See TS 102 821, 7.2.1 Known values, list entry for 'm' + } + } + + // Apply Reed-Solomon FEC to the AF Packet + RSPacket Protect(AFPacket af_packet); + + // Cut a RSPacket into several fragments that can be transmitted + std::vector< std::vector<uint8_t> > ProtectAndFragment(AFPacket af_packet); + + private: + unsigned int m_k; // length of RS data word + unsigned int m_m; // number of fragments that can be recovered if lost + + size_t m_num_chunks; + + ReedSolomon m_encoder; + +}; + +#endif + |