% test
s = 20;

psnr_temp=[];
psnr_temp2 = [];
psnr_temp3 = [];
image = 'nahodny';
ridkost_k1 = 20;
ridkost_k2 = 20;
rozmer = 64;
original_picture = 'lena.jpg';
baze_1 ='DCT';
baze_2 = 'DWT';
wavelet_1 = 'db5';
wavelet_2 = 'db5';
hloubka_decom_1 =3;
hloubka_decom_2 =3;


tic




for i=1:s
    [signal_in, signal_tex, signal_car, signal_out, psnr, psnr_t, psnr_c] = decomposition_2D_impl(image, ridkost_k1, ridkost_k2, rozmer,original_picture, baze_1, baze_2, wavelet_1, wavelet_2, hloubka_decom_1, hloubka_decom_2);

   
    psnr_temp= [psnr_temp; psnr];
    psnr_temp2= [psnr_temp2; psnr_t];
    psnr_temp3= [psnr_temp3; psnr_c];

    
global M;
global N;

% 
% figure
% imagesc(reshape(signal_in,M,N));
% %colormap(gray)
% axis image
% title('Puvodni obraz');
%  
%  
% figure
% imagesc(reshape(signal_out,M,N));
% %colormap(gray)
% axis image
% title('Zpetne slozeny obraz');
%  
%  
% figure
% imagesc(reshape(signal_tex,M,N));
% %colormap(gray)
% axis image
% colorbar
% title('1. Komponenta ');
%  
% kontrola =  signal_car-signal_tex;
% 
% figure
% imagesc(reshape(signal_car,M,N));
% %colormap(gray)
% colorbar
% axis image
% title('2. Komponenta');
% 
% figure
% imagesc(reshape(signal_in-signal_out,M,N));
% colorbar
% %colormap(gray)
% axis image
% title('Rezidua: Original - Zpetne slozeni');
%  
% figure
% imagesc(reshape(signal_in,M,N));
% colorbar
% %colormap(gray)
% axis image
% title('Original - skala barev');
% 
 

end

toc;
disp('PSNR=');
disp(mean(psnr_temp));
disp('PSNR_t=');
disp(mean(psnr_temp2));
disp('PSNR_c=');
disp(mean(psnr_temp3));