Advertisement
Guest User

mozjpeg-extreme-simulation-v1.sh

a guest
Jun 11th, 2021
766
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 47.93 KB | None | 0 0
  1. #!/bin/bash
  2. #This script recursively simulates compression of jpg and png files to jpg files without significant loss in visual quality with "mozjpeg" (https://github.com/mozilla/mozjpeg) with 243 sets of parameters (almost all possible parameter combinations). Text log files of the results are output to a folder in ./ in ascending alphabetical and numerical order, but no compressed files are actually produced. To make processing faster, rest of the simulations are skipped if the first simulation produces files that are larger than the original files.
  3.  
  4. #8 june 2021 v1
  5. #mozjpeg-extreme-simulation-v1.sh was written in 8 june 2021 and tested to be functional with mozjpeg v 4.0.4 on Debian 10. This script works with files/folders containing at least %, $, *, white spaces horizontal tabs or newlines. "mozjpeg" command denoted in this script in mozjpeg v 4.0.4 is actually "cjpeg" unless a symbolic link after mozjpeg installation is created like so:
  6. #sudo ln -s /opt/mozjpeg/bin/cjpeg /usr/bin/mozjpeg
  7. #If no symbolic link is created, replace all instances of "mozjpeg" in this script to "cjpeg" to be able to use this script.
  8.  
  9. #COPYRIGHT: this script is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication (https://creativecommons.org/publicdomain/zero/1.0/deed.en). The original creator of this script has no affiliation with "mozjpeg" or "Mozilla".
  10.  
  11. printf "START:\t`date`\n"
  12.  
  13. #Creates ./<YYYY-MM-DD_hh:mm>_<RANDOM NUMBER> folder for log files.
  14. rnd=$(date +%F_%H:%M_)$(printf $RANDOM | cut -c -3)
  15. mkdir ./$rnd
  16. printf "Log file location: ./$rnd\n"
  17.  
  18. #Temp files to RAM as variables.
  19. R0="$(mktemp -p /dev/shm/)"
  20. R1="$(mktemp -p /dev/shm/)"
  21. R2="$(mktemp -p /dev/shm/)"
  22. R3="$(mktemp -p /dev/shm/)"
  23.  
  24. while IFS= read -r -d '' i; do
  25.     S=`date +%s`
  26.     #Filename and size saved. If the name has newlines or tabs, they are converted to spaces so the names display well on terminal.
  27.     name1="$(printf "$i" | tr '\n' ' ' | tr '\t' ' ')"
  28.     name2="$(printf "$name1" | sed 's@.*/@@')"
  29.     size="$(stat --printf="%s" "$i")"
  30.  
  31.     #Compression is simulated once. Compressed size in bytes are extracted and saved to a variable along with the used parameters.
  32.     mozjpeg -nojfif -memdst "$i" > "$R0" 2>&1
  33.     n=$(grep -oE "[0-9]+" "$R0"); printf "$n\t-nojfif" > "$R1"
  34.  
  35.     #If compressed size is smaller than original size, then other parameters are skipped. Else: other parameters are tested.
  36.     if(($size < $n)); then
  37.         printf '%s: skipped, original file is smaller\n' "$name1"
  38.  
  39.     else
  40.         printf '%s:' "$name1"
  41.         mozjpeg -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  42.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-nojfif -dc-scan-opt 0" >> "$R1"
  43.         mozjpeg -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  44.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-nojfif -dc-scan-opt 1" >> "$R1"
  45.         mozjpeg -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  46.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-nojfif -dc-scan-opt 2" >> "$R1"
  47.         mozjpeg -quant-baseline -nojfif -memdst "$i" > "$R0" 2>&1
  48.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-baseline -nojfif" >> "$R1"
  49.         mozjpeg -quant-table 0 -nojfif -memdst "$i" > "$R0" 2>&1
  50.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 0 -nojfif" >> "$R1"
  51.         mozjpeg -quant-table 1 -nojfif -memdst "$i" > "$R0" 2>&1
  52.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 1 -nojfif" >> "$R1"
  53.         mozjpeg -quant-table 2 -nojfif -memdst "$i" > "$R0" 2>&1
  54.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 2 -nojfif" >> "$R1"
  55.         mozjpeg -quant-table 3 -nojfif -memdst "$i" > "$R0" 2>&1
  56.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 3 -nojfif" >> "$R1"
  57.         mozjpeg -quant-table 4 -nojfif -memdst "$i" > "$R0" 2>&1
  58.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 4 -nojfif" >> "$R1"
  59.         mozjpeg -quant-table 5 -nojfif -memdst "$i" > "$R0" 2>&1
  60.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 5 -nojfif" >> "$R1"
  61.         mozjpeg -quant-table 6 -nojfif -memdst "$i" > "$R0" 2>&1
  62.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 6 -nojfif" >> "$R1"
  63.         mozjpeg -quant-table 7 -nojfif -memdst "$i" > "$R0" 2>&1
  64.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 7 -nojfif" >> "$R1"
  65.         mozjpeg -quant-table 8 -nojfif -memdst "$i" > "$R0" 2>&1
  66.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 8 -nojfif" >> "$R1"
  67.         mozjpeg -quant-table 0 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  68.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 0 -nojfif -dc-scan-opt 0" >> "$R1"
  69.         mozjpeg -quant-table 0 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  70.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 0 -nojfif -dc-scan-opt 1" >> "$R1"
  71.         mozjpeg -quant-table 0 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  72.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 0 -nojfif -dc-scan-opt 2" >> "$R1"
  73.         mozjpeg -quant-table 1 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  74.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 1 -nojfif -dc-scan-opt 0" >> "$R1"
  75.         mozjpeg -quant-table 1 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  76.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 1 -nojfif -dc-scan-opt 1" >> "$R1"
  77.         mozjpeg -quant-table 1 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  78.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 1 -nojfif -dc-scan-opt 2" >> "$R1"
  79.         mozjpeg -quant-table 2 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  80.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 2 -nojfif -dc-scan-opt 0" >> "$R1"
  81.         mozjpeg -quant-table 2 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  82.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 2 -nojfif -dc-scan-opt 1" >> "$R1"
  83.         mozjpeg -quant-table 2 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  84.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 2 -nojfif -dc-scan-opt 2" >> "$R1"
  85.         mozjpeg -quant-table 3 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  86.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 3 -nojfif -dc-scan-opt 0" >> "$R1"
  87.         mozjpeg -quant-table 3 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  88.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 3 -nojfif -dc-scan-opt 1" >> "$R1"
  89.         mozjpeg -quant-table 3 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  90.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 3 -nojfif -dc-scan-opt 2" >> "$R1"
  91.         mozjpeg -quant-table 4 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  92.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 4 -nojfif -dc-scan-opt 0" >> "$R1"
  93.         mozjpeg -quant-table 4 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  94.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 4 -nojfif -dc-scan-opt 1" >> "$R1"
  95.         mozjpeg -quant-table 4 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  96.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 4 -nojfif -dc-scan-opt 2" >> "$R1"
  97.         mozjpeg -quant-table 5 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  98.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 5 -nojfif -dc-scan-opt 0" >> "$R1"
  99.         mozjpeg -quant-table 5 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  100.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 5 -nojfif -dc-scan-opt 1" >> "$R1"
  101.         mozjpeg -quant-table 5 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  102.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 5 -nojfif -dc-scan-opt 2" >> "$R1"
  103.         mozjpeg -quant-table 6 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  104.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 6 -nojfif -dc-scan-opt 0" >> "$R1"
  105.         mozjpeg -quant-table 6 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  106.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 6 -nojfif -dc-scan-opt 1" >> "$R1"
  107.         mozjpeg -quant-table 6 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  108.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 6 -nojfif -dc-scan-opt 2" >> "$R1"
  109.         mozjpeg -quant-table 7 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  110.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 7 -nojfif -dc-scan-opt 0" >> "$R1"
  111.         mozjpeg -quant-table 7 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  112.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 7 -nojfif -dc-scan-opt 1" >> "$R1"
  113.         mozjpeg -quant-table 7 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  114.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 7 -nojfif -dc-scan-opt 2" >> "$R1"
  115.         mozjpeg -quant-table 8 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  116.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 8 -nojfif -dc-scan-opt 0" >> "$R1"
  117.         mozjpeg -quant-table 8 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  118.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 8 -nojfif -dc-scan-opt 1" >> "$R1"
  119.         mozjpeg -quant-table 8 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  120.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-quant-table 8 -nojfif -dc-scan-opt 2" >> "$R1"
  121.         mozjpeg -tune-ssim -nojfif -memdst "$i" > "$R0" 2>&1
  122.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -nojfif" >> "$R1"
  123.         mozjpeg -tune-ssim -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  124.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -nojfif -dc-scan-opt 0" >> "$R1"
  125.         mozjpeg -tune-ssim -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  126.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -nojfif -dc-scan-opt 1" >> "$R1"
  127.         mozjpeg -tune-ssim -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  128.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -nojfif -dc-scan-opt 2" >> "$R1"
  129.         mozjpeg -tune-ssim -quant-baseline -nojfif -memdst "$i" > "$R0" 2>&1
  130.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-baseline -nojfif" >> "$R1"
  131.         mozjpeg -tune-ssim -quant-table 0 -nojfif -memdst "$i" > "$R0" 2>&1
  132.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 0 -nojfif" >> "$R1"
  133.         mozjpeg -tune-ssim -quant-table 1 -nojfif -memdst "$i" > "$R0" 2>&1
  134.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 1 -nojfif" >> "$R1"
  135.         mozjpeg -tune-ssim -quant-table 2 -nojfif -memdst "$i" > "$R0" 2>&1
  136.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 2 -nojfif" >> "$R1"
  137.         mozjpeg -tune-ssim -quant-table 3 -nojfif -memdst "$i" > "$R0" 2>&1
  138.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 3 -nojfif" >> "$R1"
  139.         mozjpeg -tune-ssim -quant-table 4 -nojfif -memdst "$i" > "$R0" 2>&1
  140.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 4 -nojfif" >> "$R1"
  141.         mozjpeg -tune-ssim -quant-table 5 -nojfif -memdst "$i" > "$R0" 2>&1
  142.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 5 -nojfif" >> "$R1"
  143.         mozjpeg -tune-ssim -quant-table 6 -nojfif -memdst "$i" > "$R0" 2>&1
  144.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 6 -nojfif" >> "$R1"
  145.         mozjpeg -tune-ssim -quant-table 7 -nojfif -memdst "$i" > "$R0" 2>&1
  146.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 7 -nojfif" >> "$R1"
  147.         mozjpeg -tune-ssim -quant-table 8 -nojfif -memdst "$i" > "$R0" 2>&1
  148.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 8 -nojfif" >> "$R1"
  149.         mozjpeg -tune-ssim -quant-table 0 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  150.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 0 -nojfif -dc-scan-opt 0" >> "$R1"
  151.         mozjpeg -tune-ssim -quant-table 0 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  152.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 0 -nojfif -dc-scan-opt 1" >> "$R1"
  153.         mozjpeg -tune-ssim -quant-table 0 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  154.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 0 -nojfif -dc-scan-opt 2" >> "$R1"
  155.         mozjpeg -tune-ssim -quant-table 1 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  156.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 1 -nojfif -dc-scan-opt 0" >> "$R1"
  157.         mozjpeg -tune-ssim -quant-table 1 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  158.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 1 -nojfif -dc-scan-opt 1" >> "$R1"
  159.         mozjpeg -tune-ssim -quant-table 1 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  160.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 1 -nojfif -dc-scan-opt 2" >> "$R1"
  161.         mozjpeg -tune-ssim -quant-table 2 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  162.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 2 -nojfif -dc-scan-opt 0" >> "$R1"
  163.         mozjpeg -tune-ssim -quant-table 2 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  164.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 2 -nojfif -dc-scan-opt 1" >> "$R1"
  165.         mozjpeg -tune-ssim -quant-table 2 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  166.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 2 -nojfif -dc-scan-opt 2" >> "$R1"
  167.         mozjpeg -tune-ssim -quant-table 3 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  168.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 3 -nojfif -dc-scan-opt 0" >> "$R1"
  169.         mozjpeg -tune-ssim -quant-table 3 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  170.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 3 -nojfif -dc-scan-opt 1" >> "$R1"
  171.         mozjpeg -tune-ssim -quant-table 3 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  172.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 3 -nojfif -dc-scan-opt 2" >> "$R1"
  173.         mozjpeg -tune-ssim -quant-table 4 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  174.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 4 -nojfif -dc-scan-opt 0" >> "$R1"
  175.         mozjpeg -tune-ssim -quant-table 4 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  176.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 4 -nojfif -dc-scan-opt 1" >> "$R1"
  177.         mozjpeg -tune-ssim -quant-table 4 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  178.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 4 -nojfif -dc-scan-opt 2" >> "$R1"
  179.         mozjpeg -tune-ssim -quant-table 5 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  180.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 5 -nojfif -dc-scan-opt 0" >> "$R1"
  181.         mozjpeg -tune-ssim -quant-table 5 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  182.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 5 -nojfif -dc-scan-opt 1" >> "$R1"
  183.         mozjpeg -tune-ssim -quant-table 5 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  184.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 5 -nojfif -dc-scan-opt 2" >> "$R1"
  185.         mozjpeg -tune-ssim -quant-table 6 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  186.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 6 -nojfif -dc-scan-opt 0" >> "$R1"
  187.         mozjpeg -tune-ssim -quant-table 6 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  188.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 6 -nojfif -dc-scan-opt 1" >> "$R1"
  189.         mozjpeg -tune-ssim -quant-table 6 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  190.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 6 -nojfif -dc-scan-opt 2" >> "$R1"
  191.         mozjpeg -tune-ssim -quant-table 7 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  192.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 7 -nojfif -dc-scan-opt 0" >> "$R1"
  193.         mozjpeg -tune-ssim -quant-table 7 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  194.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 7 -nojfif -dc-scan-opt 1" >> "$R1"
  195.         mozjpeg -tune-ssim -quant-table 7 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  196.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 7 -nojfif -dc-scan-opt 2" >> "$R1"
  197.         mozjpeg -tune-ssim -quant-table 8 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  198.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 8 -nojfif -dc-scan-opt 0" >> "$R1"
  199.         mozjpeg -tune-ssim -quant-table 8 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  200.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 8 -nojfif -dc-scan-opt 1" >> "$R1"
  201.         mozjpeg -tune-ssim -quant-table 8 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  202.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ssim -quant-table 8 -nojfif -dc-scan-opt 2" >> "$R1"
  203.         mozjpeg -tune-ms-ssim -nojfif -memdst "$i" > "$R0" 2>&1
  204.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -nojfif" >> "$R1"
  205.         mozjpeg -tune-ms-ssim -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  206.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -nojfif -dc-scan-opt 0" >> "$R1"
  207.         mozjpeg -tune-ms-ssim -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  208.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -nojfif -dc-scan-opt 1" >> "$R1"
  209.         mozjpeg -tune-ms-ssim -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  210.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -nojfif -dc-scan-opt 2" >> "$R1"
  211.         mozjpeg -tune-ms-ssim -quant-baseline -nojfif -memdst "$i" > "$R0" 2>&1
  212.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-baseline -nojfif" >> "$R1"
  213.         mozjpeg -tune-ms-ssim -quant-table 0 -nojfif -memdst "$i" > "$R0" 2>&1
  214.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 0 -nojfif" >> "$R1"
  215.         mozjpeg -tune-ms-ssim -quant-table 1 -nojfif -memdst "$i" > "$R0" 2>&1
  216.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 1 -nojfif" >> "$R1"
  217.         mozjpeg -tune-ms-ssim -quant-table 2 -nojfif -memdst "$i" > "$R0" 2>&1
  218.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 2 -nojfif" >> "$R1"
  219.         mozjpeg -tune-ms-ssim -quant-table 3 -nojfif -memdst "$i" > "$R0" 2>&1
  220.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 3 -nojfif" >> "$R1"
  221.         mozjpeg -tune-ms-ssim -quant-table 4 -nojfif -memdst "$i" > "$R0" 2>&1
  222.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 4 -nojfif" >> "$R1"
  223.         mozjpeg -tune-ms-ssim -quant-table 5 -nojfif -memdst "$i" > "$R0" 2>&1
  224.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 5 -nojfif" >> "$R1"
  225.         mozjpeg -tune-ms-ssim -quant-table 6 -nojfif -memdst "$i" > "$R0" 2>&1
  226.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 6 -nojfif" >> "$R1"
  227.         mozjpeg -tune-ms-ssim -quant-table 7 -nojfif -memdst "$i" > "$R0" 2>&1
  228.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 7 -nojfif" >> "$R1"
  229.         mozjpeg -tune-ms-ssim -quant-table 8 -nojfif -memdst "$i" > "$R0" 2>&1
  230.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 8 -nojfif" >> "$R1"
  231.         mozjpeg -tune-ms-ssim -quant-table 0 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  232.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 0 -nojfif -dc-scan-opt 0" >> "$R1"
  233.         mozjpeg -tune-ms-ssim -quant-table 0 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  234.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 0 -nojfif -dc-scan-opt 1" >> "$R1"
  235.         mozjpeg -tune-ms-ssim -quant-table 0 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  236.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 0 -nojfif -dc-scan-opt 2" >> "$R1"
  237.         mozjpeg -tune-ms-ssim -quant-table 1 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  238.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 1 -nojfif -dc-scan-opt 0" >> "$R1"
  239.         mozjpeg -tune-ms-ssim -quant-table 1 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  240.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 1 -nojfif -dc-scan-opt 1" >> "$R1"
  241.         mozjpeg -tune-ms-ssim -quant-table 1 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  242.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 1 -nojfif -dc-scan-opt 2" >> "$R1"
  243.         mozjpeg -tune-ms-ssim -quant-table 2 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  244.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 2 -nojfif -dc-scan-opt 0" >> "$R1"
  245.         mozjpeg -tune-ms-ssim -quant-table 2 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  246.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 2 -nojfif -dc-scan-opt 1" >> "$R1"
  247.         mozjpeg -tune-ms-ssim -quant-table 2 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  248.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 2 -nojfif -dc-scan-opt 2" >> "$R1"
  249.         mozjpeg -tune-ms-ssim -quant-table 3 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  250.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 3 -nojfif -dc-scan-opt 0" >> "$R1"
  251.         mozjpeg -tune-ms-ssim -quant-table 3 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  252.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 3 -nojfif -dc-scan-opt 1" >> "$R1"
  253.         mozjpeg -tune-ms-ssim -quant-table 3 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  254.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 3 -nojfif -dc-scan-opt 2" >> "$R1"
  255.         mozjpeg -tune-ms-ssim -quant-table 4 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  256.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 4 -nojfif -dc-scan-opt 0" >> "$R1"
  257.         mozjpeg -tune-ms-ssim -quant-table 4 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  258.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 4 -nojfif -dc-scan-opt 1" >> "$R1"
  259.         mozjpeg -tune-ms-ssim -quant-table 4 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  260.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 4 -nojfif -dc-scan-opt 2" >> "$R1"
  261.         mozjpeg -tune-ms-ssim -quant-table 5 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  262.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 5 -nojfif -dc-scan-opt 0" >> "$R1"
  263.         mozjpeg -tune-ms-ssim -quant-table 5 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  264.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 5 -nojfif -dc-scan-opt 1" >> "$R1"
  265.         mozjpeg -tune-ms-ssim -quant-table 5 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  266.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 5 -nojfif -dc-scan-opt 2" >> "$R1"
  267.         mozjpeg -tune-ms-ssim -quant-table 6 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  268.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 6 -nojfif -dc-scan-opt 0" >> "$R1"
  269.         mozjpeg -tune-ms-ssim -quant-table 6 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  270.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 6 -nojfif -dc-scan-opt 1" >> "$R1"
  271.         mozjpeg -tune-ms-ssim -quant-table 6 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  272.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 6 -nojfif -dc-scan-opt 2" >> "$R1"
  273.         mozjpeg -tune-ms-ssim -quant-table 7 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  274.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 7 -nojfif -dc-scan-opt 0" >> "$R1"
  275.         mozjpeg -tune-ms-ssim -quant-table 7 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  276.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 7 -nojfif -dc-scan-opt 1" >> "$R1"
  277.         mozjpeg -tune-ms-ssim -quant-table 7 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  278.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 7 -nojfif -dc-scan-opt 2" >> "$R1"
  279.         mozjpeg -tune-ms-ssim -quant-table 8 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  280.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 8 -nojfif -dc-scan-opt 0" >> "$R1"
  281.         mozjpeg -tune-ms-ssim -quant-table 8 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  282.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 8 -nojfif -dc-scan-opt 1" >> "$R1"
  283.         mozjpeg -tune-ms-ssim -quant-table 8 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  284.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-tune-ms-ssim -quant-table 8 -nojfif -dc-scan-opt 2" >> "$R1"
  285.         mozjpeg -dct float -nojfif -memdst "$i" > "$R0" 2>&1
  286.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -nojfif" >> "$R1"
  287.         mozjpeg -dct float -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  288.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -nojfif -dc-scan-opt 0" >> "$R1"
  289.         mozjpeg -dct float -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  290.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -nojfif -dc-scan-opt 1" >> "$R1"
  291.         mozjpeg -dct float -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  292.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -nojfif -dc-scan-opt 2" >> "$R1"
  293.         mozjpeg -dct float -quant-baseline -nojfif -memdst "$i" > "$R0" 2>&1
  294.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-baseline -nojfif" >> "$R1"
  295.         mozjpeg -dct float -quant-table 0 -nojfif -memdst "$i" > "$R0" 2>&1
  296.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 0 -nojfif" >> "$R1"
  297.         mozjpeg -dct float -quant-table 1 -nojfif -memdst "$i" > "$R0" 2>&1
  298.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 1 -nojfif" >> "$R1"
  299.         mozjpeg -dct float -quant-table 2 -nojfif -memdst "$i" > "$R0" 2>&1
  300.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 2 -nojfif" >> "$R1"
  301.         mozjpeg -dct float -quant-table 3 -nojfif -memdst "$i" > "$R0" 2>&1
  302.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 3 -nojfif" >> "$R1"
  303.         mozjpeg -dct float -quant-table 4 -nojfif -memdst "$i" > "$R0" 2>&1
  304.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 4 -nojfif" >> "$R1"
  305.         mozjpeg -dct float -quant-table 5 -nojfif -memdst "$i" > "$R0" 2>&1
  306.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 5 -nojfif" >> "$R1"
  307.         mozjpeg -dct float -quant-table 0 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  308.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 0 -nojfif -dc-scan-opt 0" >> "$R1"
  309.         mozjpeg -dct float -quant-table 0 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  310.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 0 -nojfif -dc-scan-opt 1" >> "$R1"
  311.         mozjpeg -dct float -quant-table 0 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  312.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 0 -nojfif -dc-scan-opt 2" >> "$R1"
  313.         mozjpeg -dct float -quant-table 1 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  314.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 1 -nojfif -dc-scan-opt 0" >> "$R1"
  315.         mozjpeg -dct float -quant-table 1 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  316.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 1 -nojfif -dc-scan-opt 1" >> "$R1"
  317.         mozjpeg -dct float -quant-table 1 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  318.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 1 -nojfif -dc-scan-opt 2" >> "$R1"
  319.         mozjpeg -dct float -quant-table 2 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  320.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 2 -nojfif -dc-scan-opt 0" >> "$R1"
  321.         mozjpeg -dct float -quant-table 2 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  322.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 2 -nojfif -dc-scan-opt 1" >> "$R1"
  323.         mozjpeg -dct float -quant-table 2 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  324.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 2 -nojfif -dc-scan-opt 2" >> "$R1"
  325.         mozjpeg -dct float -quant-table 3 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  326.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 3 -nojfif -dc-scan-opt 0" >> "$R1"
  327.         mozjpeg -dct float -quant-table 3 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  328.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 3 -nojfif -dc-scan-opt 1" >> "$R1"
  329.         mozjpeg -dct float -quant-table 3 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  330.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 3 -nojfif -dc-scan-opt 2" >> "$R1"
  331.         mozjpeg -dct float -quant-table 4 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  332.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 4 -nojfif -dc-scan-opt 0" >> "$R1"
  333.         mozjpeg -dct float -quant-table 4 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  334.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 4 -nojfif -dc-scan-opt 1" >> "$R1"
  335.         mozjpeg -dct float -quant-table 4 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  336.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 4 -nojfif -dc-scan-opt 2" >> "$R1"
  337.         mozjpeg -dct float -quant-table 5 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  338.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 5 -nojfif -dc-scan-opt 0" >> "$R1"
  339.         mozjpeg -dct float -quant-table 5 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  340.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 5 -nojfif -dc-scan-opt 1" >> "$R1"
  341.         mozjpeg -dct float -quant-table 5 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  342.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 5 -nojfif -dc-scan-opt 2" >> "$R1"
  343.         mozjpeg -dct float -quant-table 6 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  344.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 6 -nojfif -dc-scan-opt 0" >> "$R1"
  345.         mozjpeg -dct float -quant-table 6 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  346.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 6 -nojfif -dc-scan-opt 1" >> "$R1"
  347.         mozjpeg -dct float -quant-table 6 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  348.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 6 -nojfif -dc-scan-opt 2" >> "$R1"
  349.         mozjpeg -dct float -quant-table 7 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  350.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 7 -nojfif -dc-scan-opt 0" >> "$R1"
  351.         mozjpeg -dct float -quant-table 7 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  352.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 7 -nojfif -dc-scan-opt 1" >> "$R1"
  353.         mozjpeg -dct float -quant-table 7 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  354.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 7 -nojfif -dc-scan-opt 2" >> "$R1"
  355.         mozjpeg -dct float -quant-table 8 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  356.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 8 -nojfif -dc-scan-opt 0" >> "$R1"
  357.         mozjpeg -dct float -quant-table 8 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  358.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 8 -nojfif -dc-scan-opt 1" >> "$R1"
  359.         mozjpeg -dct float -quant-table 8 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  360.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -quant-table 8 -nojfif -dc-scan-opt 2" >> "$R1"
  361.         mozjpeg -dct float -tune-ssim -nojfif -memdst "$i" > "$R0" 2>&1
  362.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -nojfif" >> "$R1"
  363.         mozjpeg -dct float -tune-ssim -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  364.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -nojfif -dc-scan-opt 0" >> "$R1"
  365.         mozjpeg -dct float -tune-ssim -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  366.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -nojfif -dc-scan-opt 1" >> "$R1"
  367.         mozjpeg -dct float -tune-ssim -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  368.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -nojfif -dc-scan-opt 2" >> "$R1"
  369.         mozjpeg -dct float -tune-ssim -quant-baseline -nojfif -memdst "$i" > "$R0" 2>&1
  370.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-baseline -nojfif" >> "$R1"
  371.         mozjpeg -dct float -tune-ssim -quant-table 0 -nojfif -memdst "$i" > "$R0" 2>&1
  372.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 0 -nojfif" >> "$R1"
  373.         mozjpeg -dct float -tune-ssim -quant-table 1 -nojfif -memdst "$i" > "$R0" 2>&1
  374.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 1 -nojfif" >> "$R1"
  375.         mozjpeg -dct float -tune-ssim -quant-table 2 -nojfif -memdst "$i" > "$R0" 2>&1
  376.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 2 -nojfif" >> "$R1"
  377.         mozjpeg -dct float -tune-ssim -quant-table 3 -nojfif -memdst "$i" > "$R0" 2>&1
  378.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 3 -nojfif" >> "$R1"
  379.         mozjpeg -dct float -tune-ssim -quant-table 4 -nojfif -memdst "$i" > "$R0" 2>&1
  380.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 4 -nojfif" >> "$R1"
  381.         mozjpeg -dct float -tune-ssim -quant-table 5 -nojfif -memdst "$i" > "$R0" 2>&1
  382.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 5 -nojfif" >> "$R1"
  383.         mozjpeg -dct float -tune-ssim -quant-table 6 -nojfif -memdst "$i" > "$R0" 2>&1
  384.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 6 -nojfif" >> "$R1"
  385.         mozjpeg -dct float -tune-ssim -quant-table 7 -nojfif -memdst "$i" > "$R0" 2>&1
  386.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 7 -nojfif" >> "$R1"
  387.         mozjpeg -dct float -tune-ssim -quant-table 8 -nojfif -memdst "$i" > "$R0" 2>&1
  388.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 8 -nojfif" >> "$R1"
  389.         mozjpeg -dct float -tune-ssim -quant-table 0 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  390.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 0 -nojfif -dc-scan-opt 0" >> "$R1"
  391.         mozjpeg -dct float -tune-ssim -quant-table 0 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  392.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 0 -nojfif -dc-scan-opt 1" >> "$R1"
  393.         mozjpeg -dct float -tune-ssim -quant-table 0 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  394.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 0 -nojfif -dc-scan-opt 2" >> "$R1"
  395.         mozjpeg -dct float -tune-ssim -quant-table 1 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  396.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 1 -nojfif -dc-scan-opt 0" >> "$R1"
  397.         mozjpeg -dct float -tune-ssim -quant-table 1 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  398.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 1 -nojfif -dc-scan-opt 1" >> "$R1"
  399.         mozjpeg -dct float -tune-ssim -quant-table 1 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  400.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 1 -nojfif -dc-scan-opt 2" >> "$R1"
  401.         mozjpeg -dct float -tune-ssim -quant-table 2 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  402.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 2 -nojfif -dc-scan-opt 0" >> "$R1"
  403.         mozjpeg -dct float -tune-ssim -quant-table 2 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  404.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 2 -nojfif -dc-scan-opt 1" >> "$R1"
  405.         mozjpeg -dct float -tune-ssim -quant-table 2 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  406.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 2 -nojfif -dc-scan-opt 2" >> "$R1"
  407.         mozjpeg -dct float -tune-ssim -quant-table 3 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  408.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 3 -nojfif -dc-scan-opt 0" >> "$R1"
  409.         mozjpeg -dct float -tune-ssim -quant-table 3 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  410.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 3 -nojfif -dc-scan-opt 1" >> "$R1"
  411.         mozjpeg -dct float -tune-ssim -quant-table 3 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  412.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 3 -nojfif -dc-scan-opt 2" >> "$R1"
  413.         mozjpeg -dct float -tune-ssim -quant-table 4 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  414.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 4 -nojfif -dc-scan-opt 0" >> "$R1"
  415.         mozjpeg -dct float -tune-ssim -quant-table 4 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  416.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 4 -nojfif -dc-scan-opt 1" >> "$R1"
  417.         mozjpeg -dct float -tune-ssim -quant-table 4 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  418.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 4 -nojfif -dc-scan-opt 2" >> "$R1"
  419.         mozjpeg -dct float -tune-ssim -quant-table 5 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  420.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 5 -nojfif -dc-scan-opt 0" >> "$R1"
  421.         mozjpeg -dct float -tune-ssim -quant-table 5 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  422.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 5 -nojfif -dc-scan-opt 1" >> "$R1"
  423.         mozjpeg -dct float -tune-ssim -quant-table 5 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  424.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 5 -nojfif -dc-scan-opt 2" >> "$R1"
  425.         mozjpeg -dct float -tune-ssim -quant-table 6 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  426.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 6 -nojfif -dc-scan-opt 0" >> "$R1"
  427.         mozjpeg -dct float -tune-ssim -quant-table 6 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  428.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 6 -nojfif -dc-scan-opt 1" >> "$R1"
  429.         mozjpeg -dct float -tune-ssim -quant-table 6 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  430.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 6 -nojfif -dc-scan-opt 2" >> "$R1"
  431.         mozjpeg -dct float -tune-ssim -quant-table 7 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  432.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 7 -nojfif -dc-scan-opt 0" >> "$R1"
  433.         mozjpeg -dct float -tune-ssim -quant-table 7 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  434.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 7 -nojfif -dc-scan-opt 1" >> "$R1"
  435.         mozjpeg -dct float -tune-ssim -quant-table 7 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  436.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 7 -nojfif -dc-scan-opt 2" >> "$R1"
  437.         mozjpeg -dct float -tune-ssim -quant-table 8 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  438.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 8 -nojfif -dc-scan-opt 0" >> "$R1"
  439.         mozjpeg -dct float -tune-ssim -quant-table 8 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  440.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 8 -nojfif -dc-scan-opt 1" >> "$R1"
  441.         mozjpeg -dct float -tune-ssim -quant-table 8 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  442.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ssim -quant-table 8 -nojfif -dc-scan-opt 2" >> "$R1"
  443.         mozjpeg -dct float -tune-ms-ssim -nojfif -memdst "$i" > "$R0" 2>&1
  444.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -nojfif" >> "$R1"
  445.         mozjpeg -dct float -tune-ms-ssim -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  446.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -nojfif -dc-scan-opt 0" >> "$R1"
  447.         mozjpeg -dct float -tune-ms-ssim -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  448.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -nojfif -dc-scan-opt 1" >> "$R1"
  449.         mozjpeg -dct float -tune-ms-ssim -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  450.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -nojfif -dc-scan-opt 2" >> "$R1"
  451.         mozjpeg -dct float -tune-ms-ssim -quant-baseline -nojfif -memdst "$i" > "$R0" 2>&1
  452.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-baseline -nojfif" >> "$R1"
  453.         mozjpeg -dct float -tune-ms-ssim -quant-table 0 -nojfif -memdst "$i" > "$R0" 2>&1
  454.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 0 -nojfif" >> "$R1"
  455.         mozjpeg -dct float -tune-ms-ssim -quant-table 1 -nojfif -memdst "$i" > "$R0" 2>&1
  456.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 1 -nojfif" >> "$R1"
  457.         mozjpeg -dct float -tune-ms-ssim -quant-table 2 -nojfif -memdst "$i" > "$R0" 2>&1
  458.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 2 -nojfif" >> "$R1"
  459.         mozjpeg -dct float -tune-ms-ssim -quant-table 3 -nojfif -memdst "$i" > "$R0" 2>&1
  460.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 3 -nojfif" >> "$R1"
  461.         mozjpeg -dct float -tune-ms-ssim -quant-table 4 -nojfif -memdst "$i" > "$R0" 2>&1
  462.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 4 -nojfif" >> "$R1"
  463.         mozjpeg -dct float -tune-ms-ssim -quant-table 5 -nojfif -memdst "$i" > "$R0" 2>&1
  464.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 5 -nojfif" >> "$R1"
  465.         mozjpeg -dct float -tune-ms-ssim -quant-table 6 -nojfif -memdst "$i" > "$R0" 2>&1
  466.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 6 -nojfif" >> "$R1"
  467.         mozjpeg -dct float -tune-ms-ssim -quant-table 7 -nojfif -memdst "$i" > "$R0" 2>&1
  468.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 7 -nojfif" >> "$R1"
  469.         mozjpeg -dct float -tune-ms-ssim -quant-table 8 -nojfif -memdst "$i" > "$R0" 2>&1
  470.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 8 -nojfif" >> "$R1"
  471.         mozjpeg -dct float -tune-ms-ssim -quant-table 0 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  472.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 0 -nojfif -dc-scan-opt 0" >> "$R1"
  473.         mozjpeg -dct float -tune-ms-ssim -quant-table 0 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  474.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 0 -nojfif -dc-scan-opt 1" >> "$R1"
  475.         mozjpeg -dct float -tune-ms-ssim -quant-table 0 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  476.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 0 -nojfif -dc-scan-opt 2" >> "$R1"
  477.         mozjpeg -dct float -tune-ms-ssim -quant-table 1 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  478.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 1 -nojfif -dc-scan-opt 0" >> "$R1"
  479.         mozjpeg -dct float -tune-ms-ssim -quant-table 1 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  480.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 1 -nojfif -dc-scan-opt 1" >> "$R1"
  481.         mozjpeg -dct float -tune-ms-ssim -quant-table 1 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  482.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 1 -nojfif -dc-scan-opt 2" >> "$R1"
  483.         mozjpeg -dct float -tune-ms-ssim -quant-table 2 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  484.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 2 -nojfif -dc-scan-opt 0" >> "$R1"
  485.         mozjpeg -dct float -tune-ms-ssim -quant-table 2 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  486.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 2 -nojfif -dc-scan-opt 1" >> "$R1"
  487.         mozjpeg -dct float -tune-ms-ssim -quant-table 2 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  488.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 2 -nojfif -dc-scan-opt 2" >> "$R1"
  489.         mozjpeg -dct float -tune-ms-ssim -quant-table 3 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  490.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 3 -nojfif -dc-scan-opt 0" >> "$R1"
  491.         mozjpeg -dct float -tune-ms-ssim -quant-table 3 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  492.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 3 -nojfif -dc-scan-opt 1" >> "$R1"
  493.         mozjpeg -dct float -tune-ms-ssim -quant-table 3 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  494.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 3 -nojfif -dc-scan-opt 2" >> "$R1"
  495.         mozjpeg -dct float -tune-ms-ssim -quant-table 4 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  496.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 4 -nojfif -dc-scan-opt 0" >> "$R1"
  497.         mozjpeg -dct float -tune-ms-ssim -quant-table 4 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  498.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 4 -nojfif -dc-scan-opt 1" >> "$R1"
  499.         mozjpeg -dct float -tune-ms-ssim -quant-table 4 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  500.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 4 -nojfif -dc-scan-opt 2" >> "$R1"
  501.         mozjpeg -dct float -tune-ms-ssim -quant-table 5 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  502.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 5 -nojfif -dc-scan-opt 0" >> "$R1"
  503.         mozjpeg -dct float -tune-ms-ssim -quant-table 5 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  504.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 5 -nojfif -dc-scan-opt 1" >> "$R1"
  505.         mozjpeg -dct float -tune-ms-ssim -quant-table 5 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  506.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 5 -nojfif -dc-scan-opt 2" >> "$R1"
  507.         mozjpeg -dct float -tune-ms-ssim -quant-table 6 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  508.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 6 -nojfif -dc-scan-opt 0" >> "$R1"
  509.         mozjpeg -dct float -tune-ms-ssim -quant-table 6 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  510.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 6 -nojfif -dc-scan-opt 1" >> "$R1"
  511.         mozjpeg -dct float -tune-ms-ssim -quant-table 6 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  512.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 6 -nojfif -dc-scan-opt 2" >> "$R1"
  513.         mozjpeg -dct float -tune-ms-ssim -quant-table 7 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  514.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 7 -nojfif -dc-scan-opt 0" >> "$R1"
  515.         mozjpeg -dct float -tune-ms-ssim -quant-table 7 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  516.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 7 -nojfif -dc-scan-opt 1" >> "$R1"
  517.         mozjpeg -dct float -tune-ms-ssim -quant-table 7 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  518.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 7 -nojfif -dc-scan-opt 2" >> "$R1"
  519.         mozjpeg -dct float -tune-ms-ssim -quant-table 8 -nojfif -dc-scan-opt 0 -memdst "$i" > "$R0" 2>&1
  520.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 8 -nojfif -dc-scan-opt 0" >> "$R1"
  521.         mozjpeg -dct float -tune-ms-ssim -quant-table 8 -nojfif -dc-scan-opt 1 -memdst "$i" > "$R0" 2>&1
  522.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 8 -nojfif -dc-scan-opt 1" >> "$R1"
  523.         mozjpeg -dct float -tune-ms-ssim -quant-table 8 -nojfif -dc-scan-opt 2 -memdst "$i" > "$R0" 2>&1
  524.         n=$(grep -oE "[0-9]+" "$R0"); printf "\n$n\t-dct float -tune-ms-ssim -quant-table 8 -nojfif -dc-scan-opt 2" >> "$R1"
  525.  
  526.         #Files are sorted alphabetically by parameter names and numerically by size in bytes.
  527.         sort -k 2 "$R1" > "$R2"
  528.         sort -n "$R1" > "$R3"
  529.  
  530.         E=`date +%s`
  531.         T=$(("$E"-"$S"))
  532.         sed -i -e "1iSeconds spent processing: $T\nBytes\tFilename/parameters\n$size\t$name1" "$R2" "$R3"
  533.  
  534.         #Creates an unique suffix for the log files of the file being processed. The suffix has filename (up to 30 char) and 5 random char, which attempt to prevent overwriting if there are multiple identical filenames in subfolders.
  535.         log=$(printf "$(echo "$name2" | cut -c -30)"-"$(</dev/urandom tr -cd 'a-zA-Z0-9' | head -c5; echo -n "")")
  536.  
  537.         #RAM files are written to disk in log folder.
  538.         cp "$R2" "./$rnd/$log-alph.txt"
  539.         cp "$R3" "./$rnd/$log-nume.txt"
  540.         printf ' %s sec spent on file, log prefix: %s\n' "$T" "$log"
  541.     fi
  542. #Finds recursively files with variable extensions. Add "-maxdepth 1" after "find" to search non-recursively. To compress e.g. png files only, remove "-iname '*.jpg' -o -iname '*.jpeg' -o".
  543. done < <(find . -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' \) -print0)
  544.  
  545. #Temp files are removed from RAM.
  546. rm -f "$R0" "$R1" "$R2" "$R3"
  547.  
  548. printf "END:\t`date`\n"
  549.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement