summaryrefslogtreecommitdiffstats
path: root/src/MemlessPoly.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-09-13 18:55:39 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-09-13 18:55:39 +0200
commit1ca5368f547c429bf0d86dac78162310e1d2b032 (patch)
tree6c6949b3ecf235ab18a6d21af6d3ad6105190d67 /src/MemlessPoly.h
parent4f9372c130960559a0bba13828a810eb57e30123 (diff)
downloaddabmod-1ca5368f547c429bf0d86dac78162310e1d2b032.tar.gz
dabmod-1ca5368f547c429bf0d86dac78162310e1d2b032.tar.bz2
dabmod-1ca5368f547c429bf0d86dac78162310e1d2b032.zip
Add LUT predistorter
Diffstat (limited to 'src/MemlessPoly.h')
-rw-r--r--src/MemlessPoly.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/MemlessPoly.h b/src/MemlessPoly.h
index 57c0924..612934f 100644
--- a/src/MemlessPoly.h
+++ b/src/MemlessPoly.h
@@ -49,6 +49,12 @@
typedef std::complex<float> complexf;
+enum class dpd_type_t {
+ odd_only_poly,
+ lookup_table
+};
+
+
class MemlessPoly : public PipelinedModCodec, public RemoteControllable
{
public:
@@ -71,8 +77,16 @@ private:
struct input_data_t {
bool terminate = false;
+ dpd_type_t dpd_type;
+
+ // Valid for polynomial types
const float *coefs_am = nullptr;
const float *coefs_pm = nullptr;
+
+ // Valid for LUT
+ float lut_scalefactor = 0.0f;
+ const complexf *lut = nullptr;
+
const complexf *in = nullptr;
size_t start = 0;
size_t stop = 0;
@@ -112,8 +126,16 @@ private:
static void worker_thread(worker_t *workerdata);
+ bool m_dpd_settings_valid = false;
+ dpd_type_t m_dpd_type;
std::vector<float> m_coefs_am; // AM/AM coefficients
std::vector<float> m_coefs_pm; // AM/PM coefficients
+
+ float m_lut_scalefactor; // Scale value applied before looking up in LUT
+
+ static constexpr size_t lut_entries = 32;
+ std::array<complexf, lut_entries> m_lut; // Lookup table correction factors
+
std::string m_coefs_file;
mutable std::mutex m_coefs_mutex;
};