File: encode_rs_impl.h

package info (click to toggle)
gr-satellites 5.8.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,836 kB
  • sloc: python: 29,546; cpp: 5,448; ansic: 1,247; sh: 118; makefile: 24
file content (68 lines) | stat: -rw-r--r-- 1,799 bytes parent folder | download
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
/* -*- c++ -*- */
/*
 * Copyright 2018,2020, 2024 Daniel Estevez <daniel@destevez.net>
 *
 * This file is part of gr-satellites
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 */

#ifndef INCLUDED_SATELLITES_ENCODE_RS_IMPL_H
#define INCLUDED_SATELLITES_ENCODE_RS_IMPL_H

#include <satellites/encode_rs.h>

#include <cstdint>
#include <functional>
#include <vector>

namespace gr {
namespace satellites {

class encode_rs_impl : public encode_rs
{
private:
    int d_interleave;
    std::vector<uint8_t> d_rs_codeword;
    std::vector<uint8_t> d_output_frame;
    int d_nroots;
    void* d_rs_p = NULL;
    const int d_frame_size; // used only with vector stream IO

    std::function<void(uint8_t*)> d_encode_rs;

    constexpr static int d_ccsds_nn = 255;
    constexpr static int d_ccsds_nroots = 32;

    void setup_ccsds(bool dual_basis);
    void setup_generic(int symsize, int gfpoly, int fcr, int prim, int nroots);
    void check_interleave();
    void check_frame_size();
    void set_message_ports();

public:
    encode_rs_impl(bool dual_basis, int interleave = 1);
    encode_rs_impl(int frame_size, bool dual_basis, int interleave = 1);
    encode_rs_impl(
        int symsize, int gfpoly, int fcr, int prim, int nroots, int interleave = 1);
    encode_rs_impl(int frame_size,
                   int symsize,
                   int gfpoly,
                   int fcr,
                   int prim,
                   int nroots,
                   int interleave);
    ~encode_rs_impl() override;

    int work(int noutput_items,
             gr_vector_const_void_star& input_items,
             gr_vector_void_star& output_items) override;

    void msg_handler(pmt::pmt_t pmt_msg);
};

} // namespace satellites
} // namespace gr

#endif /* INCLUDED_SATELLITES_ENCODE_RS_IMPL_H */