Skip to content

Commit

Permalink
firdecim: adding method to return decimation rate, autotest
Browse files Browse the repository at this point in the history
  • Loading branch information
jgaeddert committed Jun 7, 2020
1 parent d033a39 commit ff73535
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
3 changes: 3 additions & 0 deletions include/liquid.h
Original file line number Diff line number Diff line change
Expand Up @@ -3477,6 +3477,9 @@ void FIRDECIM(_print)(FIRDECIM() _q); \
/* Reset decimator object internal state */ \
void FIRDECIM(_reset)(FIRDECIM() _q); \
\
/* Get decimation rate */ \
unsigned int FIRDECIM(_get_decim_rate)(FIRDECIM() _q); \
\
/* Set output scaling for decimator */ \
/* _q : decimator object */ \
/* _scale : scaling factor to apply to each output sample */ \
Expand Down
8 changes: 7 additions & 1 deletion src/filter/src/firdecim.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007 - 2018 Joseph Gaeddert
* Copyright (c) 2007 - 2020 Joseph Gaeddert
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -190,6 +190,12 @@ void FIRDECIM(_reset)(FIRDECIM() _q)
WINDOW(_reset)(_q->w);
}

// Get decimation rate
unsigned int FIRDECIM(_get_decim_rate)(FIRDECIM() _q)
{
return _q->M;
}

// Set output scaling for decimator
// _q : decimator object
// _scale : scaling factor to apply to each output sample
Expand Down
16 changes: 15 additions & 1 deletion src/filter/tests/firdecim_xxxf_autotest.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007 - 2015 Joseph Gaeddert
* Copyright (c) 2007 - 2020 Joseph Gaeddert
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -30,6 +30,20 @@
// autotest data definitions
#include "src/filter/tests/firdecim_autotest.h"

void autotest_firdecim_rrrf_common()
{
firdecim_rrrf decim = firdecim_rrrf_create_kaiser(17, 4, 60.0f);
CONTEND_EQUALITY(firdecim_rrrf_get_decim_rate(decim), 17);
firdecim_rrrf_destroy(decim);
}

void autotest_firdecim_crcf_common()
{
firdecim_crcf decim = firdecim_crcf_create_kaiser(7, 4, 60.0f);
CONTEND_EQUALITY(firdecim_crcf_get_decim_rate(decim), 7);
firdecim_crcf_destroy(decim);
}

//
// AUTOTEST: firdecim_rrrf tests
//
Expand Down

0 comments on commit ff73535

Please sign in to comment.