annotate 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 |
|
rev |
line source |
samer@0
|
1 % adynfir - Apply dynamic FIR filter to input signal
|
samer@0
|
2 %
|
samer@0
|
3 % adynfir ::
|
samer@0
|
4 % N:natural ~'number of FIR filter coefficients',
|
samer@0
|
5 % M:natural ~'number of samples per input block'
|
samer@0
|
6 % -> arrow({[[N]], [[M]]}, {[[M]]}, pair(empty,[[N-M]])).
|
samer@0
|
7
|
samer@0
|
8 function o=adynfir(N,M)
|
samer@0
|
9
|
samer@0
|
10 o=arr(@(f,u){f,u})*loop(@next,@(sz)zeros(N-1,1));
|
samer@0
|
11
|
samer@0
|
12 function [y,s2]=next(x,s)
|
samer@0
|
13 if iscell(x)
|
samer@0
|
14 u=[s;x{2}];
|
samer@0
|
15 y=conv2(u,x{1},'valid');
|
samer@0
|
16 s2=u(M+1:end);
|
samer@0
|
17 else
|
samer@0
|
18 y=zeros(M,1);
|
samer@0
|
19 s2=s;
|
samer@0
|
20 end
|
samer@0
|
21 end
|
samer@0
|
22 end
|