about summary refs log tree commit diff
path: root/test/jpeg-roundtrip.test
blob: 1afc5423cc5f2bb30b40b5a2aed4a0a6d4a5eabb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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)}'