summaryrefslogtreecommitdiff
path: root/utilities/tests/hald-clut.tap
blob: 27a607a2a5d8a7c877f9f440b2966933ddab227b (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
27
28
29
30
31
32
33
34
35
#!/bin/sh
# -*- shell-script -*-
# Copyright (C) 2004-2012 GraphicsMagick Group
# Test hald CLUT operations
. ./common.shi
. ${top_srcdir}/utilities/tests/common.sh

# Number of tests we plan to execute
test_plan_fn 12

# Identity for level 12 produces a 1728x1728 pixels image.
# Identity for level 10 produces a 1000x1000 pixels image.
OUTFILE=HaldClutIdentity_out.miff
levels='2 7 8 10 12'
for level in $levels
do
  echo "Testing Hald CLUT identity level ${level} ..."
  identity_image=identity:${level}
  rm -f ${OUTFILE}
  test_command_fn 'Hald CLUT identity' ${GM} convert ${CONVERT_FLAGS} ${identity_image} -hald-clut ${identity_image} -label Hald-Clut -compress ${MIFF_COMPRESS} ${OUTFILE}
  test_command_fn 'Hald CLUT verify' ${GM} compare -maximum-error 1.5e-11 -metric MAE ${identity_image} -compress ${MIFF_COMPRESS} ${OUTFILE}
  echo
done

XFORM='-negate'
IDENTITY_CLUT='identity:8'
CLUT_OUTPUT=HaldClutTransform_out.miff
REFERENCE_OUTPUT=HaldClutTransformRef_out.miff
XFORM_CLUT=HaldClutTransformCLUT_out.miff

eval ${GM} convert ${IDENTITY_CLUT} ${XFORM} -compress ${MIFF_COMPRESS} ${XFORM_CLUT}
eval ${GM} convert ${MODEL_MIFF} ${XFORM} -compress ${MIFF_COMPRESS} ${REFERENCE_OUTPUT}
test_command_fn 'Hald CLUT emulate negate' ${GM} convert ${MODEL_MIFF} -hald-clut ${XFORM_CLUT} -compress ${MIFF_COMPRESS} ${CLUT_OUTPUT}
test_command_fn 'Hald CLUT verify' ${GM} compare -maximum-error 4.0e-12 -metric MAE ${REFERENCE_OUTPUT} -compress ${MIFF_COMPRESS} ${CLUT_OUTPUT}
: