Mercurial > hg > smallbox
comparison Problems/AudioDenoise_reconstruct.m @ 161:f42aa8bcb82f ivand_dev
debug and clean the SMALLbox Problems code
author | Ivan Damnjanovic lnx <ivan.damnjanovic@eecs.qmul.ac.uk> |
---|---|
date | Wed, 31 Aug 2011 12:02:19 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
155:b14209313ba4 | 161:f42aa8bcb82f |
---|---|
1 function reconstructed=AudioDenoise_reconstruct(y, Problem) | |
2 %% Audio denoising Problem reconstruction function | |
3 % | |
4 % This reconstruction function is using sparse representation y | |
5 % in dictionary Problem.A to reconstruct denoised audio. | |
6 % The output structre has following fields: | |
7 % audio - denoised audio signal | |
8 % psnr - psnr of the reconstructed audio signal | |
9 % | |
10 % [1] I. Damnjanovic, M. E. P. Davies, and M. P. Plumbley "SMALLbox - an | |
11 % evaluation framework for sparse representations and dictionary | |
12 % learning algorithms," V. Vigneron et al. (Eds.): LVA/ICA 2010, | |
13 % Springer-Verlag, Berlin, Germany, LNCS 6365, pp. 418-425 | |
14 | |
15 % | |
16 % Centre for Digital Music, Queen Mary, University of London. | |
17 % This file copyright 2011 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 | |
31 A = Problem.A; | |
32 | |
33 orig = Problem.Original; | |
34 noisy = Problem.Noisy; | |
35 | |
36 | |
37 % reconstruct audio frames | |
38 | |
39 xFrames = diag(ws)*(A*y); | |
40 wNormFrames = (ws.*wa)'*ones(1,size(xFrames,2)); | |
41 | |
42 % overlap and add | |
43 | |
44 rec = col2imstep(xFrames, size(noisy), [windowSize 1], [windowSize*overlap 1]); | |
45 wNorm = col2imstep(wNormFrames, size(noisy), [windowSize 1], [windowSize*overlap 1]); | |
46 wNorm(find(wNorm==0)) = 1; | |
47 recN = rec./wNorm; | |
48 | |
49 %% output structure image+psnr %% | |
50 reconstructed.audio = recN; | |
51 reconstructed.psnr = 20*log10(sqrt(numel(orig)) / norm(orig - reconstructed.audio)); | |
52 | |
53 end |