~/hatena/q1408437001% sh batch.sh cat.jpg glenn.jpg london.jpg virgo.jpg
jpeg run with "cjpeg -quality 30 w.pnm > t.jpg" & "djpeg t.jpg > w.pnm"
#1 cat1.diff.png: mean 658.499
#1000 cat1000.diff.png: mean 0
im run with "convert w.pnm -quality 15 t.jpg" & "convert t.jpg w.pnm"
#1 cat1.diff.png: mean 1012.47
#1000 cat1000.diff.png: mean 0
j2k run with "opj_compress -r 400 -i w.pnm -o t.jpg.j2k > /dev/null 2>&1" & "opj_decompress -i t.jpg.j2k -o w.pnm > /dev/null 2>&1 ; mv t.jpg.j2k t.jpg"
#1 cat1.diff.png: mean 852.046
#10 cat10.diff.png: mean 153.899
#1000 cat1000.diff.png: mean 0
jpeg run with "cjpeg -quality 30 w.pnm > t.jpg" & "djpeg t.jpg > w.pnm"
#1 glenn1.diff.png: mean 3399.9
#10 glenn10.diff.png: mean 13.1817
#100 glenn100.diff.png: mean 0
#1000 glenn1000.diff.png: mean 0
im run with "convert w.pnm -quality 15 t.jpg" & "convert t.jpg w.pnm"
#1 glenn1.diff.png: mean 3774.37
#10 glenn10.diff.png: mean 2.9123
#100 glenn100.diff.png: mean 0
#1000 glenn1000.diff.png: mean 0
j2k run with "opj_compress -r 400 -i w.pnm -o t.jpg.j2k > /dev/null 2>&1" & "opj_decompress -i t.jpg.j2k -o w.pnm > /dev/null 2>&1 ; mv t.jpg.j2k t.jpg"
#1 glenn1.diff.png: mean 5124.25
#10 glenn10.diff.png: mean 34.9354
#100 glenn100.diff.png: mean 0.54037
#1000 glenn1000.diff.png: mean 0
jpeg run with "cjpeg -quality 30 w.pnm > t.jpg" & "djpeg t.jpg > w.pnm"
#1 london1.diff.png: mean 1145.86
#10 london10.diff.png: mean 2.94233
#100 london100.diff.png: mean 0
#1000 london1000.diff.png: mean 0
im run with "convert w.pnm -quality 15 t.jpg" & "convert t.jpg w.pnm"
#1 london1.diff.png: mean 1589.42
#10 london10.diff.png: mean 0.262741
#100 london100.diff.png: mean 0
#1000 london1000.diff.png: mean 0
j2k run with "opj_compress -r 400 -i w.pnm -o t.jpg.j2k > /dev/null 2>&1" & "opj_decompress -i t.jpg.j2k -o w.pnm > /dev/null 2>&1 ; mv t.jpg.j2k t.jpg"
#1 london1.diff.png: mean 1874.1
#10 london10.diff.png: mean 34.7301
#100 london100.diff.png: mean 0
#1000 london1000.diff.png: mean 0
jpeg run with "cjpeg -quality 30 w.pnm > t.jpg" & "djpeg t.jpg > w.pnm"
#1 virgo1.diff.png: mean 655.998
#10 virgo10.diff.png: mean 0.593173
#100 virgo100.diff.png: mean 0
#1000 virgo1000.diff.png: mean 0
im run with "convert w.pnm -quality 15 t.jpg" & "convert t.jpg w.pnm"
#1 virgo1.diff.png: mean 967.051
#10 virgo10.diff.png: mean 0.276289
#100 virgo100.diff.png: mean 0
#1000 virgo1000.diff.png: mean 0
j2k run with "opj_compress -r 400 -i w.pnm -o t.jpg.j2k > /dev/null 2>&1" & "opj_decompress -i t.jpg.j2k -o w.pnm > /dev/null 2>&1 ; mv t.jpg.j2k t.jpg"
#1 virgo1.diff.png: mean 689.347
#10 virgo10.diff.png: mean 72.9174
追記:quality 95でも行った。収束は遅くなるが100回までで収束した。
jpeg95 run with "cjpeg -quality 95 w.pnm > t.jpg" & "djpeg t.jpg > w.pnm"
#1 cat1.diff.png: mean 59.3537
#10 cat10.diff.png: mean 9.35999
#1000 cat1000.diff.png: mean 0
jpeg95 run with "cjpeg -quality 95 w.pnm > t.jpg" & "djpeg t.jpg > w.pnm"
#1 glenn1.diff.png: mean 2104.51
#10 glenn10.diff.png: mean 69.472
#100 glenn100.diff.png: mean 10.8727
#1000 glenn1000.diff.png: mean 0
jpeg95 run with "cjpeg -quality 95 w.pnm > t.jpg" & "djpeg t.jpg > w.pnm"
#1 london1.diff.png: mean 79.604
#10 london10.diff.png: mean 80.2684
#100 london100.diff.png: mean 8.79387
#1000 london1000.diff.png: mean 0
jpeg95 run with "cjpeg -quality 95 w.pnm > t.jpg" & "djpeg t.jpg > w.pnm"
#1 virgo1.diff.png: mean 213.594
#10 virgo10.diff.png: mean 11.7891
~/hatena/q1408437001% cat batch.sh
#/bin/sh work=w.pnm temp=t.jpg list="jpeg im j2k" enc_jpeg="cjpeg -quality 30 $work > $temp" dec_jpeg="djpeg $temp > $work" enc_im="convert $work -quality 15 $temp" dec_im="convert $temp $work" enc_j2k="opj_compress -r 400 -i $work -o $temp.j2k > /dev/null 2>&1" dec_j2k="opj_decompress -i $temp.j2k -o $work > /dev/null 2>&1 ; mv $temp.j2k $temp" for orig in "$@" ; do for name in $list ; do eval enc=\$enc_$name eval dec=\$dec_$name if [ "x$enc" == x -o "x$dec" == x ] ; then continue ; fi echo $name run with \"$enc\" "&" \"$dec\" || continue mkdir $name > /dev/null 2>&1 chdir $name || contimue convert ../$orig $work || return 1 i=0 before=../$orig for c in 1 10 100 1000 ; do while [ $i -lt $c ] ; do eval $enc && \ eval $dec && \ i=$((i+1)) || break done base=${orig%.*}${i} cp $temp ${base}.jpg convert $work ${base}.png composite $before ${base}.png -compose difference ${base}.diff.png echo -n "#$i " identify -format '%f: mean %[mean]\n' ${base}.diff.png before=${base}.png done chdir .. || return 1 done done
サンプルデータの元は下記を使用
コーデックは下記を使用