classdef PSNRVideoMetricItem < FFMPEGVideoDecoderMetricItem
    
    
    
    methods
        function obj=PSNRVideoMetricItem
            obj=obj@FFMPEGVideoDecoderMetricItem('AVG-PSNR');
        end
        
        function m=calc_color_imagemetric(obj,fname1,fname2)
            
            image1=(imread(fname1));
            image2=(imread(fname2));
            
            %image1=imresize(image1,0.25);
            %image2=imresize(image2,0.25);
            
            image1=rgb2ycbcr(image1);
            image2=rgb2ycbcr(image2);
            
            L=255;
            
            [WPSNR_Y, WMSE_Y]=PSNR(image1(:,:,1),image2(:,:,1),L);
            [WPSNR_Cb, WMSE_Cb]=PSNR(image1(:,:,2),image2(:,:,2),L);
            [WPSNR_Cr, WMSE_Cr]=PSNR(image1(:,:,3),image2(:,:,3),L);
            
            m=0.8*WPSNR_Y+0.1*WPSNR_Cb+0.1*WPSNR_Cr;
        end
        
        
        
    end
    
end