about summary refs log tree commit diff
path: root/test/jpeg-roundtrip.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/jpeg-roundtrip.test')
-rwxr-xr-xtest/jpeg-roundtrip.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/jpeg-roundtrip.test b/test/jpeg-roundtrip.test
new file mode 100755
index 00000000..1afc5423
--- /dev/null
+++ b/test/jpeg-roundtrip.test
@@ -0,0 +1,21 @@
+#! /bin/bash
+# This script tests: pnmtojpeg jpegtopnm
+# Also requires: pnmpsnr
+
+# TODO: threshold has been determined without much thought.
+# Observed pnmpsnr output: 56.20 58.26 49.38
+# A small margin has been added to the above numbers.
+
+# Should print 3 1 1 1 three times
+
+pnmtojpeg testimg.ppm | jpegtopnm | \
+  pnmpsnr -machine - testimg.ppm |\
+  awk '{printf("%3d %1d %1d %1d\n",NF,$1>55.0,$2>57.0,$3>48.0)}'
+
+pnmtojpeg testimg.ppm -opt | jpegtopnm | \
+  pnmpsnr -machine - testimg.ppm |\
+  awk '{printf("%3d %1d %1d %1d\n",NF,$1>55.0,$2>57.0,$3>48.0)}'
+
+pnmtojpeg testimg.ppm -progressive | jpegtopnm | \
+  pnmpsnr -machine - testimg.ppm |\
+  awk '{printf("%3d %1d %1d %1d\n",NF,$1>55.0,$2>57.0,$3>48.0)}'
\ No newline at end of file