ivan@138: function D = Gabor_Dictionary(param) ivan@138: % Windowed Gabor dictionary. In this implementation, the dictionary matrix ivan@138: % is the concatenation of a DCT (left part of the matrix) and of a DST ivan@138: % (right part). ivan@138: % Note that one can use this dictionary ivan@138: % - either by constraining the simulaneous selection of cosine and sine ivan@138: % atoms with same frequency in order to implement Gabor atoms; ivan@138: % - or, without any selection constraint, by considering that the ivan@138: % dictionary is not a Gabor dictionary but the concatenation of a DCT and ivan@138: % of a DST. ivan@138: % ivan@138: % Usage: ivan@138: % D = Gabor_Dictionary(param) ivan@138: % ivan@138: % Inputs [and default values]: ivan@138: % - param.N: frame length [256] ivan@138: % - param.redundancyFactor: redundancy factor to adjust the number of ivan@138: % frequencies [1]. The number of atoms in the dictionary equals ivan@138: % param.N*param.redundancyFactor ivan@138: % - param.wd: weigthing window function [@wSine] ivan@138: % ivan@138: % Output: ivan@138: % - Dictionary: D (cosine atoms followed by sine atoms) ivan@138: % ivan@138: % ivan@138: % ------------------- ivan@138: % ivan@138: % Audio Inpainting toolbox ivan@138: % Date: June 28, 2011 ivan@138: % By Valentin Emiya, Amir Adler, Maria Jafari ivan@138: % This code is distributed under the terms of the GNU Public License version 3 (http://www.gnu.org/licenses/gpl.txt). ivan@138: ivan@138: % Check and load default parameters ivan@138: defaultParam.N = 256; ivan@138: defaultParam.redundancyFactor = 1; ivan@138: defaultParam.wd = @wSine; ivan@138: ivan@138: if nargin<1 ivan@138: param = defaultParam; ivan@138: else ivan@138: names = fieldnames(defaultParam); ivan@138: for k=1:length(names) ivan@138: if ~isfield(param,names{k}) || isempty(param.(names{k})) ivan@138: param.(names{k}) = defaultParam.(names{k}); ivan@138: end ivan@138: end ivan@138: end ivan@138: K = param.N*param.redundancyFactor; % number of atoms ivan@138: wd = param.wd(param.N); % weigthing window ivan@138: u = 0:(param.N-1); % time ivan@138: k=0:K/2-1; % frequency ivan@138: D = diag(wd)*[cos(2*pi/K*(u.'+1/2)*(k+1/2)),sin(2*pi/K*(u.'+1/2)*(k+1/2))]; ivan@138: ivan@138: % normalisation ivan@138: D = D*diag(1./sqrt(diag(D'*D))); ivan@138: ivan@138: return