Skip to content

C implementation of the CIC filter for decimation and interpolation.

License

Notifications You must be signed in to change notification settings

satirebird/cic-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Configurable CIC-Filter for interpolation and decimation

  • C implementation of the CIC filter for decimation and interpolation.
  • Configurable data type
  • With or without memory allocation
  • Single buffer operation
  • CUnit tests

Usage

Copy the cic_config.template to you project with the name cic_config.h.

#include cic_filter.h

#define N 4
#define M 1
#define R 5

#define BLOCK_LEN 128

cic_t buffer[BLOCK_LEN * R]

struct cic_filter filter;

if (cic_filter_init(&filter, N, M, R, NULL, true) < 0)
	return -1;

size_t rlen;	

// Calculate the interpolation. The result is located in buffer with rlen elements.
rlen = cic_filter_interpolate(&filter, buffer, BLOCK_LEN * R, BLOCK_LEN);

// Calculate the decimation. The result is located in buffer with rlen elements.
rlen = cic_filter_decimate(&filter, buffer, rlen);

Unit tests

CUnit must be installed on you system. For Debian / Ubuntu apt install libcunit1 can be used.

The unit test can be executed with

make test
./cic_test

Literature

About

C implementation of the CIC filter for decimation and interpolation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published