mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-07-03 15:38:08 +02:00
added rx888
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <dsp/block.h>
|
||||
#include <volk/volk.h>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
@ -138,6 +139,14 @@ namespace dsp {
|
||||
volk_32fc_magnitude_32f(out.data, (lv_32fc_t*)_in->data, count);
|
||||
|
||||
_in->flush();
|
||||
|
||||
volk_32f_accumulator_s32f(&avg, out.data, count);
|
||||
avg /= (float)count;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
out.data[i] -= avg;
|
||||
}
|
||||
|
||||
out.write(count);
|
||||
return count;
|
||||
}
|
||||
@ -145,6 +154,7 @@ namespace dsp {
|
||||
stream<float> out;
|
||||
|
||||
private:
|
||||
float avg;
|
||||
int count;
|
||||
stream<complex_t>* _in;
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
#include <dsp/block.h>
|
||||
#include <dsp/window.h>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace dsp {
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include <dsp/block.h>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <fftw3.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace dsp {
|
||||
class FrequencyXlator : public generic_block<FrequencyXlator> {
|
||||
@ -75,4 +75,56 @@ namespace dsp {
|
||||
stream<complex_t>* _in;
|
||||
|
||||
};
|
||||
|
||||
class AGC : public generic_block<AGC> {
|
||||
public:
|
||||
AGC() {}
|
||||
|
||||
AGC(stream<float>* in, float ratio) { init(in, ratio); }
|
||||
|
||||
~AGC() { generic_block<AGC>::stop(); }
|
||||
|
||||
void init(stream<float>* in, float ratio) {
|
||||
_in = in;
|
||||
_ratio = ratio;
|
||||
generic_block<AGC>::registerInput(_in);
|
||||
generic_block<AGC>::registerOutput(&out);
|
||||
}
|
||||
|
||||
void setInputSize(stream<float>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<AGC>::ctrlMtx);
|
||||
generic_block<AGC>::tempStop();
|
||||
generic_block<AGC>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<AGC>::registerInput(_in);
|
||||
generic_block<AGC>::tempStart();
|
||||
}
|
||||
|
||||
int run() {
|
||||
count = _in->read();
|
||||
if (count < 0) { return -1; }
|
||||
|
||||
if (out.aquire() < 0) { return -1; }
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
level = (fabsf(_in->data[i]) * _ratio) + (level * (1.0f - _ratio));
|
||||
out.data[i] = _in->data[i] / level;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_in->flush();
|
||||
out.write(count);
|
||||
return count;
|
||||
}
|
||||
|
||||
stream<float> out;
|
||||
|
||||
private:
|
||||
int count;
|
||||
float level = 1.0f;
|
||||
float _ratio;
|
||||
stream<float>* _in;
|
||||
|
||||
};
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
#include <dsp/block.h>
|
||||
#include <dsp/window.h>
|
||||
#include <numeric>
|
||||
#include <string.h>
|
||||
|
||||
namespace dsp {
|
||||
template <class T>
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include <dsp/block.h>
|
||||
#include <dsp/buffer.h>
|
||||
#include <cstring>
|
||||
#include <string.h>
|
||||
#include <numeric>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace dsp {
|
||||
void setCutoff(float cutoff) {
|
||||
_cutoff = cutoff;
|
||||
}
|
||||
|
||||
|
||||
void setTransWidth(float transWidth) {
|
||||
_transWidth = transWidth;
|
||||
}
|
||||
|
Reference in New Issue
Block a user