Commit 6d71636c authored by Andrey Filippov's avatar Andrey Filippov

CODEX: Save conditioning backend in CUAS parameters

Co-authored-by: 's avatarCodex <codex@elphel.com>
parent 1b9515bc
......@@ -76,6 +76,7 @@ public class CuasConditioning {
}
public static class Config {
public boolean gpu_enable = true; // use native two-map kernel when its strict linear/no-RowCol contract is satisfied; false = CPU oracle A/B // By Codex on 07/15/2026
public boolean rowcol_enable = true; // subtract per-row and per-col noise (runs AFTER photometric+FPN since 07/07/2026 - see condition())
public boolean rowcol_hpf = true; // high-pass the 1-D avg profile before subtracting - applies ONLY when rowcol_um_sigma==0 (the UM measurement already band-limits; stacking both under-removed mid-band lines x2, see subtractRowColSensor) // By Claude on 07/07/2026
public double rowcol_hpf_sigma = 8.0; // px; ~ the LoG scale (KR3-ish) - noise band the LoG would pass
......@@ -107,6 +108,7 @@ public class CuasConditioning {
*/
public static Config configFromCurt(com.elphel.imagej.tileprocessor.CuasRtParameters curt) { // By Claude on 07/07/2026
final Config cfg = new Config();
cfg.gpu_enable = curt.cond_gpu; // By Codex on 07/15/2026
cfg.rowcol_enable = curt.rowcol_en;
cfg.rowcol_hpf = curt.rowcol_hpf;
cfg.rowcol_hpf_sigma = curt.rowcol_hpf_sigma;
......@@ -131,7 +133,7 @@ public class CuasConditioning {
final double [] scales2,
final double [][][] fpn,
final Config cfg) {
if (!gpuQuad.supportsConditioningMaps() || cfg.rowcol_enable ||
if (!cfg.gpu_enable || !gpuQuad.supportsConditioningMaps() || cfg.rowcol_enable ||
com.elphel.imagej.gpu.testdata.PoseCorrExport.isArmed()) return false;
if (cfg.zero_dc && Double.isNaN(cfg.dc_level)) return false; // AUTO median stays in the CPU oracle
if (cfg.photometric && (scales2 != null)) for (double a : scales2) if (a != 0.0) return false;
......
......@@ -323,7 +323,7 @@ public class GpuQuadJna extends GpuQuad {
// separate from execution so it is paid once per calibration, never once
// per scene. By Codex on 07/15/2026.
@Override public boolean supportsConditioningMaps() {
return !rectilinear && !"cpu".equalsIgnoreCase(System.getProperty("tp.conditioning", "gpu"));
return !rectilinear;
}
@Override public boolean setConditioningMaps(float[] scale_maps, float[] offset_maps) {
if ((scale_maps == null) || (offset_maps == null) ||
......
......@@ -48,6 +48,7 @@ public class CuasRtParameters {
public double dc_center = 0.0; // DC level of the BORROWED center (CLT-RESTORED/average): subtracted from the center CLT at appropriation (CuasRT initialization) so it matches the zero-sky conditioned scenes (MCLT has no clean DC/AC split - a DC constant costs float32 accuracy). 0 = AUTO: reuse the PER-SEQUENCE value from <center>-RT-STATE.json; when absent, derive as the median of the top (sky) half of the reference buffer render and store it there (erase the file/field to re-derive - the missing-file rule). Nonzero = manual override; this config value is never mutated. Slow targets do not influence this shift. // By Claude on 07/05/2026
public double oob_soft = CuasTD.OOB_SOFT_DEFAULT; // 16-sensor TD consolidation, OOB source-margin priority (roadmap 2c, frozen spec Andrey 07/12/2026): SOFT margin, px - a sensor whose tile center is closer than this to its source-frame edge (in EITHER MB pass) is deprioritized (24x24 MCLT support overhangs the frame - defined-but-synthetic replicated rows): used only when NO sensor has the tile deeper. ~12. 0 = tier disabled. Consumed by the GPU consolidate_oob kernel (JNA backend) and the CPU oracle CuasTD.oobSensorMasks identically. // By Claude on 07/12/2026
public double oob_hard = CuasTD.OOB_HARD_DEFAULT; // OOB HARD margin, px - closer than this the 16x16 tile core itself overhangs the frame: the sensor is always skipped. All 16 below hard -> tile poisoned (NaN, v0 semantics - never a synthetic average). ~8. 0 = tier disabled; both margins 0 = v0-compatible unfiltered average (the A/B knob for judging whether coordinate-based filtering suffices). // By Claude on 07/12/2026
public boolean cond_gpu = true; // RT conditioning backend: GPU two-map scale/offset/FPN/common-DC when Row/Col is OFF; false = established double Java CPU oracle for A/B. Saved as curt_cond_gpu so backend choice belongs to run provenance, not JVM arguments. // By Codex on 07/15/2026
public boolean rowcol_en = true; // RT conditioning: subtract per-row/per-column line noise from each raw scene (CuasConditioning). OPTIONAL/bypassable: turn OFF when the FLIR internal row/col correction is verified sufficient (indoor camera test planned) - roadmap RT step 2a (Andrey 07/07/2026). // By Claude on 07/07/2026
public boolean rowcol_hpf = true; // RT conditioning: high-pass the 1-D row/col average profiles before subtracting (preserve low frequencies for the downstream LoG). // By Claude on 07/07/2026
public double rowcol_hpf_sigma = 8.0; // RT conditioning: Gaussian sigma (px) of the profile high-pass, ~ the LoG scale (the noise band the LoG would pass). // By Claude on 07/07/2026
......@@ -183,7 +184,9 @@ public class CuasRtParameters {
gd.addNumericField("OOB hard margin (core overhang)", this.oob_hard, 1,7,"pix", // By Claude on 07/12/2026
"Always skip a sensor whose tile center is closer than this to its source-frame edge (the 16x16 tile core itself overhangs). All 16 below -> tile poisoned (NaN), never a synthetic average. ~8. 0 = tier disabled; both margins 0 = v0 unfiltered (A/B knob).");
gd.addMessage("=== RT conditioning: Row/Col line noise ==="); // By Claude on 07/07/2026
gd.addMessage("=== RT conditioning: backend + Row/Col line noise ==="); // By Claude on 07/07/2026, backend Codex 07/15/2026
gd.addCheckbox ("Condition scale/offset/FPN on GPU", this.cond_gpu, // By Codex on 07/15/2026
"OFF = double Java CPU oracle for A/B; GPU requires Row/Col OFF and fixed sequence DC");
gd.addCheckbox ("Subtract row/col noise (RT conditioning)", this.rowcol_en, // By Claude on 07/07/2026
"Subtract per-row/per-column line noise from each raw scene during RT conditioning (CuasConditioning). Turn OFF to bypass when the FLIR internal row/column correction is verified sufficient.");
gd.addCheckbox ("Row/col high-pass profiles", this.rowcol_hpf, // By Claude on 07/07/2026
......@@ -354,6 +357,7 @@ public class CuasRtParameters {
this.oob_soft = gd.getNextNumber(); // By Claude on 07/12/2026
this.oob_hard = gd.getNextNumber(); // By Claude on 07/12/2026
this.cond_gpu = gd.getNextBoolean(); // By Codex on 07/15/2026
this.rowcol_en = gd.getNextBoolean(); // By Claude on 07/07/2026
this.rowcol_hpf = gd.getNextBoolean(); // By Claude on 07/07/2026
this.rowcol_hpf_sigma = gd.getNextNumber(); // By Claude on 07/07/2026
......@@ -460,6 +464,7 @@ public class CuasRtParameters {
properties.setProperty(prefix+"oob_soft", this.oob_soft+""); // double // By Claude on 07/12/2026
properties.setProperty(prefix+"oob_hard", this.oob_hard+""); // double // By Claude on 07/12/2026
properties.setProperty(prefix+"cond_gpu", this.cond_gpu+""); // boolean // By Codex on 07/15/2026
properties.setProperty(prefix+"rowcol_en", this.rowcol_en+""); // boolean // By Claude on 07/07/2026
properties.setProperty(prefix+"rowcol_hpf", this.rowcol_hpf+""); // boolean // By Claude on 07/07/2026
properties.setProperty(prefix+"rowcol_hpf_sigma",this.rowcol_hpf_sigma+"");// double // By Claude on 07/07/2026
......@@ -566,6 +571,7 @@ public class CuasRtParameters {
if (properties.getProperty(prefix+"oob_soft")!=null) this.oob_soft=Double.parseDouble(properties.getProperty(prefix+"oob_soft")); // By Claude on 07/12/2026
if (properties.getProperty(prefix+"oob_hard")!=null) this.oob_hard=Double.parseDouble(properties.getProperty(prefix+"oob_hard")); // By Claude on 07/12/2026
if (properties.getProperty(prefix+"cond_gpu")!=null) this.cond_gpu=Boolean.parseBoolean(properties.getProperty(prefix+"cond_gpu")); // By Codex on 07/15/2026
if (properties.getProperty(prefix+"rowcol_en")!=null) this.rowcol_en=Boolean.parseBoolean(properties.getProperty(prefix+"rowcol_en")); // By Claude on 07/07/2026
if (properties.getProperty(prefix+"rowcol_hpf")!=null) this.rowcol_hpf=Boolean.parseBoolean(properties.getProperty(prefix+"rowcol_hpf")); // By Claude on 07/07/2026
if (properties.getProperty(prefix+"rowcol_hpf_sigma")!=null)this.rowcol_hpf_sigma=Double.parseDouble(properties.getProperty(prefix+"rowcol_hpf_sigma"));// By Claude on 07/07/2026
......@@ -674,6 +680,7 @@ public class CuasRtParameters {
cp.dc_center = this.dc_center; // By Claude on 07/05/2026
cp.oob_soft = this.oob_soft; // By Claude on 07/12/2026
cp.oob_hard = this.oob_hard; // By Claude on 07/12/2026
cp.cond_gpu = this.cond_gpu; // By Codex on 07/15/2026
cp.rowcol_en = this.rowcol_en; // By Claude on 07/07/2026
cp.rowcol_hpf = this.rowcol_hpf; // By Claude on 07/07/2026
cp.rowcol_hpf_sigma = this.rowcol_hpf_sigma; // By Claude on 07/07/2026
......
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