/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
short filter(short x)
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
short filter(short x)
{
	static short s[6] = {0, 0, 0, 0, 0, 0};
	const short h[6] = { 126, 719, -5838, 10032};
	short y;
	s[5] = s[4];
	s[4] = s[3];
	s[3] = s[2];
	s[2] = s[1];
	s[1] = s[0];
	s[0] = x;
	y = ((s[0] + s[5])*h[0]) >> 16 + ((s[1] + s[4])*h[1]) >> 16 + ((s[2] + s[3])*h[2]) >> 16 + (s[4]*h[3]) >> 16;
	return y;
}