キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

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

0 件の賞賛
メッセージ1/6
4,009件の閲覧回数

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

 

Array Subset.png

 

Lynn

メッセージ2/6
3,985件の閲覧回数

 

@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

0 件の賞賛
メッセージ3/6
3,970件の閲覧回数

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 

0 件の賞賛
メッセージ4/6
3,940件の閲覧回数

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 件の賞賛
メッセージ5/6
3,892件の閲覧回数

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

メッセージ6/6
3,819件の閲覧回数