view arrows/dsp/adynfir.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 672052bd81f8
children
line wrap: on
line source
% adynfir - Apply dynamic FIR filter to input signal
%
% adynfir :: 
%    N:natural ~'number of FIR filter coefficients',
%    M:natural ~'number of samples per input block'
% -> arrow({[[N]], [[M]]}, {[[M]]}, pair(empty,[[N-M]])).

function o=adynfir(N,M)

	o=arr(@(f,u){f,u})*loop(@next,@(sz)zeros(N-1,1));

	function [y,s2]=next(x,s)
		if iscell(x)
			u=[s;x{2}];
			y=conv2(u,x{1},'valid');
			s2=u(M+1:end);
		else
			y=zeros(M,1);
			s2=s;
		end
	end
end