function [out, f] = dynamix( in, ds, dds)

% Default case
if nargin == 1
	st.s = 'dense';
	st.o = 128;
	st.n = 1;
	st.m = 10;
	ds{1,1} = st;
	ds{1,2} = st;
	ds{2,1} = st;
	ds{2,2} = st;
	dds{1,1} = st;
	dds{1,2} = st;
	dds{2,1} = st;
	dds{2,2} = st;
end

[r,c] = size( in);

% Make filters
for i = 1:r
	for j = 1:r
		if strcmp( ds{i,j}.s, 'dense')
			f1{i,j} = mfilter( ds{i,j}.o, ds{i,j}.s, ds{i,j}.n);
			f2{i,j} = mfilter( ds{i,j}.o, ds{i,j}.s, ds{i,j}.n);
		elseif strcmp( ds{i,j}.s, 'sparse')
			f1{i,j} = mfilter( ds{i,j}.o, ds{i,j}.s, ds{i,j}.n, ds{i,j}.m);
			f2{i,j} = mfilter( ds{i,j}.o, ds{i,j}.s, ds{i,j}.n, ds{i,j}.m);
		elseif strcmp( ds{i,j}.s, 'delay')
			f1{i,j} = mfilter( ds{i,j}.o, ds{i,j}.s);
			f2{i,j} = mfilter( ds{i,j}.o, ds{i,j}.s);
		else
			error( 'Unknown filter type');
		end
	end
end
f = {f1,f2};

% Make mix if needed
if nargout == 2
	out = zeros( size( in));
	for i = 1:r
		for j = 1:r
			out(i,:) = out(i,:) + dconv( in(j,:), f1{i,j}, f2{i,j})';
		end
	end
end

% Return just the filters
if nargout == 1
	out = f;
end
