All pastes #950265 Raw Edit

Reduce ringing

public c v1 · immutable
·published 2008-03-20 13:28 UTC
rendered paste body
/* * Reduces ringing artifacts from a sample * after backwards Fourier transform. (The * outcome doesn't actually sound very nice, * though.) */voideliminate_ringing (float *data, uint32_t nframes){	uint32_t i;	float x, *x2, x3;	for (i = 0; i < nframes; ++i)	{		x = data[i];		if (i + 2 < nframes)		{			x2 = &data[i + 1];			x3 = data[i + 2];		}		else if (i + 1 < nframes)		{			x2 = &data[i + 1];			x3 = data[0];		}		else		{			x2 = &data[0];			x3 = data[1];		}		if (x <= *x2)		{			if (*x2 > x3)			{				*x2 = x;			}		}		else if (*x2 < x3)		{			*x2 = x;		}	}}