Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
57fb1ef9
Commit
57fb1ef9
authored
Nov 19, 2022
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating textures together with GPU code
parent
7ccf095c
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
662 additions
and
388 deletions
+662
-388
GPUTileProcessor.java
src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java
+6
-3
GpuQuad.java
src/main/java/com/elphel/imagej/gpu/GpuQuad.java
+3
-65
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+2
-2
TexturedModel.java
...n/java/com/elphel/imagej/tileprocessor/TexturedModel.java
+650
-317
TileNeibs.java
src/main/java/com/elphel/imagej/tileprocessor/TileNeibs.java
+1
-1
No files found.
src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java
View file @
57fb1ef9
...
@@ -134,17 +134,19 @@ public class GPUTileProcessor {
...
@@ -134,17 +134,19 @@ public class GPUTileProcessor {
// static int TPTASK_SIZE = 1+ 1+ NUM_CAMS * 2 + 1 + NUM_CAMS * 4 ; // tp_task structure size in floats
// static int TPTASK_SIZE = 1+ 1+ NUM_CAMS * 2 + 1 + NUM_CAMS * 4 ; // tp_task structure size in floats
static
int
CLTEXTRA_SIZE
=
8
;
static
int
CLTEXTRA_SIZE
=
8
;
static
int
CORR_SIZE
=
(
2
*
DTT_SIZE
-
1
)
*
(
2
*
DTT_SIZE
-
1
);
// 15x15
static
int
CORR_SIZE
=
(
2
*
DTT_SIZE
-
1
)
*
(
2
*
DTT_SIZE
-
1
);
// 15x15
public
static
int
CORR_NTILE_SHIFT
=
8
;
// also for texture tiles list
public
static
int
CORR_NTILE_SHIFT
=
8
;
// also for texture tiles list
- not anymore 11/18/2022
// FIXME: CORR_PAIRS_MASK will not work !!!
// FIXME: CORR_PAIRS_MASK will not work !!!
public
static
int
CORR_PAIRS_MASK
=
0x3f
;
// lower bits used to address correlation pair for the selected tile
public
static
int
CORR_PAIRS_MASK
=
0x3f
;
// lower bits used to address correlation pair for the selected tile
public
static
int
CORR_TEXTURE_BIT
=
7
;
// bit 7 used to request texture for the tile
// public static int CORR_TEXTURE_BIT = 7; // bit 7 used to request texture for the tile GET RID !!!
public
static
int
TASK_CORR_BITS
=
4
;
// start of pair mask
public
static
int
TASK_CORR_BITS
=
4
;
// start of pair mask
public
static
int
TASK_TEXTURE_N_BIT
=
0
;
// Texture with North neighbor
public
static
int
TASK_TEXTURE_N_BIT
=
0
;
// Texture with North neighbor
public
static
int
TASK_TEXTURE_E_BIT
=
1
;
// Texture with East neighbor
public
static
int
TASK_TEXTURE_E_BIT
=
1
;
// Texture with East neighbor
public
static
int
TASK_TEXTURE_S_BIT
=
2
;
// Texture with South neighbor
public
static
int
TASK_TEXTURE_S_BIT
=
2
;
// Texture with South neighbor
public
static
int
TASK_TEXTURE_W_BIT
=
3
;
// Texture with West neighbor
public
static
int
TASK_TEXTURE_W_BIT
=
3
;
// Texture with West neighbor
// public static int TASK_TEXTURE_BIT = 3; // bit to request texture calculation int task field of struct tp_task
// public static int TASK_TEXTURE_BIT = 3; // bit to request texture calculation int task field of struct tp_task
public
static
int
LIST_TEXTURE_BIT
=
7
;
// bit to request texture calculation
public
static
int
LIST_TEXTURE_BIT
=
7
;
// bit to request texture calculation
public
static
int
TEXT_NTILE_SHIFT
=
8
;
// split from CORR_NTILE_SHIFT
// public static int CORR_OUT_RAD = 4; // output radius of the correlations (implemented)
// public static int CORR_OUT_RAD = 4; // output radius of the correlations (implemented)
public
static
double
FAT_ZERO_WEIGHT
=
0.0001
;
// add to port weights to avoid nan
public
static
double
FAT_ZERO_WEIGHT
=
0.0001
;
// add to port weights to avoid nan
...
@@ -226,13 +228,14 @@ public class GPUTileProcessor {
...
@@ -226,13 +228,14 @@ public class GPUTileProcessor {
"#define IMCLT_TILES_PER_BLOCK "
+
IMCLT_TILES_PER_BLOCK
+
"\n"
+
"#define IMCLT_TILES_PER_BLOCK "
+
IMCLT_TILES_PER_BLOCK
+
"\n"
+
"#define CORR_NTILE_SHIFT "
+
CORR_NTILE_SHIFT
+
"\n"
+
"#define CORR_NTILE_SHIFT "
+
CORR_NTILE_SHIFT
+
"\n"
+
// "#define CORR_PAIRS_MASK " + CORR_PAIRS_MASK+"\n"+
// "#define CORR_PAIRS_MASK " + CORR_PAIRS_MASK+"\n"+
"#define CORR_TEXTURE_BIT "
+
CORR_TEXTURE_BIT
+
"\n"
+
//
"#define CORR_TEXTURE_BIT " + CORR_TEXTURE_BIT+"\n"+
"#define TASK_CORR_BITS "
+
TASK_CORR_BITS
+
"\n"
+
"#define TASK_CORR_BITS "
+
TASK_CORR_BITS
+
"\n"
+
"#define TASK_TEXTURE_N_BIT "
+
TASK_TEXTURE_N_BIT
+
"\n"
+
"#define TASK_TEXTURE_N_BIT "
+
TASK_TEXTURE_N_BIT
+
"\n"
+
"#define TASK_TEXTURE_E_BIT "
+
TASK_TEXTURE_E_BIT
+
"\n"
+
"#define TASK_TEXTURE_E_BIT "
+
TASK_TEXTURE_E_BIT
+
"\n"
+
"#define TASK_TEXTURE_S_BIT "
+
TASK_TEXTURE_S_BIT
+
"\n"
+
"#define TASK_TEXTURE_S_BIT "
+
TASK_TEXTURE_S_BIT
+
"\n"
+
"#define TASK_TEXTURE_W_BIT "
+
TASK_TEXTURE_W_BIT
+
"\n"
+
"#define TASK_TEXTURE_W_BIT "
+
TASK_TEXTURE_W_BIT
+
"\n"
+
"#define LIST_TEXTURE_BIT "
+
LIST_TEXTURE_BIT
+
"\n"
+
"#define LIST_TEXTURE_BIT "
+
LIST_TEXTURE_BIT
+
"\n"
+
"#define TEXT_NTILE_SHIFT "
+
TEXT_NTILE_SHIFT
+
"\n"
+
// "#define CORR_OUT_RAD " + CORR_OUT_RAD+"\n" +
// "#define CORR_OUT_RAD " + CORR_OUT_RAD+"\n" +
"#define FAT_ZERO_WEIGHT "
+
FAT_ZERO_WEIGHT
+
"\n"
+
"#define FAT_ZERO_WEIGHT "
+
FAT_ZERO_WEIGHT
+
"\n"
+
"#define THREADS_DYNAMIC_BITS "
+
THREADS_DYNAMIC_BITS
+
"\n"
+
"#define THREADS_DYNAMIC_BITS "
+
THREADS_DYNAMIC_BITS
+
"\n"
+
...
...
src/main/java/com/elphel/imagej/gpu/GpuQuad.java
View file @
57fb1ef9
...
@@ -1303,68 +1303,6 @@ public class GpuQuad{ // quad camera description
...
@@ -1303,68 +1303,6 @@ public class GpuQuad{ // quad camera description
return
tp_tasks
;
return
tp_tasks
;
}
}
/**
* Prepare contents pointers for calculation of the correlation pairs
* @param tp_tasks array of tasks that contain masks of the required pairs
* @return each element has (tile_number << 8) | (pair_number & 0xff)
*/
@Deprecated
public
int
[]
getCorrTasks
(
TpTask
[]
tp_tasks
)
{
int
tilesX
=
img_width
/
GPUTileProcessor
.
DTT_SIZE
;
int
num_corr
=
0
;
int
num_pairs
=
Correlation2d
.
getNumPairs
(
quadCLT
.
getNumSensors
());
int
task_mask
=
(
1
<<
num_pairs
)
-
1
;
for
(
TpTask
tt:
tp_tasks
)
{
int
pm
=
(
tt
.
task
>>
GPUTileProcessor
.
TASK_CORR_BITS
)
&
task_mask
;
if
(
pm
!=
0
)
{
for
(
int
b
=
0
;
b
<
num_pairs
;
b
++)
if
((
pm
&
(
1
<<
b
))
!=
0
)
{
num_corr
++;
}
}
}
int
[]
iarr
=
new
int
[
num_corr
];
num_corr
=
0
;
for
(
TpTask
tt:
tp_tasks
)
{
int
pm
=
(
tt
.
task
>>
GPUTileProcessor
.
TASK_CORR_BITS
)
&
task_mask
;
if
(
pm
!=
0
)
{
int
tile
=
(
tt
.
ty
*
tilesX
+
tt
.
tx
);
for
(
int
b
=
0
;
b
<
num_pairs
;
b
++)
if
((
pm
&
(
1
<<
b
))
!=
0
)
{
iarr
[
num_corr
++]
=
(
tile
<<
GPUTileProcessor
.
CORR_NTILE_SHIFT
)
|
b
;
}
}
}
return
iarr
;
}
/**
* Prepare contents pointers for calculation of the texture tiles (RGBA, 16x16)
* @param tp_tasks array of tasks that contain masks of the required pairs
* @return each element has (tile_number << 8) | (1 << LIST_TEXTURE_BIT)
*/
@Deprecated
public
int
[]
getTextureTasks
(
TpTask
[]
tp_tasks
)
{
int
tilesX
=
img_width
/
GPUTileProcessor
.
DTT_SIZE
;
int
num_textures
=
0
;
for
(
TpTask
tt:
tp_tasks
)
{
if
((
tt
.
task
&
GPUTileProcessor
.
TASK_TEXTURE_BITS
)
!=
0
)
{
num_textures
++;
}
}
int
[]
iarr
=
new
int
[
num_textures
];
num_textures
=
0
;
int
b
=
(
1
<<
GPUTileProcessor
.
LIST_TEXTURE_BIT
);
for
(
TpTask
tt:
tp_tasks
)
{
if
((
tt
.
task
&
GPUTileProcessor
.
TASK_TEXTURE_BITS
)
!=
0
)
{
int
tile
=
(
tt
.
ty
*
tilesX
+
tt
.
tx
);
iarr
[
num_textures
++]
=
(
tile
<<
GPUTileProcessor
.
CORR_NTILE_SHIFT
)
|
b
;
}
}
return
iarr
;
}
/**
/**
* Calculate rotation matrices and their derivatives
* Calculate rotation matrices and their derivatives
...
@@ -3284,8 +3222,8 @@ public class GpuQuad{ // quad camera description
...
@@ -3284,8 +3222,8 @@ public class GpuQuad{ // quad camera description
int
tilesY
=
img_height
/
GPUTileProcessor
.
DTT_SIZE
;
int
tilesY
=
img_height
/
GPUTileProcessor
.
DTT_SIZE
;
float
[][]
extra
=
new
float
[
num_tile_extra
][
tilesX
*
tilesY
];
float
[][]
extra
=
new
float
[
num_tile_extra
][
tilesX
*
tilesY
];
for
(
int
i
=
0
;
i
<
texture_indices
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
texture_indices
.
length
;
i
++)
{
if
(((
texture_indices
[
i
]
>>
GPUTileProcessor
.
CORR
_TEXTURE_BIT
)
&
1
)
!=
0
)
{
if
(((
texture_indices
[
i
]
>>
GPUTileProcessor
.
LIST
_TEXTURE_BIT
)
&
1
)
!=
0
)
{
int
ntile
=
(
texture_indices
[
i
]
>>
GPUTileProcessor
.
CORR
_NTILE_SHIFT
);
int
ntile
=
(
texture_indices
[
i
]
>>
GPUTileProcessor
.
TEXT
_NTILE_SHIFT
);
for
(
int
l
=
0
;
l
<
num_tile_extra
;
l
++)
{
for
(
int
l
=
0
;
l
<
num_tile_extra
;
l
++)
{
extra
[
l
][
ntile
]
=
diff_rgb_combo
[
i
*
num_tile_extra
+
l
];
extra
[
l
][
ntile
]
=
diff_rgb_combo
[
i
*
num_tile_extra
+
l
];
}
}
...
@@ -3439,7 +3377,7 @@ public class GpuQuad{ // quad camera description
...
@@ -3439,7 +3377,7 @@ public class GpuQuad{ // quad camera description
// double [][][][] textures = new double [woi.height][woi.width][num_slices][texture_slice_size];
// double [][][][] textures = new double [woi.height][woi.width][num_slices][texture_slice_size];
for
(
int
indx
=
0
;
indx
<
indices
.
length
;
indx
++)
if
((
indices
[
indx
]
&
(
1
<<
GPUTileProcessor
.
LIST_TEXTURE_BIT
))
!=
0
){
for
(
int
indx
=
0
;
indx
<
indices
.
length
;
indx
++)
if
((
indices
[
indx
]
&
(
1
<<
GPUTileProcessor
.
LIST_TEXTURE_BIT
))
!=
0
){
int
tile
=
(
indices
[
indx
]
>>
GPUTileProcessor
.
CORR
_NTILE_SHIFT
);
int
tile
=
(
indices
[
indx
]
>>
GPUTileProcessor
.
TEXT
_NTILE_SHIFT
);
int
tileX
=
tile
%
full_width
;
int
tileX
=
tile
%
full_width
;
int
tileY
=
tile
/
full_width
;
int
tileY
=
tile
/
full_width
;
int
wtileX
=
tileX
-
woi
.
x
;
int
wtileX
=
tileX
-
woi
.
x
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
57fb1ef9
...
@@ -1782,7 +1782,7 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -1782,7 +1782,7 @@ public class QuadCLT extends QuadCLTCPU {
final
QuadCLT
ref_scene
,
// now - may be null - for testing if scene is rotated ref
final
QuadCLT
ref_scene
,
// now - may be null - for testing if scene is rotated ref
final
boolean
filter_bg
,
// remove bg tiles (possibly occluded)
final
boolean
filter_bg
,
// remove bg tiles (possibly occluded)
final
double
max_distortion
,
// maximal neighbor tiles offset as a fraction of tile size (8)
final
double
max_distortion
,
// maximal neighbor tiles offset as a fraction of tile size (8)
final
int
[]
cluster_index
,
//
final
int
[]
cluster_index
,
//
[tilesX*tilesY]
final
boolean
[]
border
,
// border tiles
final
boolean
[]
border
,
// border tiles
final
boolean
keep_channels
,
final
boolean
keep_channels
,
final
int
debugLevel
){
final
int
debugLevel
){
...
@@ -3386,7 +3386,7 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -3386,7 +3386,7 @@ public class QuadCLT extends QuadCLTCPU {
if
(
debugLevel
>
-
1
)
{
if
(
debugLevel
>
-
1
)
{
for
(
int
indx
=
0
;
indx
<
texture_indices
.
length
;
indx
++)
if
((
texture_indices
[
indx
]
&
(
1
<<
GPUTileProcessor
.
LIST_TEXTURE_BIT
))
!=
0
){
for
(
int
indx
=
0
;
indx
<
texture_indices
.
length
;
indx
++)
if
((
texture_indices
[
indx
]
&
(
1
<<
GPUTileProcessor
.
LIST_TEXTURE_BIT
))
!=
0
){
int
tile
=
texture_indices
[
indx
]
>>
GPUTileProcessor
.
CORR
_NTILE_SHIFT
;
int
tile
=
texture_indices
[
indx
]
>>
GPUTileProcessor
.
TEXT
_NTILE_SHIFT
;
int
tileX
=
tile
%
tilesX
;
int
tileX
=
tile
%
tilesX
;
int
tileY
=
tile
/
tilesX
;
int
tileY
=
tile
/
tilesX
;
if
((
tileY
==
clt_parameters
.
tileY
)
&&
(
tileX
==
clt_parameters
.
tileX
))
{
if
((
tileY
==
clt_parameters
.
tileY
)
&&
(
tileX
==
clt_parameters
.
tileX
))
{
...
...
src/main/java/com/elphel/imagej/tileprocessor/TexturedModel.java
View file @
57fb1ef9
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/TileNeibs.java
View file @
57fb1ef9
...
@@ -117,7 +117,7 @@ public class TileNeibs{
...
@@ -117,7 +117,7 @@ public class TileNeibs{
}
}
/**
/**
* Get
2d element index after step N, NE, ... NW. Returns -1 if leaving array
* Get
element index offset by dx and dy from the indx
* @param indx start index
* @param indx start index
* @param dx offset in x direction
* @param dx offset in x direction
* @param dy offset in y direction
* @param dy offset in y direction
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment