convert M bit buffer to N bit buffer

R

runcyclexcski

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.
 
S

Sarath

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/
 
S

sergejusz

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top