view arrows/@asink/construct.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents ae596261e75f
children
line wrap: on
line source
function u=construct(s,sizes_in)
	u=mkunit(s);
	if ~isa(s.sink,'sink')
		snk=construct(s.sink(sizes_in{1}(1)));
	else
		if sizes_in{1}(1)~=channels(s.sink)
			error('Number of rows in input does not match channels in sink');
		end
		snk=construct(s.sink);
	end
	
	if isempty(s.window), 
		write=snk.writer(sizes_in{1}(2));
		u.process=@proc1;
	else 
		WIN=s.window; 
		write=snk.writer(length(WIN)); 
		u.process=@proc2;
	end

	u.sizes_out = {};
	u.dispose   = snk.dispose;
	u.starting  = snk.start;
	u.stopping  = snk.stop;

	function proc1(x), write(x); end
	function proc2(x), write(x(:,WIN)); end
end