% test
s = 1;

psnr_temp=[];
psnr_temp2 = [];
image = 'nahodny';
ridkost = 10;
delka_signalu = 64;
original_picture = 'lena.jpg';
baze ='DCT';
wavelet ='haar';
hloubka_decompozice =3;
input_snr = 1;


tic
for i=1:s
    
   [signal_in, signal_noised, signal_out, koef_in, koef_out,  psnr, psnr_sr] = signal_denoising_impl(delka_signalu, ridkost, baze, wavelet, input_snr, hloubka_decompozice);
 psnr_temp= [psnr_temp; psnr];
 psnr_temp2= [psnr_temp2; psnr_sr];



% P = unique(signal_out(:)); 
% E = unique(signal_in);
% 

t = 0:1:delka_signalu-1;

figure
plot(t,signal_in,'b'), title('Puvodni signal')

figure
plot(t,signal_noised-signal_in,'b'), title('Sum')
hold on
plot(t,signal_noised-signal_out,'r'),
legend('pridany','odstraneny')
hold off

figure
plot(t,signal_noised,'k'), title('Zasumeny signal')
hold on
plot(t,signal_in,'b')
legend('zasumeny','original')
hold off

figure
plot(t,signal_in,'b'), title('Rekonstruovany signal vs. Puvodni')
hold on
plot(t,signal_out,'r')
legend('original', 'rekonstrukce')
hold off

figure
stem(t,koef_in,'b'), title('Koeficienty')
hold on
stem(t,koef_out,'r')
legend('original', 'rekonstrukce')
hold off

end

toc;
disp('PSNR=');
disp(mean(psnr_temp));
disp('PSNR_sr=');
disp(mean(psnr_temp2));