LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Efficient (Semi) Large Array Data Set Manipulation

Hi Everyone.

 

I am trying to figure out the most efficient way to manipulate somewhat large array of data (up to about 120 Megabyte) that I am currently getting from a FPGA. This data represent an image and it need to be manipulated before it can be displayed to the user. The data need to be unpacked from a U64 to I16 and some of it need to be chopped (essentially chop off 10% on each side of the image so if an image is 800 x 480 it becomes 640 x 480).

I have tried several approaches and the image below show the one that is the quickest but there might be further optimization that could be done.

 

 

I am looking forward to see what other can come up with.

 

Note 01: I am including a link to the benchmark VI that has a quite large image in it so this VI is about 40MB.

Note 02: this is cross-posted on Lava

 

Thanks



  


vipm.io | jki.net

0 Kudos
Message 1 of 6
(3,219 Views)

Using Array Subset rather than Reshape Array to truncate the 1D array is faster: 151 ms compared to 175 ms. 

 

Array Subset.png

 

Lynn

Message 2 of 6
(3,195 Views)

 

@johnsold wrote:

Using Array Subset rather than Reshape Array to truncate the 1D array is faster: 151 ms compared to 175 ms. 

 

Array Subset.png

 

Lynn


Thanks Lynn, this is good to know!

Unfortunately the solution in this frame is still about 2x slower than the faster one (the "Reshape & Chop & Reshape & Unpack & Reshape").

 

PJM



  


vipm.io | jki.net

0 Kudos
Message 3 of 6
(3,180 Views)

I got a slightly faster version now (~8%-9% faster).

This once do the choping somewhat inplace on each packed line (there is a copy made but it is on a "shorter" array).

I still feel though that it is possible to do better.

 

BenchmarkImageDataManipulation-V2.png

 

PJM 



  


vipm.io | jki.net

0 Kudos
Message 4 of 6
(3,150 Views)

Sorry. I did not pay enough attention. So I improved the wrong case.

 

I have not come up with anything better although I noticed that the code in the for loop takes about 1/2 to 1/3 the time of the split and interleave portion.  The split and interleave code can be replaced with a typecast to array of I16. That is easier to read but 5-6% slower.

 

Lynn

0 Kudos
Message 5 of 6
(3,102 Views)

Just closing the loop on this topic. Below is the screenshot of the fastest solution to date that does include the buffer allocation (array creation) as part of the code that is being bench marked.

 

ImageFastArrayManipulation.png

 

Thanks for everyone help.

 

PJM



  


vipm.io | jki.net

Message 6 of 6
(3,029 Views)