Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   convert M bit buffer to N bit buffer (http://www.velocityreviews.com/forums/t487128-convert-m-bit-buffer-to-n-bit-buffer.html)

 runcyclexcski@yahoo.com 03-26-2007 12:15 AM

convert M bit buffer to N bit buffer

Hi all,

I don't have basic training in programming, so I apologize for this
naiive question. I have a camera that outputs 14 bit data. I need to
collect and store movies of thousands of frames. I found that my
signal rarely exceeds 1024. So I can considerably reduce the movie
size if I store the data in 10 bit and don't allocate all 14 bits. How
do I specify a 10 bit data type (or N bit) and convert short data type
to 10 bit and back (my app is in Visual C++)? Thanks in advance.

 Sarath 03-26-2007 02:41 AM

Re: convert M bit buffer to N bit buffer

On Mar 26, 9:15 am, runcyclexc...@yahoo.com wrote:
> Hi all,
>
> I don't have basic training in programming, so I apologize for this
> naiive question. I have a camera that outputs 14 bit data. I need to
> collect and store movies of thousands of frames. I found that my
> signal rarely exceeds 1024. So I can considerably reduce the movie
> size if I store the data in 10 bit and don't allocate all 14 bits. How
> do I specify a 10 bit data type (or N bit) and convert short data type
> to 10 bit and back (my app is in Visual C++)? Thanks in advance.

You can make use of bitfields in C++ to declare less storage capacity
than an integral data type

Check
http://msdn2.microsoft.com/en-us/library/ewwyfdbe.aspx

Regards,
Sarath - htpp://sarathc.wordpress.com/

 sergejusz 03-26-2007 09:43 AM

Re: convert M bit buffer to N bit buffer

On Mar 26, 1:15 am, runcyclexc...@yahoo.com wrote:
> Hi all,
>
> I don't have basic training in programming, so I apologize for this
> naiive question. I have a camera that outputs 14 bit data. I need to
> collect and store movies of thousands of frames. I found that my
> signal rarely exceeds 1024. So I can considerably reduce the movie
> size if I store the data in 10 bit and don't allocate all 14 bits. How
> do I specify a 10 bit data type (or N bit) and convert short data type
> to 10 bit and back (my app is in Visual C++)? Thanks in advance.

Hi,
If I've understood you correctly:
It means that 16 short numbers (160 significant data bits) may be
saved in 10 shorts. So, make working buffer, containing 16 short
numbers and counter of frames. When counter reaches 16, reset it and
pack data to 10 shorts.
Or you may save 8 frames (80 bits) in 10 element array of unsigned
chars. And so on .....

HTH
Serge
http://www.sergejusz.com

 All times are GMT. The time now is 05:46 PM.