aboutsummaryrefslogtreecommitdiffstats
path: root/src/FormatConverter.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2022-08-18 13:15:57 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2022-08-18 13:15:57 +0200
commit0280bd327598342b5562ce11645fae8fcf649e2a (patch)
tree1aba24a32b05f1a71e8f4c0fe059ee6132454504 /src/FormatConverter.cpp
parent6087160593e74aff9147153c69ea23849fc8b921 (diff)
downloaddabmod-0280bd327598342b5562ce11645fae8fcf649e2a.tar.gz
dabmod-0280bd327598342b5562ce11645fae8fcf649e2a.tar.bz2
dabmod-0280bd327598342b5562ce11645fae8fcf649e2a.zip
Improve DEXTER SFN support
Diffstat (limited to 'src/FormatConverter.cpp')
-rw-r--r--src/FormatConverter.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/FormatConverter.cpp b/src/FormatConverter.cpp
index 0f86d42..cda8a4d 100644
--- a/src/FormatConverter.cpp
+++ b/src/FormatConverter.cpp
@@ -2,7 +2,7 @@
Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Her Majesty
the Queen in Right of Canada (Communications Research Center Canada)
- Copyright (C) 2017
+ Copyright (C) 2022
Matthias P. Braendli, matthias.braendli@mpb.li
http://opendigitalradio.org
@@ -34,10 +34,6 @@
#include <stdexcept>
#include <assert.h>
-#ifdef __SSE__
-# include <xmmintrin.h>
-#endif
-
FormatConverter::FormatConverter(const std::string& format) :
ModCodec(),
m_format(format)
@@ -68,7 +64,7 @@ int FormatConverter::process(Buffer* const dataIn, Buffer* dataOut)
out[i] = in[i] + 128;
}
}
- else {
+ else if (m_format == "s8") {
dataOut->setLength(sizeIn * sizeof(int8_t));
int8_t* out = reinterpret_cast<int8_t*>(dataOut->getData());
@@ -76,6 +72,9 @@ int FormatConverter::process(Buffer* const dataIn, Buffer* dataOut)
out[i] = in[i];
}
}
+ else {
+ throw std::runtime_error("FormatConverter: Invalid format " + m_format);
+ }
return dataOut->getLength();
}
@@ -85,3 +84,19 @@ const char* FormatConverter::name()
return "FormatConverter";
}
+size_t FormatConverter::get_format_size() const
+{
+ // Returns 2*sizeof(SAMPLE_TYPE) because we have I + Q
+ if (m_format == "s16") {
+ return 4;
+ }
+ else if (m_format == "u8") {
+ return 2;
+ }
+ else if (m_format == "s8") {
+ return 2;
+ }
+ else {
+ throw std::runtime_error("FormatConverter: Invalid format " + m_format);
+ }
+}