1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-12-23 09:43:00 +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:
Werner Almesberger 2010-08-27 13:40:38 -03:00
parent 5761b6e650
commit 94dc35ed98
2 changed files with 24 additions and 7 deletions

View File

@ -376,16 +376,18 @@ int main(int argc, char *const *argv)
old = load_ppm(argv[optind], &x, &y);
new = load_ppm(argv[optind+1], &x, &y);
d = diff(old, new, x, y);
if (shadow_old) {
a = load_ppm(shadow_old, &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);
}
if (!force && !areas && !memcmp(old, new, x*y*3))
return 1;
d = diff(old, new, x, y);
if (frame_dist)
mark_areas(d, x, y);
if (!areas && !force)
return 1;
if (out_name) {
out = fopen(out_name, "w");

View File

@ -1,4 +1,16 @@
#!/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
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
while true; do
case "$1" in
-n) no_cache=true;;
-n) no_cache=true
shift;;
-c) [ -z "$1" ] && usage
cache="$1"
shift;;
shift 2;;
-*) usage;;
*) break;;
esac
@ -105,8 +118,8 @@ first=`gitenealogy "$dir/$sch" | sed '$s/ .*//p;d'`
schname=`gitenealogy "$dir/$sch" | sed '$s/^.* //p;d'`
rm -rf "$out/diff_*" "$out/thumb_*" "$out/names"
mkdir -p "$out/names"
$no_cache && rm -rf "$cache"
mkdir -p "$out/names"
mkdir -p "$cache"
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
schname="$new"
fi
trap "rm -rf \"$cache/ppm_$n\" \"$cache/fat_$n\"" 0
if [ ! -d "$cache/ppm_$n" ]; then
rm -rf "$cache/ppm_$n"
mkdir "$cache/ppm_$n"
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
for m in "$cache/ppm_$n/"*; do
[ "$m" = "$cache/ppm_$n/*" ] && break
touch "$out/names/"`basename "$m" .ppm`
done
trap 0
done
index="$out/index.html"