Skip to content

Commit

Permalink
Add support for frequency-domain inspectors
Browse files Browse the repository at this point in the history
  • Loading branch information
BatchDrake committed Apr 11, 2023
1 parent e43910b commit da091d4
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 9 deletions.
19 changes: 19 additions & 0 deletions sigutils/specttuner.c
Expand Up @@ -736,6 +736,25 @@ __su_specttuner_feed_channel(
}
#endif
/************************* Back to time domain******************************/
if (channel->params.domain == SU_SPECTTUNER_CHANNEL_FREQUENCY_DOMAIN) {
/* 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) */

channel->state = !channel->state;

if (channel->state == SU_SPECTTUNER_STATE_EVEN) {
curr = channel->fft;
return (channel->params.on_data)(
channel,
channel->params.privdata,
curr,
channel->size);
} else {
return SU_TRUE;
}
}

SU_FFTW(_execute)(channel->plan[channel->state]);

curr = channel->ifft[channel->state];
Expand Down
35 changes: 26 additions & 9 deletions sigutils/specttuner.h
Expand Up @@ -48,6 +48,11 @@ enum sigutils_specttuner_state {
SU_SPECTTUNER_STATE_ODD,
};

enum sigutils_specttuner_channel_domain {
SU_SPECTTUNER_CHANNEL_TIME_DOMAIN,
SU_SPECTTUNER_CHANNEL_FREQUENCY_DOMAIN
};

struct sigutils_specttuner_channel;

struct sigutils_specttuner_channel_params {
Expand All @@ -56,6 +61,7 @@ struct sigutils_specttuner_channel_params {
SUFLOAT bw; /* Bandwidth (angular frequency) */
SUFLOAT guard; /* Relative extra bandwidth */
SUBOOL precise; /* Precision mode */
enum sigutils_specttuner_channel_domain domain; /* Domain */
void *privdata; /* Private data */
SUBOOL(*on_data)
(const struct sigutils_specttuner_channel *channel,
Expand All @@ -65,15 +71,16 @@ struct sigutils_specttuner_channel_params {
SUSCOUNT size);
};

#define sigutils_specttuner_channel_params_INITIALIZER \
{ \
0, /* f0 */ \
0, /* delta_f */ \
0, /* bw */ \
1, /* guard */ \
SU_FALSE, /* precise */ \
NULL, /* private */ \
NULL, /* on_data */ \
#define sigutils_specttuner_channel_params_INITIALIZER \
{ \
0, /* f0 */ \
0, /* delta_f */ \
0, /* bw */ \
1, /* guard */ \
SU_FALSE, /* precise */ \
SU_SPECTTUNER_CHANNEL_TIME_DOMAIN, /* domain */ \
NULL, /* private */ \
NULL, /* on_data */ \
}

struct sigutils_specttuner_channel {
Expand Down Expand Up @@ -135,6 +142,16 @@ SU_GETTER(su_specttuner_channel, SUFLOAT, get_delta_f)
return self->params.delta_f;
}

SUINLINE
SU_METHOD(
su_specttuner_channel,
void,
set_domain,
enum sigutils_specttuner_channel_domain dom)
{
self->params.domain = dom;
}

SUINLINE
SU_GETTER(su_specttuner_channel, SUFLOAT, get_effective_freq)
{
Expand Down

0 comments on commit da091d4

Please sign in to comment.