Commit 9234a307 authored by Andrey Filippov's avatar Andrey Filippov

CLAUDE: Step 1 complete — JNA bindings for TpProc imclt/corr + StageProc full validation

TpJna: tp_proc_setup_rbg_corr/exec_imclt/get_rbg/exec_corr2d/get_corr2d_combo + extended
tp_proc_convert_selftest. StageProc validates convert+imclt+corr through the persistent API
(all match goldens) + no_kernels smoke. PASS on 5060 Ti.
Co-Authored-By: 's avatarClaude Opus 4.8 (1M context) <noreply@anthropic.com>
parent dcc556dd
......@@ -26,20 +26,23 @@ public class StageProc {
Pointer m = lib.tp_create_module(srcdir, devrt);
if (m == null) { System.out.println("FAIL: tp_create_module:\n" + lib.tp_last_error()); System.exit(1); }
double[] cltErr = new double[1], nokern = new double[1];
double[] cltErr = new double[1], rbgErr = new double[1], corrErr = new double[1], nokern = new double[1];
int[] nActive = new int[1];
int rc = lib.tp_proc_convert_selftest(m, lwir, root, cltErr, nokern, nActive);
int rc = lib.tp_proc_convert_selftest(m, lwir, root, cltErr, rbgErr, corrErr, nokern, nActive);
if (rc != 0) { System.out.printf("FAIL: selftest rc=%d: %s%n", rc, lib.tp_last_error()); System.exit(2); }
boolean cltOk = (cltErr[0] >= 0) && !Double.isNaN(cltErr[0]) && (cltErr[0] < 1.0) && (nActive[0] > 0);
boolean nokernOk = (nokern[0] >= 0); // >=0 means it ran and output was finite (-1 non-finite, -2 launch err)
System.out.printf(" persistent convert_direct: num_active=%d max|CLT-golden|=%.6g %s%n",
nActive[0], cltErr[0], cltOk ? "PASS" : "FAIL");
boolean cltOk = (cltErr[0] >= 0) && !Double.isNaN(cltErr[0]) && (cltErr[0] < 1.0) && (nActive[0] > 0);
boolean rbgOk = (rbgErr[0] >= 0) && !Double.isNaN(rbgErr[0]) && (rbgErr[0] < 1.0);
boolean corrOk = (corrErr[0] >= 0) && !Double.isNaN(corrErr[0]) && (corrErr[0] < 1e-3); // order-independent value err
boolean nokernOk = (nokern[0] >= 0);
System.out.printf(" convert_direct: num_active=%d max|CLT-golden|=%.6g %s%n", nActive[0], cltErr[0], cltOk ? "PASS" : "FAIL");
System.out.printf(" imclt_rbg_all: max|RBG-golden|=%.6g %s%n", rbgErr[0], rbgOk ? "PASS" : "FAIL");
System.out.printf(" correlate2D quad: sorted(value) max=%.6g %s%n", corrErr[0], corrOk ? "PASS" : "FAIL");
System.out.printf(" no_kernels smoke: %s (max|CLT|=%.4g)%n",
nokernOk ? "ran, finite" : (nokern[0] == -1 ? "NON-FINITE" : "launch error"), nokern[0]);
lib.tp_destroy_module(m);
boolean ok = cltOk && nokernOk;
System.out.println(ok ? "RESULT: PASS (persistent TpProc convert matches golden; no_kernels path runs)"
boolean ok = cltOk && rbgOk && corrOk && nokernOk;
System.out.println(ok ? "RESULT: PASS (persistent TpProc: convert+imclt+corr match goldens; no_kernels runs)"
: "RESULT: FAIL");
System.exit(ok ? 0 : 3);
}
......
......@@ -78,8 +78,18 @@ public interface TpJna extends Library {
/** convert_direct: ref_scene (0/1 -> clt vs clt_ref), erase_clt (-1/0/1), no_kernels (0/1). */
int tp_proc_exec_convert_direct(Pointer proc, int refScene, int eraseClt, int noKernels);
int tp_proc_get_clt(Pointer proc, int cam, int refScene, float[] out);
/** Allocate imclt(RBG) + correlation buffers and store corr config. */
int tp_proc_setup_rbg_corr(Pointer proc, int numPairs, int s0,int s1,int s2,int s3,
float cw0,float cw1,float cw2, int corrOutRad);
int tp_proc_exec_imclt(Pointer proc, int applyLpf);
int tp_proc_get_rbg(Pointer proc, int cam, float[] out);
int tp_proc_exec_corr2d(Pointer proc, double fatZero);
/** de-pitch quad correlation; returns num_corr_combo. */
int tp_proc_get_corr2d_combo(Pointer proc, float[] out);
void tp_proc_destroy(Pointer proc);
/** Validate the persistent path: standard convert CLT vs golden (outCltErr) + no_kernels smoke (outNokernMax). */
/** Validate the persistent path: convert CLT (outCltErr), imclt RBG (outRbgErr), quad corr
* order-independent (outCorrErr), + no_kernels smoke (outNokernMax). */
int tp_proc_convert_selftest(Pointer module, int lwir, String data_root,
double[] outCltErr, double[] outNokernMax, int[] outNumActive);
double[] outCltErr, double[] outRbgErr, double[] outCorrErr,
double[] outNokernMax, int[] outNumActive);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment