I noticed while responding to #1 that raw_pixels_to_ir_data requires different input and output buffers for the pixel data it operates on, even though they don't need to be completely separate. Two approaches I can think of right now for combining the pixel_data and destination arguments:
Shuffle the data in pixel_data so that each 2-byte value from the camera's RAM is spaced out with 2 empty/ignored bytes between each input value, and then the output data is written over the 4 bytes (ex: from camera: 001122, input to function: 00--11--22--, output from function: AAAABBBBCCCC).
Double the size of the in/out buffer, and then calculate the output values in the reverse order, so that by the time they catch up to the input data we'll be overwriting data that isn't needed anymore (ex: from camera: 001122, input to function: 001122------, buffer for each step: 001122--CCCC, 0011BBBBCCCC, AAAABBBBCCCC).
The first option might be a bit slower, as you'd need to shuffle the data around before calling the function (unless the function that read that data off of the camera spaced it out for you). The second option sounds like it would be unsafe, so I'm pretty hesitant to jump into that (then again, the first method basically requires transmute-ing between bytes, u16 and f32).
I noticed while responding to #1 that
raw_pixels_to_ir_data
requires different input and output buffers for the pixel data it operates on, even though they don't need to be completely separate. Two approaches I can think of right now for combining thepixel_data
anddestination
arguments:pixel_data
so that each 2-byte value from the camera's RAM is spaced out with 2 empty/ignored bytes between each input value, and then the output data is written over the 4 bytes (ex: from camera:001122
, input to function:00--11--22--
, output from function:AAAABBBBCCCC
).001122
, input to function:001122------
, buffer for each step:001122--CCCC
,0011BBBBCCCC
,AAAABBBBCCCC
).The first option might be a bit slower, as you'd need to shuffle the data around before calling the function (unless the function that read that data off of the camera spaced it out for you). The second option sounds like it would be
unsafe
, so I'm pretty hesitant to jump into that (then again, the first method basically requirestransmute
-ing between bytes,u16
andf32
).