Date:2010-08-27 18:40:38 (9 years 1 month ago)
Author:Werner Almesberger
Commit:94dc35ed98e44557bf6b21904259b981aa2b1fcf
Message: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
Files: scripts/ppmdiff/ppmdiff.c (1 diff)
scripts/schhist2web (4 diffs)

Change Details

scripts/ppmdiff/ppmdiff.c
376376
377377    old = load_ppm(argv[optind], &x, &y);
378378    new = load_ppm(argv[optind+1], &x, &y);
379    d = diff(old, new, x, y);
380379    if (shadow_old) {
381380        a = load_ppm(shadow_old, &x, &y);
382381        b = load_ppm(shadow_new, &x, &y);
382        if (!force && !memcmp(a, b, x*y*3))
383            return 1;
383384        shadow_diff(a, b, x, y);
384385    }
386    if (!force && !areas && !memcmp(old, new, x*y*3))
387        return 1;
388    d = diff(old, new, x, y);
385389    if (frame_dist)
386390        mark_areas(d, x, y);
387    if (!areas && !force)
388        return 1;
389391
390392    if (out_name) {
391393        out = fopen(out_name, "w");
scripts/schhist2web
11#!/bin/sh
2#
3# schhist2web - Web-browseable graphical revision history of schematics
4#
5# Written 2010 by Werner Almesberger
6# Copyright 2010 Werner Almesberger
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13
214
315OUTDIR=_out
416THUMB_OPTS="-w 3 -d 60 -c 0.5,0.5,0.5 -n 1,1,0"
...... 
4658no_cache=false
4759while true; do
4860    case "$1" in
49    -n) no_cache=true;;
61    -n) no_cache=true
62    shift;;
5063    -c) [ -z "$1" ] && usage
5164    cache="$1"
52    shift;;
65    shift 2;;
5366    -*) usage;;
5467    *) break;;
5568    esac
...... 
105118schname=`gitenealogy "$dir/$sch" | sed '$s/^.* //p;d'`
106119
107120rm -rf "$out/diff_*" "$out/thumb_*" "$out/names"
108mkdir -p "$out/names"
109121$no_cache && rm -rf "$cache"
122mkdir -p "$out/names"
110123mkdir -p "$cache"
111124
112125for n in $first `git rev-list --reverse $first..HEAD`; do
...... 
116129    echo Name change $schname to $new 1>&2
117130    schname="$new"
118131    fi
132    trap "rm -rf \"$cache/ppm_$n\" \"$cache/fat_$n\"" 0
119133    if [ ! -d "$cache/ppm_$n" ]; then
120134    rm -rf "$cache/ppm_$n"
121135    mkdir "$cache/ppm_$n"
122136    gitsch2ppm "$dir" "$schname" $n "$cache/ppm_$n" || exit
123    gitsch2ppm -w 500 "$dir" "$schname" $n "$out/fat_$n" || exit
137    gitsch2ppm -w 500 "$dir" "$schname" $n "$cache/fat_$n" || exit
124138    fi
125139    for m in "$cache/ppm_$n/"*; do
126140    [ "$m" = "$cache/ppm_$n/*" ] && break
127141    touch "$out/names/"`basename "$m" .ppm`
128142    done
143    trap 0
129144done
130145
131146index="$out/index.html"

Archive Download the corresponding diff file



interactive