diff options
author | Didier Raboud <odyx@debian.org> | 2018-09-25 08:33:05 +0200 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2018-09-25 08:33:05 +0200 |
commit | e50542121e724e851fc5d6c68bb773f80c0bc12c (patch) | |
tree | 655c3f6331a6e8fd8b09ceb4da8f5896484ae16a /test/compress-6level.sh.in | |
parent | 9dd97a029bf391c42b1dc76f2f7c5e386bb8f466 (diff) |
New upstream version 5.3.1
Diffstat (limited to 'test/compress-6level.sh.in')
-rw-r--r-- | test/compress-6level.sh.in | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/test/compress-6level.sh.in b/test/compress-6level.sh.in new file mode 100644 index 0000000..62bc38a --- /dev/null +++ b/test/compress-6level.sh.in @@ -0,0 +1,68 @@ +#!@SHELL@ + +# compression of 6-level inks (irrespective of bits per level) +# 3-level, 5 pixels = 1024 combinations: 10 bits long +# but since not all levels used: unique are 242, or 1 byte +# 4-level, 4 pixels = 65536 combinations: 16 bits long +# but since only 2 bits per pixel used there are 256 combinations, or 1 byte +# 5-level, 3 pixels: 15 bits long +# but since only 3 bits per pixel used there are 125 unique combinations, or 1 byte +# 6-level, 3 pixels: 15 bits long +# but since only 3 bits per pixel used there are 216 unique combinations, or 1 byte + + +# m: max number of levels used +m=6 +# z: max number allowed by bits +z=16 +# a: iteration of array subscript +a=1 +# n: iteration of valid combinations +n=0 +# iteration of pixels +#i=0 +j=0 +k=0 +l=0 + +echo "static const unsigned char ninetoeight2[] =" +echo "{" + +#for (( i=1; i<=$z; i++ )) +#do + for (( j=1; j<=$z; j++ )) + do + for (( k=1; k<=$z; k++ )) + do + for (( l=1; l<=$z; l++ )) + do +# if test $i -gt $m -o $j -gt $m -o $k -gt $m -o $l -gt $m + if test $j -gt $m -o $k -gt $m -o $l -gt $m + then + array[$a]=0 + else + array[$a]=$n + n=$(( $n+1 )) + fi + # print line of output + remainder=$(( $a % 16 )) + a=$(( $a+1 )) + if test $remainder -eq 0 + then + printf " " + pstart=$(( 256*($j-1)+16*($k-1)+1 )) + pfinal=$(( 256*($j-1)+16*$k )) + #echo "array subscript: $a, pstart: $pstart, pfinal: $pfinal, iterators: $j $k $l" + for (( p=$pstart; p<=$pfinal; p++ )) + do + printf "%3d," ${array[$p]} + done + printf "\n" + fi + done + done + done +#done + +echo "};" +echo "max number of valid combinations: $n" |