Skip to content

Commit

Permalink
Merge pull request #105 from BatchDrake/develop
Browse files Browse the repository at this point in the history
Make master up to date
  • Loading branch information
BatchDrake committed Feb 12, 2024
2 parents ed27281 + 0e5b64a commit dd4bdcf
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cmake/cmake-pcfilegenerator
7 changes: 7 additions & 0 deletions src/include/sigutils/specttuner.h
Expand Up @@ -266,6 +266,13 @@ SU_METHOD(su_specttuner, void, force_state, enum sigutils_specttuner_state state
self->state = state;
}

SUINLINE
SU_GETTER(su_specttuner, SUBOOL, uses_early_windowing)
{
return self->params.early_windowing;
}


#ifndef __cplusplus

/* Internal */
Expand Down
34 changes: 22 additions & 12 deletions src/sigutils/specttuner.c
Expand Up @@ -796,38 +796,48 @@ __su_specttuner_feed_channel(
self->fft + window_size - (channel->halfw - len),
(channel->halfw - len) * sizeof(SUCOMPLEX));

if (channel->params.domain == SU_SPECTTUNER_CHANNEL_TIME_DOMAIN) {
/*********************** Apply filter and scaling ************************/
#ifdef SU_SPECTTUNER_SQUARE_FILTER
for (i = 0; i < channel->halfw; ++i)
channel->fft[i] *= channel->k;
for (i = 0; i < channel->halfw; ++i)
channel->fft[i] *= channel->k;

for (i = channel->size - channel->halfw; i < channel->size; ++i)
channel->fft[i] *= channel->k;
for (i = channel->size - channel->halfw; i < channel->size; ++i)
channel->fft[i] *= channel->k;
#else
for (i = 0; i < channel->halfsz; ++i) {
channel->fft[i] *= channel->k * channel->h[i];
channel->fft[channel->size - i - 1] *=
channel->k * channel->h[window_size - i - 1];
}
for (i = 0; i < channel->halfsz; ++i) {
channel->fft[i] *= channel->k * channel->h[i];
channel->fft[channel->size - i - 1] *=
channel->k * channel->h[window_size - i - 1];
}
#endif
/************************* Back to time domain******************************/
if (channel->params.domain == SU_SPECTTUNER_CHANNEL_FREQUENCY_DOMAIN) {
} else {
/* Channel is defined in the frequency domain. This means that we
do not need to perform get back to the time domain (hence we can
go ahead and skip one IFFT completely) */

if (self->state == SU_SPECTTUNER_STATE_EVEN) {
memcpy(
channel->fft + channel->halfw,
channel->fft + channel->size - channel->halfw,
channel->halfw * sizeof(SUCOMPLEX));

for (i = 0; i < channel->width; ++i)
channel->fft[i] *= channel->k;

curr = channel->fft;

return (channel->params.on_data)(
channel,
channel->params.privdata,
curr,
channel->size);
channel->width);
} else {
return SU_TRUE;
}
}

/************************* Back to time domain******************************/
SU_FFTW(_execute)(channel->plan[self->state]);

curr = channel->ifft[self->state];
Expand Down

0 comments on commit dd4bdcf

Please sign in to comment.