view 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
line wrap: on
line source
% window - Window a sequnce of arrays in a given dimension
%
% window :: seq [[N,M]] -> seq [[N]].
% window :: seq [[N,M]], L:natural -> seq [[N,L]].
% window :: seq [[N,M]], L:natural, natural ~'hop size' -> seq [[N,L]].
%
% This is just short for windowdata(...)
% Possible optimisation:
%    when the span and hop are much less than the input buffer size
%    and the source data does not have an efficient extract method,
%    then it is worth caching the source data, ie window(cache(x),...) 
function Y=window(X,varargin), 
	if nargin>1, Y=seq.windower.make(X,varargin{:});
	else
		dim=length(size(X));
		if isseq(X), Y=concat(map(@(x)slices(x,dim),X));
		else Y=slices(X,dim);
		end
	end