Mercurial > hg > ishara
view sequences/@seq/unbuffer.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | 79038cbcce00 |
children |
line wrap: on
line source
% unbuffer - Opposite of buffer using overlap and add (for sequences) % % unbuffer :: % seq([[N]]) ~'sequence of overlapping frames', % M:natural ~'hop size' % -> seq([[1,M]])~'sequence of de-overlapped frames'. % % NB. what about windowing function? function Y=unbuffer(X,hop) N=max(size(X)); ol=N-hop; if ol<=hop I=1:hop; J=1:ol; K=hop+1:N; Y=mapaccum(@olap1,zeros(ol,1),X); else I=1:hop; J=hop+1:ol; K=ol+1:N; Y=mapaccum(@olap3,zeros(ol,1),X); end % Y=zipaccum(@olap2,[],windowdata(repeat(hop)),X); function [y,s1]=olap1(x,s) y=x(I)'; y(J)=y(J)+s'; s1=x(K); end function [y,s1]=olap3(x,s) y=(s(I)+x(I))'; s1=[s(J)+x(J);x(K)]; end end