comparison Problems/AudioDeclipping_reconstruct.m @ 144:19e0af570914 release_1.5

Merge from branch "ivand_dev"
author Ivan <ivan.damnjanovic@eecs.qmul.ac.uk>
date Tue, 26 Jul 2011 15:14:15 +0100
parents 31d2864dfdd4
children f42aa8bcb82f
comparison
equal deleted inserted replaced
143:8d866d96f006 144:19e0af570914
1 function reconstructed=AudioDeclipping_reconstruct(y, Problem, SparseDict)
2 %% Audio declipping Problem reconstruction function
3 %
4 % This reconstruction function is using sparse representation y
5 % in dictionary Problem.A to reconstruct declipped audio.
6 %
7 % [1] I. Damnjanovic, M. E. P. Davies, and M. P. Plumbley "SMALLbox - an
8 % evaluation framework for sparse representations and dictionary
9 % learning algorithms," V. Vigneron et al. (Eds.): LVA/ICA 2010,
10 % Springer-Verlag, Berlin, Germany, LNCS 6365, pp. 418-425
11 % [2] A. Adler, V. Emiya, M. G. Jafari, M. Elad, R. Gribonval, and M. D.
12 % Plumbley, “Audio Inpainting,” submitted to IEEE Trans. Audio, Speech,
13 % and Lang. Proc., 2011, http://hal.inria.fr/inria-00577079/en/.
14
15 %
16 % Centre for Digital Music, Queen Mary, University of London.
17 % This file copyright 2009 Ivan Damnjanovic.
18 %
19 % This program is free software; you can redistribute it and/or
20 % modify it under the terms of the GNU General Public License as
21 % published by the Free Software Foundation; either version 2 of the
22 % License, or (at your option) any later version. See the file
23 % COPYING included with this distribution for more information.
24 %%
25
26 windowSize = Problem.windowSize;
27 overlap = Problem.overlap;
28 ws = Problem.ws(windowSize);
29 wa = Problem.wa(windowSize);
30 A = Problem.B;
31
32 orig = Problem.original;
33 clipped = Problem.clipped;
34 clipMask = Problem.clipMask;
35
36 % reconstruct audio frames
37
38 xFrames = diag(ws)*(A*y);
39 wNormFrames = (ws.*wa)'*ones(1,size(xFrames,2));
40
41 % overlap and add
42
43 rec = col2imstep(xFrames, size(clipped), [windowSize 1], [windowSize*overlap 1]);
44 wNorm = col2imstep(wNormFrames, size(clipped), [windowSize 1], [windowSize*overlap 1]);
45 wNorm(find(wNorm==0)) = 1;
46 recN = rec./wNorm;
47
48 % change only clipped samples
49
50 recSignal = orig.*double(~clipMask) + recN.*double(clipMask);
51
52 %% output structure image+psnr %%
53 reconstructed.audioAllSamples = recN;
54 reconstructed.audioOnlyClipped = recSignal;
55 [reconstructed.snrAll , reconstructed.snrMiss] = SNRInpaintingPerformance(orig, clipped, recSignal, clipMask, 1);
56
57 end