File: ldpc_decoder.cpp

package info (click to toggle)
satdump 1.2.2%2Bgb79af48-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 81,648 kB
  • sloc: cpp: 276,768; ansic: 164,598; lisp: 1,219; sh: 283; xml: 106; makefile: 7
file content (40 lines) | stat: -rw-r--r-- 1,238 bytes parent folder | download | duplicates (2)
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
#include "ldpc_decoder.h"
#include "core/plugin.h"

#include "common/cpu_features.h"

#include "ldpc_decoder_generic.h"

namespace codings
{
    namespace ldpc
    {
        LDPCDecoder::LDPCDecoder(Sparse_matrix)
        {
        }

        LDPCDecoder::~LDPCDecoder()
        {
        }

        LDPCDecoder *get_best_ldpc_decoder(Sparse_matrix pcm)
        {
            std::map<std::string, std::function<LDPCDecoder *(Sparse_matrix)>> decoder_list;

            satdump::eventBus->fire_event<GetLDPCDecodersEvent>({decoder_list});
            decoder_list.insert({"generic", [](Sparse_matrix pcm)
                                 { return new LDPCDecoderGeneric(pcm); }});

            cpu_features::cpu_features_t cpu_caps = cpu_features::get_cpu_features();

            if (cpu_caps.CPU_X86_AVX2 && decoder_list.count("avx2") > 0)
                return decoder_list["avx2"](pcm);
            else if (cpu_caps.CPU_X86_SSE41 && decoder_list.count("sse41") > 0)
                return decoder_list["sse41"](pcm);
            else if (cpu_caps.CPU_ARM_NEON && decoder_list.count("neon") > 0)
                return decoder_list["neon"](pcm);
            else
                return decoder_list["generic"](pcm);
        }
    }
}