about summary refs log tree commit diff
path: root/test/jpeg-roundtrip.test
blob: 23df6341c3dca90bcfa062c1537a2def00e4b6cc (plain) (blame)
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
#! /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 %.2f %.2f %.2f\n", NF,
                $1>55.0 ? 1000.00 : $1,
                $2>57.0 ? 1000.00 : $2,
                $3>48.0 ? 1000.00 : $3) }'


pnmtojpeg testimg.ppm -opt | jpegtopnm | \
  pnmpsnr -machine - testimg.ppm |\
  awk '{printf("%3d %.2f %.2f %.2f\n", NF,
                $1>55.0 ? 1000.00 : $1,
                $2>57.0 ? 1000.00 : $2,
                $3>48.0 ? 1000.00 : $3) }'


pnmtojpeg testimg.ppm -progressive | jpegtopnm | \
  pnmpsnr -machine - testimg.ppm |\
  awk '{printf("%3d %.2f %.2f %.2f\n", NF,
                $1>55.0 ? 1000.00 : $1,
                $2>57.0 ? 1000.00 : $2,
                $3>48.0 ? 1000.00 : $3) }'