summaryrefslogtreecommitdiff
path: root/tests/gen_golden.sh
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-26 20:05:20 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-26 20:05:20 +0100
commit375d87a9b0ec1cf2fffd705adb870c86144d2400 (patch)
tree1e8e05e7cd58686628d0f4622622456613a42e4d /tests/gen_golden.sh
parent45425dd047b791fe63f13a46a3251c529cfffc94 (diff)
Replace the C++ implementation with the Rust port
The Rust port (formerly gipfel-rs) is now the official successor to the FLTK/GSL C++ code base. This squashes the port into a single commit and removes the C++ sources (they remain in the git history below). Layout: crates/gipfel-core headless core: hills, panorama geometry, projections (maxima-generated derivatives), pure-Rust LM fit, gipfel: JPEG comment + EXIF I/O, profiles, stitching crates/gipfel-cli command-line tools (export, info, stitch, profiles) crates/gipfel-app Cosmic DE (libcosmic) GUI, binary name `gipfel` codegen/ maxima scripts + regen.sh for the projection code tests/ golden files + C++ reference harnesses (historical) The original README is kept for now; it will be updated to describe the Rust build. gipfel.dat, AUTHORS, ChangeLog and NEWS are unchanged.
Diffstat (limited to 'tests/gen_golden.sh')
-rwxr-xr-xtests/gen_golden.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/gen_golden.sh b/tests/gen_golden.sh
new file mode 100755
index 0000000..c23ec28
--- /dev/null
+++ b/tests/gen_golden.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+# Generate golden reference data from the original C++ implementation.
+# Requires: the gipfel C++ sources built (objects in $SRC), g++, GSL, maxima.
+set -e
+cd "$(dirname "$0")"
+
+SRC=${GIPFEL_SRC:-$HOME/gipfel/src}
+DATA=${GIPFEL_DATA:-$HOME/gipfel/gipfel.dat}
+BUILD=harness/build
+mkdir -p $BUILD golden
+
+# rename class-scoped generated functions to free functions
+sed 's/ProjectionRectilinear::/rect_/g' $SRC/ProjectionRectilinear_funcs.cxx > $BUILD/rect_funcs.cxx
+sed 's/ProjectionCylindrical::/cyl_/g' $SRC/ProjectionCylindrical_funcs.cxx > $BUILD/cyl_funcs.cxx
+
+g++ -O2 -o $BUILD/funcsdump harness/funcsdump.cxx -I$BUILD -lm
+$BUILD/funcsdump > golden/funcs.txt
+
+g++ -O2 -o $BUILD/fitdump harness/fitdump.cxx \
+ -I$SRC $SRC/Panorama.o $SRC/Hill.o $SRC/ProjectionLSQ.o \
+ $SRC/ProjectionRectilinear.o $SRC/ProjectionCylindrical.o \
+ -lm -lgsl -lgslcblas
+
+$BUILD/fitdump "$DATA" 0 > golden/fit_rect.txt
+$BUILD/fitdump "$DATA" 1 > golden/fit_cyl.txt
+
+g++ -O2 -o $BUILD/exportdump harness/exportdump.cxx \
+ -I$SRC $SRC/Panorama.o $SRC/Hill.o $SRC/ProjectionLSQ.o \
+ $SRC/ProjectionRectilinear.o $SRC/ProjectionCylindrical.o $SRC/ImageMetaData.o \
+ -lexiv2 -ltiff -lgsl -lgslcblas -lm
+
+$BUILD/exportdump golden/test.jpg "$DATA" 2>/dev/null > golden/export.txt
+
+g++ -O2 -o $BUILD/stitchdump harness/stitchdump.cxx \
+ -I$SRC $SRC/Panorama.o $SRC/Hill.o $SRC/ScanImage.o $SRC/ProjectionLSQ.o \
+ $SRC/ProjectionRectilinear.o $SRC/ProjectionCylindrical.o \
+ -lfltk -lgsl -lgslcblas -lm
+
+# stitch: cylindrical resample of one image (projtype center pitch roll scale
+# k0 k1 x0 out_w out_h from to bicubic)
+$BUILD/stitchdump golden/stitch.ppm 0 20 2 0 200 0 0 0 64 48 10 30 0 > golden/stitch_rect_near.txt
+$BUILD/stitchdump golden/stitch.ppm 0 20 2 0 200 0 0 0 64 48 10 30 1 > golden/stitch_rect_bic.txt
+$BUILD/stitchdump golden/stitch.ppm 1 20 2 0 200 0 0 0 64 48 10 30 1 > golden/stitch_cyl_bic.txt
+$BUILD/stitchdump golden/stitch.ppm 0 20 2 3 200 -0.3 0.1 0 64 48 10 30 1 > golden/stitch_dist_bic.txt
+
+echo "golden written:"
+wc -l golden/*.txt