Commit c216c7e4 authored by Andrey Filippov's avatar Andrey Filippov

Implemented CLT accumulation for virtual orientation

parent 952177ec
...@@ -1114,6 +1114,17 @@ public class GpuQuad{ // quad camera description ...@@ -1114,6 +1114,17 @@ public class GpuQuad{ // quad camera description
copyD2H.Height = img_height; // /4; copyD2H.Height = img_height; // /4;
cuMemcpy2D(copyD2H); // run copy cuMemcpy2D(copyD2H); // run copy
} }
public int [] getWH(boolean use_ref) {
return use_ref ? gpu_clt_ref_wh : gpu_clt_wh;
}
public int getNumColors() {
return num_colors;
}
public int getNumSensors() {
return num_cams;
}
public int getCltSize(boolean use_ref) { // per camera, in floats public int getCltSize(boolean use_ref) { // per camera, in floats
int [] wh = use_ref ? gpu_clt_ref_wh : gpu_clt_wh; int [] wh = use_ref ? gpu_clt_ref_wh : gpu_clt_wh;
...@@ -1121,7 +1132,16 @@ public class GpuQuad{ // quad camera description ...@@ -1121,7 +1132,16 @@ public class GpuQuad{ // quad camera description
int tilesY = wh[1] / GPUTileProcessor.DTT_SIZE; int tilesY = wh[1] / GPUTileProcessor.DTT_SIZE;
return tilesY*tilesX*num_colors* 4 * GPUTileProcessor.DTT_SIZE * GPUTileProcessor.DTT_SIZE; return tilesY*tilesX*num_colors* 4 * GPUTileProcessor.DTT_SIZE * GPUTileProcessor.DTT_SIZE;
} }
/*
public int getCltLength(boolean use_ref) {
int [] wh = use_ref ? gpu_clt_ref_wh : gpu_clt_wh;
int tilesX = wh[0] / GPUTileProcessor.DTT_SIZE;
int tilesY = wh[1] / GPUTileProcessor.DTT_SIZE;
int tile_size_td = getCltSize(use_ref); // 4 * GPUTileProcessor.DTT_SIZE * GPUTileProcessor.DTT_SIZE;
int num_tiles = tilesY*tilesX*num_colors;
return num_tiles* tile_size_td;
}
*/
public float [][] getCltData( // only for color=0 public float [][] getCltData( // only for color=0
boolean use_ref){ boolean use_ref){
CUdeviceptr [] gpu_sel_clt_h = use_ref ? gpu_clt_ref_h : gpu_clt_h; CUdeviceptr [] gpu_sel_clt_h = use_ref ? gpu_clt_ref_h : gpu_clt_h;
...@@ -1209,24 +1229,36 @@ public class GpuQuad{ // quad camera description ...@@ -1209,24 +1229,36 @@ public class GpuQuad{ // quad camera description
return; return;
} }
/* public void setCltData( // for testing only
public void setBayerImage( int ncam,
float [] bayer_image, float [] fclt, //
int ncam) { boolean use_ref){
int clt_size = getCltSize(use_ref);
if (fclt.length != clt_size) {
System.out.println("getCltData(): wrong array size: got ["+fclt.length+"], "+
"should be ["+clt_size+"]");
return;
}
CUdeviceptr [] gpu_sel_clt_h = use_ref ? gpu_clt_ref_h : gpu_clt_h;
int [] wh = use_ref ? gpu_clt_ref_wh : gpu_clt_wh;
int tilesX = wh[0] / GPUTileProcessor.DTT_SIZE;
int tilesY = wh[1] / GPUTileProcessor.DTT_SIZE;
int tile_size_td = 4 * GPUTileProcessor.DTT_SIZE * GPUTileProcessor.DTT_SIZE;
int num_tiles = tilesY*tilesX*num_colors;
CUDA_MEMCPY2D copyH2D = new CUDA_MEMCPY2D(); CUDA_MEMCPY2D copyH2D = new CUDA_MEMCPY2D();
copyH2D.srcMemoryType = CUmemorytype.CU_MEMORYTYPE_HOST; copyH2D.srcMemoryType = CUmemorytype.CU_MEMORYTYPE_HOST;
copyH2D.srcHost = Pointer.to(bayer_image); copyH2D.srcHost = Pointer.to(fclt);
copyH2D.srcPitch = img_width*Sizeof.FLOAT; // width_in_bytes; copyH2D.srcPitch = tile_size_td * Sizeof.FLOAT;
copyH2D.dstMemoryType = CUmemorytype.CU_MEMORYTYPE_DEVICE; copyH2D.dstMemoryType = CUmemorytype.CU_MEMORYTYPE_DEVICE;
copyH2D.dstDevice = gpu_bayer_h[ncam]; // src_dpointer; copyH2D.dstDevice = gpu_sel_clt_h[ncam];
copyH2D.dstPitch = mclt_stride *Sizeof.FLOAT; // device_stride[0]; copyH2D.dstPitch = tile_size_td * Sizeof.FLOAT;
copyH2D.WidthInBytes = img_width*Sizeof.FLOAT; // width_in_bytes; copyH2D.WidthInBytes = tile_size_td * Sizeof.FLOAT;
copyH2D.Height = img_height; // /4; copyH2D.Height = num_tiles;
cuMemcpy2D(copyH2D); cuMemcpy2D(copyH2D); // run copy
return;
} }
*/
/** /**
* Copy a set of images to the GPU (if they are new) * Copy a set of images to the GPU (if they are new)
......
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