annotate arrows/dsp/adyniir.m @ 61:eff6bddf82e3
tip
Finally implemented perceptual brightness thing.
author |
samer |
date |
Sun, 11 Oct 2015 10:20:42 +0100 |
parents |
672052bd81f8 |
children |
|
rev |
line source |
samer@0
|
1 % adyniir - Apply dynamic IIR filter to input signal
|
samer@0
|
2 %
|
samer@0
|
3 % adyniir :: arrow({[[K,N+1]], [[K,M]]}, {[[K,M]]}, [[K,N]]).
|
samer@0
|
4 %
|
samer@0
|
5 % N is the order of the IIR filter
|
samer@0
|
6 % K is the number of independent channels to filter.
|
samer@0
|
7 % M is the number of consecutive samples in input signal
|
samer@0
|
8
|
samer@0
|
9 function o=adyniir
|
samer@0
|
10 o=loop1(2,1,@(s1,s2)deal( ifx(s2(2)==1,@next1,@nextm), zeros(s1(1),s1(2)-1)));
|
samer@0
|
11 end
|
samer@0
|
12
|
samer@0
|
13
|
samer@0
|
14 function [y,yp]=next1(a,x,yp)
|
samer@0
|
15 y=x-sum(a(:,2:end).*yp,2);
|
samer@0
|
16 yp=[y,yp(:,1:end-1)];
|
samer@0
|
17 end
|
samer@0
|
18
|
samer@0
|
19 function [y,yp]=nextm(a,x,yp)
|
samer@0
|
20 M=size(x,2);
|
samer@0
|
21 y=zeros(size(x));
|
samer@0
|
22 for i=1:M
|
samer@0
|
23 [y(:,i),yp]=next1(a,x(:,i),yp);
|
samer@0
|
24 end
|
samer@0
|
25 end
|