compute-pumetrics.m (599B)
1 % Copyright (c) the JPEG XL Project Authors. All rights reserved. 2 % 3 % Use of this source code is governed by a BSD-style 4 % license that can be found in the LICENSE file. 5 6 pkg load image; 7 8 args = argv(); 9 10 metric = args{1}; 11 original_filename = args{2}; 12 decoded_filename = args{3}; 13 14 original = pfs_read_luminance(original_filename); 15 decoded = pfs_read_luminance(decoded_filename); 16 17 switch (metric) 18 case "psnr" 19 res = qm_pu2_psnr(original, decoded); 20 case "ssim" 21 res = qm_pu2_ssim(original, decoded); 22 otherwise 23 error(sprintf("unrecognized metric %s", metric)); 24 end 25 26 printf("%f\n", res);