mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-26 15:49:43 +02:00
ppmdiff detects lack of changes more quickly. Improved cache robustness.
- scripts/ppmdiff/ppmdiff.c (main): do a quick memcmp to detect absence of changes instead of comparing pixel by pixel (saves 30% of total run time when remaking ben-wpan/atrf from cache) - scripts/schhist2web: added title and copyright header - scripts/schhist2web: create $out/names after deleting the cache (-n) - scripts/schhist2web: fat_* directories were created under $out, not $cache - scripts/schhist2web: remove ppm_* and fat_* directories being worked on if we fail to complete the process for some reason
This commit is contained in:
parent
5761b6e650
commit
94dc35ed98
@ -376,16 +376,18 @@ int main(int argc, char *const *argv)
|
|||||||
|
|
||||||
old = load_ppm(argv[optind], &x, &y);
|
old = load_ppm(argv[optind], &x, &y);
|
||||||
new = load_ppm(argv[optind+1], &x, &y);
|
new = load_ppm(argv[optind+1], &x, &y);
|
||||||
d = diff(old, new, x, y);
|
|
||||||
if (shadow_old) {
|
if (shadow_old) {
|
||||||
a = load_ppm(shadow_old, &x, &y);
|
a = load_ppm(shadow_old, &x, &y);
|
||||||
b = load_ppm(shadow_new, &x, &y);
|
b = load_ppm(shadow_new, &x, &y);
|
||||||
|
if (!force && !memcmp(a, b, x*y*3))
|
||||||
|
return 1;
|
||||||
shadow_diff(a, b, x, y);
|
shadow_diff(a, b, x, y);
|
||||||
}
|
}
|
||||||
|
if (!force && !areas && !memcmp(old, new, x*y*3))
|
||||||
|
return 1;
|
||||||
|
d = diff(old, new, x, y);
|
||||||
if (frame_dist)
|
if (frame_dist)
|
||||||
mark_areas(d, x, y);
|
mark_areas(d, x, y);
|
||||||
if (!areas && !force)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (out_name) {
|
if (out_name) {
|
||||||
out = fopen(out_name, "w");
|
out = fopen(out_name, "w");
|
||||||
|
@ -1,4 +1,16 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# schhist2web - Web-browseable graphical revision history of schematics
|
||||||
|
#
|
||||||
|
# Written 2010 by Werner Almesberger
|
||||||
|
# Copyright 2010 Werner Almesberger
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
OUTDIR=_out
|
OUTDIR=_out
|
||||||
THUMB_OPTS="-w 3 -d 60 -c 0.5,0.5,0.5 -n 1,1,0"
|
THUMB_OPTS="-w 3 -d 60 -c 0.5,0.5,0.5 -n 1,1,0"
|
||||||
@ -46,10 +58,11 @@ EOF
|
|||||||
no_cache=false
|
no_cache=false
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-n) no_cache=true;;
|
-n) no_cache=true
|
||||||
|
shift;;
|
||||||
-c) [ -z "$1" ] && usage
|
-c) [ -z "$1" ] && usage
|
||||||
cache="$1"
|
cache="$1"
|
||||||
shift;;
|
shift 2;;
|
||||||
-*) usage;;
|
-*) usage;;
|
||||||
*) break;;
|
*) break;;
|
||||||
esac
|
esac
|
||||||
@ -105,8 +118,8 @@ first=`gitenealogy "$dir/$sch" | sed '$s/ .*//p;d'`
|
|||||||
schname=`gitenealogy "$dir/$sch" | sed '$s/^.* //p;d'`
|
schname=`gitenealogy "$dir/$sch" | sed '$s/^.* //p;d'`
|
||||||
|
|
||||||
rm -rf "$out/diff_*" "$out/thumb_*" "$out/names"
|
rm -rf "$out/diff_*" "$out/thumb_*" "$out/names"
|
||||||
mkdir -p "$out/names"
|
|
||||||
$no_cache && rm -rf "$cache"
|
$no_cache && rm -rf "$cache"
|
||||||
|
mkdir -p "$out/names"
|
||||||
mkdir -p "$cache"
|
mkdir -p "$cache"
|
||||||
|
|
||||||
for n in $first `git rev-list --reverse $first..HEAD`; do
|
for n in $first `git rev-list --reverse $first..HEAD`; do
|
||||||
@ -116,16 +129,18 @@ echo Processing $n
|
|||||||
echo Name change $schname to $new 1>&2
|
echo Name change $schname to $new 1>&2
|
||||||
schname="$new"
|
schname="$new"
|
||||||
fi
|
fi
|
||||||
|
trap "rm -rf \"$cache/ppm_$n\" \"$cache/fat_$n\"" 0
|
||||||
if [ ! -d "$cache/ppm_$n" ]; then
|
if [ ! -d "$cache/ppm_$n" ]; then
|
||||||
rm -rf "$cache/ppm_$n"
|
rm -rf "$cache/ppm_$n"
|
||||||
mkdir "$cache/ppm_$n"
|
mkdir "$cache/ppm_$n"
|
||||||
gitsch2ppm "$dir" "$schname" $n "$cache/ppm_$n" || exit
|
gitsch2ppm "$dir" "$schname" $n "$cache/ppm_$n" || exit
|
||||||
gitsch2ppm -w 500 "$dir" "$schname" $n "$out/fat_$n" || exit
|
gitsch2ppm -w 500 "$dir" "$schname" $n "$cache/fat_$n" || exit
|
||||||
fi
|
fi
|
||||||
for m in "$cache/ppm_$n/"*; do
|
for m in "$cache/ppm_$n/"*; do
|
||||||
[ "$m" = "$cache/ppm_$n/*" ] && break
|
[ "$m" = "$cache/ppm_$n/*" ] && break
|
||||||
touch "$out/names/"`basename "$m" .ppm`
|
touch "$out/names/"`basename "$m" .ppm`
|
||||||
done
|
done
|
||||||
|
trap 0
|
||||||
done
|
done
|
||||||
|
|
||||||
index="$out/index.html"
|
index="$out/index.html"
|
||||||
|
Loading…
Reference in New Issue
Block a user