Updated compareRT for easy patched-vs-unpatched comparison.

This commit is contained in:
DrSlony
2015-02-24 12:29:56 +01:00
parent ae296dbb9b
commit 0b76f06a40

View File

@@ -1,51 +1,59 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# compareRT version 1.0, 2014-01-24 # compareRT version 1.0, 2014-01-24
# compareRT version 1.1, 2015-02-24
# Processes all images in the current dir with two different # Processes all images in the current dir with two different
# RawTherapee versions and tests for differences. # RawTherapee versions and tests for differences.
#
# Run this script from the dir with the images you want to test. # Run this script from the dir with the images you want to test.
# Make sure the PP3 you set below is in the same dir.
# Don't worry about non-image files. # Don't worry about non-image files.
# In order to keep this simple, all dir names must end with / # Each dir specified in rtDirs and the outDir must end with /
#
# CC-BY-SA 3.0 DrSlony # CC-BY-SA 3.0 DrSlony
unset rtDirs outDir pp3 imgs v i unset rtDirs outDir pp3 imgs v i c
#--- Edit these as needed. #--- Edit these as needed.
rtDirs=("$HOME/rt_default_Release/" "$HOME/rt_default_Release_patched/") rtDirs=("$HOME/rt_default_release/" "$HOME/rt_default_release_patched/")
pp3="foo.pp3"
outDir="/tmp/compareRT/" outDir="/tmp/compareRT/"
pp3="$HOME/rawtherapee/rtdata/profiles/Default.pp3"
while IFS=$'\n' read f; do
imgs+=("$f")
done < <(find . -maxdepth 1 -type f -not -iname "*.txt" -not -iname "*.pp3" | sed "s_./__" | sort)
#--- #---
while IFS=$'\n' read f; do
imgs+=("$f")
done < <(find . -maxdepth 1 -type f -not -iname "*.txt" -not -iname "*.pp3" | sed "s_./__" | sort)
abort () { abort () {
printf "%s\n" "" "Aborted" printf "%s\n" "" "Aborted"
exit 1 exit 1
} }
trap 'abort' HUP INT QUIT ABRT TERM trap 'abort' HUP INT QUIT ABRT TERM
mkdir -p "$outDir" || exit 1 mkdir -p "$outDir" || exit 1
i=0 i=0
for rt in "${rtDirs[@]}"; do for rtDir in "${rtDirs[@]}"; do
c=1 c=1
v+=("$(grep "Changeset:.*" "${rt}/AboutThisBuild.txt" | sed "s/Changeset: //")") pp3name=${pp3%.*}
printf "%s\n" "Developing images using RawTherapee changeset ${v[$i]}" pp3name=${pp3name#*/}
for img in "${imgs[@]}"; do v+=("$(grep "Changeset:.*" "${rtDir}/AboutThisBuild.txt" | sed "s/Changeset: //")")
printf "%s" "${c}/${#imgs[@]} - " printf "%s\n" "Developing images using RawTherapee changeset ${v[$i]} - ${rtDir}"
"${rt}rawtherapee" -o "${outDir}${img%.*}_${v[$i]}.tif" -p "${pp3}" -t -Y -c "$img" | grep Processing for img in "${imgs[@]}"; do
((c++)) printf "%s" "${c}/${#imgs[@]} - "
done "${rtDir}rawtherapee" -o "${outDir}${img%.*}_${v[i]}_${pp3%.*}.tif" -p "${pp3}" -t -Y -c "$img" | grep Processing
((i++)) ((c++))
echo done
((i++))
echo
done done
printf "%s\n" "Comparing images" printf "%s\n" "Comparing images"
hash compare 2>/dev/null || { printf "%s\n" "\"compare\" not found." "Install imagemagick (or graphicsmagick if it has \"compare\"), then re-run this script."; exit 1; } hash compare 2>/dev/null || { printf "%s\n" "\"compare\" not found." "Install imagemagick (or graphicsmagick if it has \"compare\"), then re-run this script."; exit 1; }
n=1 n=1
for img in "${imgs[@]}"; do for img in "${imgs[@]}"; do
printf "%s\n" "${n}/${c} - ${img}" printf "%s\n" "${n}/${c} - ${img}"
compare "${outDir}${img%.*}_${v[0]}.tif" "${outDir}${img%.*}_${v[1]}.tif" "${outDir}${img%.*}_compare.tif" compare -quiet "${outDir}${img%.*}_${v[0]}_${pp3%.*}.tif" "${outDir}${img%.*}_${v[1]}_${pp3%.*}.tif" "${outDir}${img%.*}_compare.tif"
((n++)) ((n++))
done done
printf "%s\n" "Finished" printf "%s\n" "" "${v[0]} is ${rtDirs[0]}" "${v[1]} is ${rtDirs[1]}" "Finished"