mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-23 12:18:37 -05:00
firpfbch2->firpfbch experiment
- My assumption about this not working correctly may be wrong, this actually seems to work ok compared to firpfbch2
This commit is contained in:
parent
9da484e8ce
commit
beccdf8c63
@ -56,11 +56,11 @@ bool SDRPostThread::getSwapIQ() {
|
|||||||
void SDRPostThread::initPFBChannelizer() {
|
void SDRPostThread::initPFBChannelizer() {
|
||||||
// std::cout << "Initializing post-process FIR polyphase filterbank channelizer with " << numChannels << " channels." << std::endl;
|
// std::cout << "Initializing post-process FIR polyphase filterbank channelizer with " << numChannels << " channels." << std::endl;
|
||||||
if (channelizer) {
|
if (channelizer) {
|
||||||
firpfbch2_crcf_destroy(channelizer);
|
firpfbch_crcf_destroy(channelizer);
|
||||||
}
|
}
|
||||||
channelizer = firpfbch2_crcf_create_kaiser(LIQUID_ANALYZER, numChannels, 1, 60);
|
channelizer = firpfbch_crcf_create_kaiser(LIQUID_ANALYZER, numChannels, 4, 60);
|
||||||
|
|
||||||
chanBw = (sampleRate / numChannels) * 2;
|
chanBw = (sampleRate / numChannels);
|
||||||
|
|
||||||
chanCenters.resize(numChannels);
|
chanCenters.resize(numChannels);
|
||||||
demodChannelActive.resize(numChannels);
|
demodChannelActive.resize(numChannels);
|
||||||
@ -122,7 +122,7 @@ void SDRPostThread::updateActiveDemodulators() {
|
|||||||
void SDRPostThread::updateChannels() {
|
void SDRPostThread::updateChannels() {
|
||||||
// calculate channel center frequencies, todo: cache
|
// calculate channel center frequencies, todo: cache
|
||||||
for (int i = 0; i < numChannels/2; i++) {
|
for (int i = 0; i < numChannels/2; i++) {
|
||||||
int ofs = ((chanBw/2) * i);
|
int ofs = ((chanBw) * i);
|
||||||
chanCenters[i] = frequency + ofs;
|
chanCenters[i] = frequency + ofs;
|
||||||
chanCenters[i+(numChannels/2)] = frequency - (sampleRate/2) + ofs;
|
chanCenters[i+(numChannels/2)] = frequency - (sampleRate/2) + ofs;
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ void SDRPostThread::run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int dataSize = data_in->data.size();
|
int dataSize = data_in->data.size();
|
||||||
int outSize = data_in->data.size()*2;
|
int outSize = data_in->data.size();
|
||||||
|
|
||||||
if (outSize > dataOut.capacity()) {
|
if (outSize > dataOut.capacity()) {
|
||||||
dataOut.reserve(outSize);
|
dataOut.reserve(outSize);
|
||||||
@ -215,14 +215,14 @@ void SDRPostThread::run() {
|
|||||||
// Find active demodulators
|
// Find active demodulators
|
||||||
if (nRunDemods) {
|
if (nRunDemods) {
|
||||||
|
|
||||||
for (int i = 0; i < numChannels; i++) {
|
// for (int i = 0; i < numChannels; i++) {
|
||||||
firpfbch2_crcf_set_channel_state(channelizer, i, (demodChannelActive[i]>0)?1:0);
|
// firpfbch_crcf_set_channel_state(channelizer, i, (demodChannelActive[i]>0)?1:0);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// channelize data
|
// channelize data
|
||||||
// firpfbch2 output rate is 2 x ( input rate / channels )
|
// firpfbch2 output rate is 2 x ( input rate / channels )
|
||||||
for (int i = 0, iMax = dataSize; i < iMax; i+=numChannels/2) {
|
for (int i = 0, iMax = dataSize; i < iMax; i+=numChannels) {
|
||||||
firpfbch2_crcf_execute(channelizer, &data_in->data[i], &dataOut[i * 2]);
|
firpfbch_crcf_analyzer_execute(channelizer, &data_in->data[i], &dataOut[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0, iMax = numChannels; i < iMax; i++) {
|
for (int i = 0, iMax = numChannels; i < iMax; i++) {
|
||||||
|
@ -50,5 +50,5 @@ private:
|
|||||||
atomic_bool doRefresh;
|
atomic_bool doRefresh;
|
||||||
int numChannels, sampleRate;
|
int numChannels, sampleRate;
|
||||||
long long frequency;
|
long long frequency;
|
||||||
firpfbch2_crcf channelizer;
|
firpfbch_crcf channelizer;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user