lecroy Posted January 18, 2010 Report Share Posted January 18, 2010 I am using the latest version of Labview 2009 with all of it's wizz bang super functions. What I am attempting to do take an array of 32-bit data and convert it to a different size. The data is packed. So, for example say I have an array of UINT32 numbers and I want to convert them to 18 bits. The first number would be represented by the first UNIT32. The remaining bits are the start of the next number. I tried to flatten the 32-bit data to a 1-bit array and then decimate the 1-bit array to form multiple bit arrays of the target size. I then convert these back to single numbers. It works but is very slow. The quickest conversion we have found was using the replace array subset. I have attached the example. On my PC, this takes about a half second to run, not including the time to create the dataset. I need to get this down into the 10-50mS range. Is there a slick way to do bit packing and unpacking in labview that's fast? DMAunpack4c.vi Quote Link to comment
Grampa_of_Oliva_n_Eden Posted January 18, 2010 Report Share Posted January 18, 2010 I am using the latest version of Labview 2009 with all of it's wizz bang super functions. What I am attempting to do take an array of 32-bit data and convert it to a different size. The data is packed. So, for example say I have an array of UINT32 numbers and I want to convert them to 18 bits. The first number would be represented by the first UNIT32. The remaining bits are the start of the next number. I tried to flatten the 32-bit data to a 1-bit array and then decimate the 1-bit array to form multiple bit arrays of the target size. I then convert these back to single numbers. It works but is very slow. The quickest conversion we have found was using the replace array subset. I have attached the example. On my PC, this takes about a half second to run, not including the time to create the dataset. I need to get this down into the 10-50mS range. Is there a slick way to do bit packing and unpacking in labview that's fast? the Bit Twiddler challenge is probably a good place to start. http://zone.ni.com/devzone/cda/tut/p/id/5307 This tag cloud on the Inplacness-algorithm may also help. http://forums.ni.com/ni/tagging/view_tag?tag.text=Inplaceness-Algorithm Ben Quote Link to comment
lecroy Posted January 18, 2010 Author Report Share Posted January 18, 2010 I wasn't really looking for a how to do it as much as if they had a function like this already built in. An interesting side note, I plan to just code this function in C and be done with it. Before I did this, I wrote the function the same way I plan do code it but in labview. For fun, I benchmarked this and it cut the time in half. A couple of quick tweeks got it into the 200mS range. Not bad considering where I started but not good enough to be useful. C still has it's place. Quote Link to comment
lecroy Posted January 21, 2010 Author Report Share Posted January 21, 2010 (edited) Been a few days so figured I would see if anyone knew of a trick for this. Looks like bit packing is not something people use. Using the MSVS 2005, optimized for speed, release the time to run this function is now in the 30mS range. Much better than the two and a half seconds I saw using the array decimate function. This is good enough for what I need. The updated benchmarks packer_new.zip Edited January 21, 2010 by lecroy Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.