comparison toolboxes/AudioInpaintingToolbox/Utils/dictionaries/DCT_Dictionary.m @ 138:56d719a5fd31 ivand_dev

Audio Inpaintin Toolbox
author Ivan Damnjanovic lnx <ivan.damnjanovic@eecs.qmul.ac.uk>
date Thu, 21 Jul 2011 14:27:47 +0100
parents
children
comparison
equal deleted inserted replaced
137:9207d56c5547 138:56d719a5fd31
1 function D = DCT_Dictionary(param)
2 % Windowed DCT dictionary
3 %
4 % Usage:
5 % D = DCT_Dictionary(param)
6 %
7 %
8 % Inputs [and default values]:
9 % - param.N: frame length [256]
10 % - param.redundancyFactor: redundancy factor to adjust the number of
11 % frequencies [1]. The number of atoms in the dictionary equals
12 % param.N*param.redundancyFactor
13 % - param.wd: weigthing window function [@wSine]
14 %
15 % Output:
16 % - Dictionary: D
17 %
18 %
19 % -------------------
20 %
21 % Audio Inpainting toolbox
22 % Date: June 28, 2011
23 % By Valentin Emiya, Amir Adler, Maria Jafari
24 % This code is distributed under the terms of the GNU Public License version 3 (http://www.gnu.org/licenses/gpl.txt).
25 % Windowed DCT dictionary
26 %
27
28 % Check and load default parameters
29 defaultParam.N = 256;
30 defaultParam.redundancyFactor = 1;
31 defaultParam.wd = @wSine;
32
33 if nargin<1
34 param = defaultParam;
35 else
36 names = fieldnames(defaultParam);
37 for k=1:length(names)
38 if ~isfield(param,names{k}) || isempty(param.(names{k}))
39 param.(names{k}) = defaultParam.(names{k});
40 end
41 end
42 end
43 K = param.N*param.redundancyFactor; % number of atoms
44 wd = param.wd(param.N); % weigthing window
45 u = 0:(param.N-1); % time
46 k=0:K-1; % frequency
47 D = diag(wd)*cos(pi/K*(u.'+1/2)*(k+1/2));
48
49 % normalisation
50 D = D*diag(1./sqrt(diag(D'*D)));
51 return