Commit 7540202f authored by Andrey Filippov's avatar Andrey Filippov

CLAUDE: tp_proc_exec_imclt honors use_ref (gpu_clt_ref) — JNA ref render fix

execImcltRbgAll(ref_scene) was dropped on the JNA side: native imclt was
hardcoded to gpu_clt, so rendering the reference scene actually rendered the
scene. Add a use_ref arg -> select gpu_clt_ref. Needed so the reference-CLT
post-mortem render reflects the real buffer (CORR2D-all-NaN divergence: inter
correlation needs BOTH gpu_clt + gpu_clt_ref; gpu_clt proven good via SOURCE).
Updated the internal selftest caller to (p,1,0).
Co-Authored-By: 's avatarClaude Opus 4.8 (1M context) <noreply@anthropic.com>
parent 54f134b1
...@@ -762,14 +762,16 @@ int tp_proc_setup_rbg_corr(TpProc* p, int num_pairs, int s0,int s1,int s2,int s3 ...@@ -762,14 +762,16 @@ int tp_proc_setup_rbg_corr(TpProc* p, int num_pairs, int s0,int s1,int s2,int s3
return 0; return 0;
} }
// imclt_rbg_all: gpu_clt -> gpu_corr_images (RBG reconstruction) // imclt_rbg_all: gpu_clt (or gpu_clt_ref if use_ref) -> gpu_corr_images (RBG reconstruction).
int tp_proc_exec_imclt(TpProc* p, int apply_lpf){ // use_ref honors GpuQuad.execImcltRbgAll(ref_scene) so the reference scene can be rendered. By Claude 06/26/2026.
int tp_proc_exec_imclt(TpProc* p, int apply_lpf, int use_ref){
if(!p||!p->have_rbg){ seterr("exec_imclt: no rbg buffers (call setup_rbg_corr)"); return -1; } if(!p||!p->have_rbg){ seterr("exec_imclt: no rbg buffers (call setup_rbg_corr)"); return -1; }
cuCtxSetCurrent(p->mod->ctx); cuCtxSetCurrent(p->mod->ctx);
CUfunction f=getfun(p->mod,"imclt_rbg_all"); if(!f){ seterr("imclt_rbg_all missing"); return -2; } CUfunction f=getfun(p->mod,"imclt_rbg_all"); if(!f){ seterr("imclt_rbg_all missing"); return -2; }
int nc=p->num_cams, lpf=apply_lpf, ncol=p->num_colors, tw=p->tilesx, th=p->tilesy; int nc=p->num_cams, lpf=apply_lpf, ncol=p->num_colors, tw=p->tilesx, th=p->tilesy;
size_t rslt=p->dstride_rslt/sizeof(float); size_t rslt=p->dstride_rslt/sizeof(float);
void* a[]={ &nc,&p->gpu_clt,&p->gpu_corr_images,&lpf,&ncol,&tw,&th,&rslt }; float** clt = use_ref ? p->gpu_clt_ref : p->gpu_clt;
void* a[]={ &nc,&clt,&p->gpu_corr_images,&lpf,&ncol,&tw,&th,&rslt };
return launch1(f,1,1,1,1,1,1,a,"imclt_rbg_all")?-3:0; return launch1(f,1,1,1,1,1,1,a,"imclt_rbg_all")?-3:0;
} }
int tp_proc_get_rbg(TpProc* p, int cam, float* out){ if(!p||!p->have_rbg||cam<0||cam>=p->num_cams)return -1; cuCtxSetCurrent(p->mod->ctx); int tp_proc_get_rbg(TpProc* p, int cam, float* out){ if(!p||!p->have_rbg||cam<0||cam>=p->num_cams)return -1; cuCtxSetCurrent(p->mod->ctx);
...@@ -1019,7 +1021,7 @@ int tp_proc_convert_selftest(TpModule* m, int lwir, const char* data_root, ...@@ -1019,7 +1021,7 @@ int tp_proc_convert_selftest(TpModule* m, int lwir, const char* data_root,
// imclt -> RBG, compare to aux_chnN.rbg golden // imclt -> RBG, compare to aux_chnN.rbg golden
double rbg_err=-1; double rbg_err=-1;
if(tp_proc_exec_imclt(p, 1)==0){ if(tp_proc_exec_imclt(p, 1, 0)==0){
rbg_err=0; int rbg_size=p->rbg_w*p->rbg_h; std::vector<float> got(rbg_size), gold(rbg_size); rbg_err=0; int rbg_size=p->rbg_w*p->rbg_h; std::vector<float> got(rbg_size), gold(rbg_size);
for(int c=0;c<NC;c++){ readFloatsFromFile(gold.data(), PA.result_rbg_file[c]); tp_proc_get_rbg(p,c,got.data()); for(int c=0;c<NC;c++){ readFloatsFromFile(gold.data(), PA.result_rbg_file[c]); tp_proc_get_rbg(p,c,got.data());
for(int i=0;i<rbg_size;i++){ double e=std::fabs((double)got[i]-(double)gold[i]); if(e>rbg_err)rbg_err=e; } } for(int i=0;i<rbg_size;i++){ double e=std::fabs((double)got[i]-(double)gold[i]); if(e>rbg_err)rbg_err=e; } }
......
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