LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

8 bit Array onto 10 bit Array

Hi

 

   I am trying to convert a array of U8 into a 10 bits array (take the first 8 bits then add the next 2 bits of the next byte then the remaning 6 bits with the next 4 bits and so on). The ram we are using is 8bit but the

CCD image it actually 10 bit, i have attached a couple of jpegs to show what i have done and i was wandering weather there is a expert around to say if this is the most efficient way of doing this. I have a large

arrray to convert and would like to make it as quick as possible.

 

Thanks for any help Gary

 

Download All
0 Kudos
Message 1 of 8
(4,169 Views)

Hi, Gary,

 

Not fully understand why you needed such packing. The most efficient way is convert U8 to U16 where 10 bits only used in each 16 bit Word and 4 bits remains zeroes.

 

Andrey.

 

0 Kudos
Message 2 of 8
(4,163 Views)

 

 Hi

 

  I have a interface that writes to a 8 bit RAM block i need to take that and make it 10bit because that is the CCD is 10 bit, so the first 8 bits and the 2 bits of the next byte make up the first 

CCD pixel, the remaining 6 bits of the second byte and 4 bits of the third byte make up the second pixel and so on. So five bytes make 4 words with only the first 10 bits used.

 

 Hope this make sense Gary

0 Kudos
Message 3 of 8
(4,151 Views)
This looks efficient.

A few things though...

Notice the red dots before the AND functions? Make the constants U8 (right
click them, set the representation to u8). This eliminates the convertion to
U8's after them.

Then you join the to U8's. Why not join them, and then AND them with a U16?
Doing one AND on a U16 should be a bit more efficient then doing two AND's
on U8's. You can do this 3 times. The first time you do this (AND the top
two arrays with 3FF). Make the constants U16's.

You will run into troubles when the input array isn't filled with a multiple
of 5 elements. The output arrays of the interleave function will be as large
as it's smallest array size. You'll need to increase the array size to the
next multiple of 5, and when done, trunc the results...

Regards,

Wiebe.


0 Kudos
Message 4 of 8
(4,143 Views)

Hi

 

  Thanks for that, i was wondering if making the U8 input array into binary and then taking 10 bits at a time would be better ?(not sure how  easy it is to convert a large array into bits)

 

 

  Cheers Gary

0 Kudos
Message 5 of 8
(4,129 Views)
Boolean arrays are slow... I would be supprised if it was faster. But I
would give it a try...

Did you set up a benchmark VI?

Regards,

Wiebe.


0 Kudos
Message 6 of 8
(4,091 Views)

Gary,

 

Reshaping an array of bits is quite easy and (imho) the block diagram code is much easier to understand.

 

For arrays of a different size you will just have to calculate the first dimension for the resize operation. 

 

 

 

 

Regards

Anke 

Message Edited by AnkeS on 11-19-2008 10:16 AM
0 Kudos
Message 7 of 8
(4,087 Views)
It looks easier and it is easier to understand, but it will probably be
slower...

Since the original question was what the most efficient way (as quick as
possible) is, I think it is time for some benchmarking...

Regards,

Wiebe.


0 Kudos
Message 8 of 8
(4,060 Views)