annotate sequences/window.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 9e7be347b3a0
children
rev   line source
samer@3 1 % window - Window a sequnce of arrays in a given dimension
samer@3 2 %
samer@3 3 % window :: seq [[N,M]] -> seq [[N]].
samer@3 4 % window :: seq [[N,M]], L:natural -> seq [[N,L]].
samer@3 5 % window :: seq [[N,M]], L:natural, natural ~'hop size' -> seq [[N,L]].
samer@3 6 %
samer@3 7 % This is just short for windowdata(...)
samer@3 8 % Possible optimisation:
samer@3 9 % when the span and hop are much less than the input buffer size
samer@3 10 % and the source data does not have an efficient extract method,
samer@3 11 % then it is worth caching the source data, ie window(cache(x),...)
samer@36 12 function Y=window(X,varargin),
samer@36 13 if nargin>1, Y=seq.windower.make(X,varargin{:});
samer@36 14 else
samer@36 15 dim=length(size(X));
samer@36 16 if isseq(X), Y=concat(map(@(x)slices(x,dim),X));
samer@36 17 else Y=slices(X,dim);
samer@36 18 end
samer@36 19 end