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

caught up with branch dct

parents b7a74a73 24fb19fa
......@@ -1144,6 +1144,405 @@ public class DttRad2 {
return y;
}
// ======================= preparing for GPU code, replacing *_recurs ===========================
// tested
public double [] dttt_ivn(double [] x, int mode, int n, boolean gpu){ // mode 0 - dct,dct 1:dst,dct, 2: dct, dst, 3: dst,dst
double [] y = new double [n*n];
double [] line = new double[n];
// first (horizontal) pass
for (int i = 0; i<n; i++){
System.arraycopy(x, n*i, line, 0, n);
line = ((mode & 1)!=0)? dst_ivn(line, gpu):dct_ivn(line, gpu);
for (int j=0; j < n;j++) y[j*n+i] =line[j]; // transpose
}
// second (vertical) pass
for (int i = 0; i<n; i++){
System.arraycopy(y, n*i, line, 0, n);
line = ((mode & 2)!=0)? dst_ivn(line, gpu):dct_ivn(line, gpu);
System.arraycopy(line, 0, y, n*i, n);
}
return y;
}
public double [] dct_iin(double[] x, boolean gpu){
if (x.length > N){
N = x.length;
}
double [] y;
if (gpu) {
y= new double[8];
_dctii_nrecurs8(x,y);
} else {
y= _dctii_nrecurs8(x);
}
double scale = 1.0/Math.sqrt(x.length);
for (int i = 0; i < y.length ; i++) y[i] *= scale;
return y;
}
public double [] dct_ivn(double[] x, boolean gpu){
double [] y;
if (gpu) {
y= new double[8];
_dctiv_nrecurs8(x,y);
} else {
y= _dctiv_nrecurs8(x);
}
double scale = 1.0/Math.sqrt(x.length);
for (int i = 0; i < y.length ; i++) y[i] *= scale;
return y;
}
public double [] dst_ivn(double[] x, boolean gpu){
double [] xr= new double[x.length];
int j= x.length-1;
for (int i=0; i < x.length;i++) xr[i] = x[j--];
double [] y;
if (gpu) {
y= new double[8];
_dctiv_nrecurs8(xr,y);
} else {
y= _dctiv_nrecurs8(xr);
}
double scale = 1.0/Math.sqrt(x.length);
for (int i = 0; i < y.length ; i++) {
y[i] *= scale;
scale = -scale;
}
return y;
}
private double [] _dctii_nrecurs2(double[] x){
double [] y= {x[0]+x[1],x[0]-x[1]};
System.out.println(String.format("_dctii_nrecurs2: x={%8f,%8f}",x[0],x[1]));
System.out.println(String.format("_dctii_nrecurs2: y={%8f,%8f}",y[0],y[1]));
return y;
}
private double [] _dctii_nrecurs4(double[] x){
double [] u0 = new double [2];
double [] u1 = new double [2];
for (int j = 0; j < 2; j++){
u0[j]= (x[j] + x[3-j]);
u1[j]= (x[j] - x[3-j]);
}
double [] v0 = _dctii_nrecurs2(u0);
double [] v1 = _dctiv_nrecurs2(u1);
double [] y = new double[4];
for (int j = 0; j< 2; j++){
y[2*j] = v0[j];
y[2*j+1] = v1[j];
}
System.out.println(String.format("_dctii_nrecurs4: x={%8f,%8f,%8f,%8f}",x[0],x[1],x[2],x[3]));
System.out.println(String.format("_dctii_nrecurs4: u0={%8f,%8f}, u1={%8f,%8f}",u0[0],u0[1],u1[0],u1[1]));
System.out.println(String.format("_dctii_nrecurs4: v0={%8f,%8f}, v1={%8f,%8f}",v0[0],v0[1],v1[0],v1[1]));
System.out.println(String.format("_dctii_nrecurs4: y={%8f,%8f,%8f,%8f}",y[0],y[1],y[2],y[3]));
return y;
}
private double [] _dctii_nrecurs8(double[] x){
// int n = x.length; // = 8
// int n1 = n >> 1; // 4
double [] u0 = new double [4];
double [] u1 = new double [4];
for (int j = 0; j< 4; j++){
u0[j]= (x[j] + x[7-j]);
u1[j]= (x[j] - x[7-j]);
}
double [] v0 = _dctii_nrecurs4(u0);
double [] v1 = _dctiv_nrecurs4(u1);
double [] y = new double[8];
for (int j = 0; j< 4; j++){
y[2*j] = v0[j];
y[2*j+1] = v1[j];
}
System.out.println(String.format("_dctii_nrecurs8: x={%8f,%8f,%8f,%8f,%8f,%8f,%8f,%8f}",x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7]));
System.out.println(String.format("_dctii_nrecurs8: u0={%8f,%8f,%8f,%8f}, u1={%8f,%8f,%8f,%8f}",u0[0],u0[1],u0[2],u0[3],u1[0],u1[1],u1[2],u1[3]));
System.out.println(String.format("_dctii_nrecurs8: v0={%8f,%8f,%8f,%8f}, v1={%8f,%8f,%8f,%8f}",v0[0],v0[1],v0[2],v0[3],v1[0],v1[1],v1[2],v1[3]));
System.out.println(String.format("_dctii_nrecurs8: y={%8f,%8f,%8f,%8f,%8f,%8f,%8f,%8f}",y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7]));
return y;
}
private double [] _dctiv_nrecurs2(double[] x){
// int n = x.length; == 2
double [] y= {COSPI_1_8_SQRT2*x[0] + COSPI_3_8_SQRT2*x[1],
COSPI_3_8_SQRT2*x[0] - COSPI_1_8_SQRT2*x[1]};
System.out.println(String.format("_dctiv_nrecurs2: x={%8f,%8f}",x[0],x[1]));
System.out.println(String.format("_dctiv_nrecurs2: y={%8f,%8f}",y[0],y[1]));
return y;
}
private double [] _dctiv_nrecurs4(double[] x){
double [] u0 = new double [2];
double [] u1 = new double [2];
for (int j = 0; j< 2; j++){
u0[j]= ( CN1[0][j] * x[j] + SN1[0][j] * x[3 - j]);
u1[j]= ( 1 - 2*(j & 1))*(-SN1[0][1-j] * x[1-j] + CN1[0][1-j] * x[2 + j]);
}
double [] v0 = _dctii_nrecurs2(u0);
double [] v1 = _dctii_nrecurs2(u1); //both cos-II
double [] w0 = new double [2];
double [] w1 = new double [2];
w0[0] = sqrt2 * v0[0];
w1[1] = sqrt2 * v1[0];
for (int j = 0; j< 2; j++){
int sgn = (1 - 2* (j & 1));
if (j > 0) w0[j] = v0[j] - sgn * v1[2 - j];
if (j < (1)) w1[j] = v0[j+1] - sgn * v1[2 - j -1];
}
double [] y = new double[4];
for (int j = 0; j< 2; j++){
y[2*j] = w0[j];
y[2*j+1] = w1[j];
}
System.out.println(String.format("_dctiv_nrecurs4: x={%8f,%8f,%8f,%8f}",x[0],x[1],x[2],x[3]));
System.out.println(String.format("_dctiv_nrecurs4: u0={%8f,%8f}, u1={%8f,%8f}",u0[0],u0[1],u1[0],u1[1]));
System.out.println(String.format("_dctiv_nrecurs4: v0={%8f,%8f}, v1={%8f,%8f}",v0[0],v0[1],v1[0],v1[1]));
System.out.println(String.format("_dctiv_nrecurs4: w0={%8f,%8f}, w1={%8f,%8f}",w0[0],w0[1],w1[0],w1[1]));
System.out.println(String.format("_dctiv_nrecurs4: y={%8f,%8f,%8f,%8f}",y[0],y[1],y[2],y[3]));
return y;
}
private double [] _dctiv_nrecurs8(double[] x){
double [] u0 = new double [4];
double [] u1 = new double [4];
for (int j = 0; j< 4; j++){
u0[j]= ( CN1[1][j] * x[j] + SN1[1][j] * x[7 - j]);
u1[j]= ( 1 - 2*(j & 1))*(-SN1[1][3-j] * x[3 - j] + CN1[1][3 - j] * x[4 + j]);
}
double [] v0 = _dctii_nrecurs4(u0);
double [] v1 = _dctii_nrecurs4(u1); //both cos-II
double [] w0 = new double [4];
double [] w1 = new double [4];
w0[0] = sqrt2 * v0[0];
w1[3] = sqrt2 * v1[0];
for (int j = 0; j< 4; j++){
int sgn = (1 - 2* (j & 1)); //TODO: optimize it out
if (j > 0) w0[j] = v0[j] - sgn * v1[4 - j];
if (j < 3) w1[j] = v0[j+1] - sgn * v1[3 - j];
}
double [] y = new double[8];
for (int j = 0; j< 4; j++){
y[2*j] = w0[j];
y[2*j+1] = w1[j];
}
System.out.println(String.format("_dctiv_nrecurs8: x={%8f,%8f,%8f,%8f,%8f,%8f,%8f,%8f}",x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7]));
System.out.println(String.format("_dctiv_nrecurs8: u0={%8f,%8f,%8f,%8f}, u1={%8f,%8f,%8f,%8f}",u0[0],u0[1],u0[2],u0[3],u1[0],u1[1],u1[2],u1[3]));
System.out.println(String.format("_dctiv_nrecurs8: v0={%8f,%8f,%8f,%8f}, v1={%8f,%8f,%8f,%8f}",v0[0],v0[1],v0[2],v0[3],v1[0],v1[1],v1[2],v1[3]));
System.out.println(String.format("_dctiv_nrecurs8: w0={%8f,%8f,%8f,%8f}, w1={%8f,%8f,%8f,%8f}",w0[0],w0[1],w0[2],w0[3],w1[0],w1[1],w1[2],w1[3]));
System.out.println(String.format("_dctiv_nrecurs8: y={%8f,%8f,%8f,%8f,%8f,%8f,%8f,%8f}",y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7]));
return y;
}
// ++++++++++++++++++++++++++++ More comparison with GPU ++++++++++++++++++++++++++++++++++
//
// double COSPI_1_8_SQRT2 = 1.306563;
// double COSPI_3_8_SQRT2 = 0.541196;
double SQRT_2 = 1.414214;
double SQRT1_2 = 0.707107;
double SQRT1_8 = 0.353553;
double [] COSN1 = {0.980785,0.831470};
double [] COSN2 = {0.995185,0.956940,0.881921,0.773010};
double [] SINN1 = {0.195090,0.555570};
double [] SINN2 = {0.098017,0.290285,0.471397,0.634393};
void _dctii_nrecurs8( double [] x, double [] y) // x,y point to 8-element arrays each
{
double u00= (x[0] + x[7]);
double u10= (x[0] - x[7]);
double u01= (x[1] + x[6]);
double u11= (x[1] - x[6]);
double u02= (x[2] + x[5]);
double u12= (x[2] - x[5]);
double u03= (x[3] + x[4]);
double u13= (x[3] - x[4]);
// double v00, v01, v02, v03, v10, v11, v12, v13;
// _dctii_nrecurs4(u00, u01, u02, u03, &v00, &v01, &v02, &v03);
double w00= u00 + u03;
double w10= u00 - u03;
double w01= (u01 + u02);
double w11= (u01 - u02);
double v00= w00 + w01;
double v02= w00 - w01;
double v01= COSPI_1_8_SQRT2 * w10 + COSPI_3_8_SQRT2 * w11;
double v03= COSPI_3_8_SQRT2 * w10 - COSPI_1_8_SQRT2 * w11;
// _dctiv_nrecurs4(u10, u11, u12, u13, &v10, &v11, &v12, &v13);
/*
double [] u0 = new double [2];
double [] u1 = new double [2];
for (int j = 0; j< 2; j++){
u0[j]= ( CN1[0][j] * x[j] + SN1[0][j] * x[3 - j]);
u1[j]= ( 1 - 2*(j & 1))*(-SN1[0][1-j] * x[1-j] + CN1[0][1-j] * x[2 + j]);
}
double [] v0 = _dctii_nrecurs2(u0);
double [] v1 = _dctii_nrecurs2(u1); //both cos-II
double [] w0 = new double [2];
double [] w1 = new double [2];
w0[0] = sqrt2 * v0[0];
w1[1] = sqrt2 * v1[0];
for (int j = 0; j< 2; j++){
int sgn = (1 - 2* (j & 1));
if (j > 0) w0[j] = v0[j] - sgn * v1[2 - j];
if (j < (1)) w1[j] = v0[j+1] - sgn * v1[2 - j -1];
}
double [] y = new double[4];
for (int j = 0; j< 2; j++){
y[2*j] = w0[j];
y[2*j+1] = w1[j];
}
*/
double w20= ( COSN1[0] * u10 + SINN1[0] * u13);
double w30= (-SINN1[1] * u11 + COSN1[1] * u12);
double w21= ( COSN1[1] * u11 + SINN1[1] * u12);
double w31= -(-SINN1[0] * u10 + COSN1[0] * u13);
//u->t, v ->z, t0->w2, t1->w3
// double z00, z01, z10,z11;
// TODO: change w20<->w02
// _dctii_nrecurs2(u00, u01, &v00, &v01);
double z00= w20 + w21;
double z01= w20 - w21;
// _dctii_nrecurs2(u10, u11, &v10, &v11);
double z10= w30 + w31;
double z11= w30 - w31;
double v10 = SQRT_2 * z00;
double v11 = z01 - z11;
double v12 = z01 + z11;
double v13 = SQRT_2 * z10;
y[0] = v00;
y[1] = v10;
y[2] = v01;
y[3] = v11;
y[4] = v02;
y[5] = v12;
y[6] = v03;
y[7] = v13;
System.out.println(String.format("_dctii_nrecurs8-gpu: x={%8f,%8f,%8f,%8f,%8f,%8f,%8f,%8f}",x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7]));
System.out.println(String.format("_dctii_nrecurs8-gpu: u0={%8f,%8f,%8f,%8f}, u1={%8f,%8f,%8f,%8f}",u00,u01,u02,u03,u10,u11,u12,u13));
System.out.println(String.format("_dctii_nrecurs8-gpu: v0={%8f,%8f,%8f,%8f}, v1={%8f,%8f,%8f,%8f}",v00,v01,v02,v03,v10,v11,v12,v13));
System.out.println(String.format("_dctii_nrecurs8-gpu: w0={%8f,%8f,%8f,%8f}, w1={%8f,%8f,%8f,%8f}",w00,w10,w20,w30,w01,w11,w21,w31));
System.out.println(String.format("_dctii_nrecurs8-gpu: y={%8f,%8f,%8f,%8f,%8f,%8f,%8f,%8f}",y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7]));
}
void _dctiv_nrecurs8( double [] x, double [] y) // x,y point to 8-element arrays each
{
double u00= ( COSN2[0] * x[0] + SINN2[0] * x[7]);
double u10= (-SINN2[3] * x[3] + COSN2[3] * x[4]);
double u01= ( COSN2[1] * x[1] + SINN2[1] * x[6]);
double u11= -(-SINN2[2] * x[2] + COSN2[2] * x[5]);
double u02= ( COSN2[2] * x[2] + SINN2[2] * x[5]);
double u12= (-SINN2[1] * x[1] + COSN2[1] * x[6]);
double u03= ( COSN2[3] * x[3] + SINN2[3] * x[4]);
double u13= -(-SINN2[0] * x[0] + COSN2[0] * x[7]);
// _dctii_nrecurs4(u00, u01, u02, u03, &v00, &v01, &v02, &v03); // ua - u inside first _dctii_nrecurs4, ub - inside second
double ua00= u00 + u03;
double ua10= u00 - u03;
double ua01= u01 + u02;
double ua11= u01 - u02;
double v00= ua00 + ua01;
double v02= ua00 - ua01;
double v01= COSPI_1_8_SQRT2 * ua10 + COSPI_3_8_SQRT2 * ua11;
double v03= COSPI_3_8_SQRT2 * ua10 - COSPI_1_8_SQRT2 * ua11;
// _dctii_nrecurs4(u10, u11, u12, u13, &v10, &v11, &v12, &v13);
System.out.println(String.format("_dctiv_nrecurs8-gpu (_dctii_nrecurs4(x): x={%8f,%8f,%8f,%8f}",u10, u11, u12, u13));
double ub00= u10 + u13;
double ub10= u10 - u13;
double ub01= u11 + u12;
double ub11= u11 - u12;
System.out.println(String.format("_dctiv_nrecurs8-gpu: ub0={%8f,%8f}, ub1={%8f,%8f}",ub00,ub01,ub10,ub11));
double vb00= ub00 + ub01;
double vb01= ub00 - ub01;
double vb10= COSPI_1_8_SQRT2*ub10 + COSPI_3_8_SQRT2*ub11;
double vb11= COSPI_3_8_SQRT2*ub10 - COSPI_1_8_SQRT2*ub11;
System.out.println(String.format("_dctiv_nrecurs8-gpu: vb0={%8f,%8f}, vb1={%8f,%8f}",vb00,vb01,vb10,vb11));
double v10 = vb00;
double v11 = vb10;
double v12 = vb01;
double v13 = vb11;
System.out.println(String.format("_dctiv_nrecurs8-gpu: yb={%8f,%8f,%8f,%8f}",vb00, vb10, vb01, vb11));
// j == 0
y[0] = SQRT_2 * v00; // w0[0];
y[1] = v01 - v13; // w1[0];
// j == 1
y[2] = v01 + v13; // w0[1];
y[3] = v02 + v12; // w1[1];
// j == 2
y[4] = v02 - v12; // w0[2];
y[5] = v03 - v11; // w1[2]; - same as y[3]
// j == 3
y[6] = v03 + v11; // w0[3];
y[7] = SQRT_2 * v10; // w1[3];
System.out.println(String.format("_dctiv_nrecurs8-gpu: x={%8f,%8f,%8f,%8f,%8f,%8f,%8f,%8f}",x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7]));
System.out.println(String.format("_dctiv_nrecurs8-gpu: u0={%8f,%8f,%8f,%8f}, u1={%8f,%8f,%8f,%8f}",u00,u01,u02,u03,u10,u11,u12,u13));
System.out.println(String.format("_dctiv_nrecurs8-gpu: v0={%8f,%8f,%8f,%8f}, v1={%8f,%8f,%8f,%8f}",v00,v01,v02,v03,v10,v11,v12,v13));
// System.out.println(String.format("_dctiv_nrecurs8-gpu: w0={%8f,%8f,%8f,%8f}, w1={%8f,%8f,%8f,%8f}",w00,w10,w20,w30,w01,w11,w21,w31));
System.out.println(String.format("_dctiv_nrecurs8-gpu: y={%8f,%8f,%8f,%8f,%8f,%8f,%8f,%8f}",y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7]));
}
}
......@@ -5,7 +5,7 @@
** Parameter classes for aberration correction for Eyesis4pi
**
**
** Copyright (C) 2012 Elphel, Inc.
** Copyright (C) 2012-2018 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
......
......@@ -111,6 +111,9 @@ public class EyesisCorrections {
if ((this.debugLevel>101) && (correctionsParameters.sourcePaths!=null) && (correctionsParameters.sourcePaths.length>0)) {
testFF(correctionsParameters.sourcePaths[0]);
}
if (debugLevel > -2) {
System.out.println();
}
}
public void initSensorFilesAux(int debugLevel){
......
......@@ -2684,7 +2684,22 @@ public class ImageDtt {
}
// IDCT-IV should be in reversed order: CC->CC, SC->CS, CS->SC, SS->SS
int idct_mode = ((dct_mode << 1) & 2) | ((dct_mode >> 1) & 1);
clt_tile = dtt.dttt_iv (clt_tile, idct_mode, transform_size);
if ((globalDebugLevel > 0) && debugTile) {
double [] clt_tile_dbg = clt_tile.clone();
double [] clt_tile_dbg1 = clt_tile.clone();
clt_tile_dbg = dtt.dttt_ivn (clt_tile_dbg, idct_mode, transform_size, false);
clt_tile_dbg1 = dtt.dttt_ivn (clt_tile_dbg1, idct_mode, transform_size, true);
clt_tile = dtt.dttt_iv (clt_tile, idct_mode, transform_size);
System.out.println("\n-------- tileX="+tileX+", tileY="+tileY+", idct_mode="+idct_mode+" ---#, standard, good, bad, diff---");
for (int nt = 0; nt < clt_tile_dbg.length; nt++) {
System.out.println(String.format("%2d: %8f %8f %8f %8f %8f",
clt_tile[nt],clt_tile_dbg[nt],clt_tile_dbg1[nt],clt_tile_dbg[nt] - clt_tile_dbg[nt],clt_tile_dbg1[nt] - clt_tile_dbg[nt]));
}
} else {
clt_tile = dtt.dttt_iv (clt_tile, idct_mode, transform_size);
}
// iclt_tile[i][chn] = dtt.dttt_iv (clt_data[i][chn][tileY][tileX][dct_mode], idct_mode, transform_size);
double [] tile_mdct = dtt.unfold_tile(clt_tile, transform_size, dct_mode); // mode=0 - DCCT 16x16
// accumulate partial mdct results
......@@ -4989,7 +5004,25 @@ public class ImageDtt {
} else {
clt_tile[dct_mode] = dtt.fold_tile (tile_in, transform_size, dct_mode); // DCCT, DSCT, DCST, DSST
}
clt_tile[dct_mode] = dtt.dttt_iv (clt_tile[dct_mode], dct_mode, transform_size);
// clt_tile[dct_mode] = dtt.dttt_iv (clt_tile[dct_mode], dct_mode, transform_size);
if (bdebug) {
double [] clt_tile_dbg = clt_tile[dct_mode].clone();
double [] clt_tile_dbg1 = clt_tile[dct_mode].clone();
clt_tile_dbg1 = dtt.dttt_ivn (clt_tile_dbg1, dct_mode, transform_size,true);
clt_tile_dbg = dtt.dttt_ivn (clt_tile_dbg, dct_mode, transform_size,false);
clt_tile[dct_mode] = dtt.dttt_iv (clt_tile[dct_mode], dct_mode, transform_size);
System.out.println("\n-------- 2: dct_mode="+dct_mode+" ---#, standard, good, bad, diff---");
for (int nt = 0; nt < clt_tile_dbg.length; nt++) {
System.out.println(String.format("%2d: %8f %8f %8f %8f %8f",
nt, clt_tile[dct_mode][nt],clt_tile_dbg[nt], clt_tile_dbg1[nt],clt_tile_dbg[nt] - clt_tile_dbg[nt], clt_tile_dbg1[nt] - clt_tile_dbg[nt]));
}
System.out.println("done debug");
} else {
clt_tile[dct_mode] = dtt.dttt_iv (clt_tile[dct_mode], dct_mode, transform_size);
}
}
}
......@@ -7887,7 +7920,7 @@ public class ImageDtt {
chn,
centersXY_main[i][0], // centerX, // center of aberration-corrected (common model) tile, X
centersXY_main[i][1], // centerY, //
0, // external tile compare
(globalDebugLevel > -2) && (tileX == debug_tileX) && (tileY == debug_tileY)? 2:0, // external tile compare
false,// no_deconvolution,
false, // ); // transpose);
((saturation_main != null) ? saturation_main[i] : null), //final boolean [][] saturation_imp, // (near) saturated pixels or null
......
......@@ -94,7 +94,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
public String camera_jp46settings = "";
public boolean IS_SILENT=true;
public boolean ABSOLUTELY_SILENT=false;
public boolean demux=true;
public boolean demux=true;
public String imageTitle="cameraImage";
private int ExifOffset=0x0c;
......@@ -150,6 +150,9 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
pack();
GUI.center(this);
setVisible(showGUI);
if (!showGUI) {
this.ABSOLUTELY_SILENT = true;
}
}
void addButton(String label, Panel panel) {
......@@ -648,14 +651,14 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
min_gain=2.0*gains[0];
for (i=0;i<4;i++) {
if (min_gain > gains[i]*(1.0-blacks[i])) min_gain = gains[i]*(1.0-blacks[i]);
System.out.println("gains["+i+"]="+gains[i]+" min_gain="+min_gain);
if (!this.ABSOLUTELY_SILENT) System.out.println("gains["+i+"]="+gains[i]+" min_gain="+min_gain);
}
imp.setProperty("GAIN",String.format("%f",min_gain)); // common gain
for (i=0;i<4;i++) gains[i]/=min_gain;
for (i=0;i<4;i++) blacks256[i]=256.0*blacks[i];
for (i=0;i<4;i++) {
System.out.println("scaled gains["+i+"]="+gains[i]);
if (!this.ABSOLUTELY_SILENT) System.out.println("scaled gains["+i+"]="+gains[i]);
}
......@@ -665,7 +668,7 @@ public class JP46_Reader_camera extends PlugInFrame implements ActionListener {
else satValue[i]=((rgammas[i][255])-blacks256[i]);
} else satValue[i]=255.0;
imp.setProperty("saturation_"+i,String.format("%f",satValue[i]));
System.out.println("scaled gains["+i+"]="+gains[i]+" satValue["+i+"]="+satValue[i]);
if (!this.ABSOLUTELY_SILENT) System.out.println("scaled gains["+i+"]="+gains[i]+" satValue["+i+"]="+satValue[i]);
}
// swap satValue to match FLIPH,FLIPV again
......
......@@ -157,7 +157,12 @@ public class PixelMapping {
if (subCamera < 0) {
return null;
}
System.out.println("channelsForSubCamera("+subCamera+"),this.sensors.length="+this.sensors.length);
if (this.debugLevel>1) {
System.out.print("channelsForSubCamera("+subCamera+"),this.sensors.length="+this.sensors.length+": ");
// } else if (this.debugLevel > -2) {
// System.out.print(".");
}
// ArrayList<ArrayList<ArrayList<Integer>>> camera_IPs = new ArrayList<ArrayList<ArrayList<Integer>>>();
ArrayList<Point> cam_port = new ArrayList<Point>();
for (int i=0;i<this.sensors.length;i++) if (this.sensors[i]!=null) {
......@@ -176,10 +181,16 @@ public class PixelMapping {
});
// debugging:
if (subCamera >= cam_port_arr.length) {
System.out.println("Error: Subcamera "+subCamera+" > that total number of sensor ports in the system = "+cam_port_arr.length);
if (this.debugLevel>1) {
System.out.println("Error: Subcamera "+subCamera+" > that total number of sensor ports in the system = "+cam_port_arr.length);
}
return null;
}
System.out.println("----- This filename subcamera "+subCamera+": physical camera "+cam_port_arr[subCamera].x+", sensor_port "+cam_port_arr[subCamera].y);
if (this.debugLevel>1) {
System.out.println("----- This filename subcamera "+subCamera+": physical camera "+cam_port_arr[subCamera].x+", sensor_port "+cam_port_arr[subCamera].y);
} else if (this.debugLevel > -2) {
System.out.print(".");
}
if (this.sensors == null) return null;
int numChannels=0;
for (int i=0;i<this.sensors.length;i++) if (this.sensors[i]!=null) {
......
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