summaryrefslogtreecommitdiff
path: root/media/libjxl/src/tools/benchmark/metrics/compute-pumetrics.m
blob: df0fe4bd0e982ae1f3524a9d50575f867852a6f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
% Copyright (c) the JPEG XL Project Authors. All rights reserved.
%
% Use of this source code is governed by a BSD-style
% license that can be found in the LICENSE file.

pkg load image;

args = argv();

metric = args{1};
original_filename = args{2};
decoded_filename = args{3};

original = pfs_read_luminance(original_filename);
decoded = pfs_read_luminance(decoded_filename);

switch (metric)
  case "psnr"
    res = qm_pu2_psnr(original, decoded);
  case "ssim"
    res = qm_pu2_ssim(original, decoded);
  otherwise
    error(sprintf("unrecognized metric %s", metric));
end

printf("%f\n", res);