473,499 Members | 1,648 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.

Mar 26 '07 #1
2 2232
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/

Mar 26 '07 #2
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

Mar 26 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2500
by: Sam Smith | last post by:
Hi, I wan't a function to take a const char*, a start bit position and number of bits and convert that bit-stream into a primitive of desired type. I.e. something like: char convert(const...
2
12147
by: Mel WEaver | last post by:
Hello, I have the following delphi structure for a binary file. I'm looking for idea how to read this file. Mel type TMenuDataStruct = packed record exename : string;
9
12661
by: Charles Law | last post by:
Suppose I have a structure Private Structure MyStruct Dim el1 As Byte Dim el2 As Int16 Dim el3 As Byte End Structure I want to convert this into a byte array where
6
1749
by: Glenn Wilson | last post by:
I have converted most of the code that I have but am having trouble, mainly with the marked lines. (>>) public static UInt16 checksum( UInt16 buffer, int size ) { Int32 cksum = 0; int counter;...
12
2942
by: Brian Henry | last post by:
first question... I have a flat file which unfortinuatly has columns seperated by nulls instead of spaces (a higher up company created it this way for us) is there anyway to do a readline with this...
43
8376
by: Steven T. Hatton | last post by:
http://public.research.att.com/~bs/bs_faq2.html#int-to-string Is there no C library function that will take an int and convert it to its ascii representation? The example Bjarne shows in his faq...
5
3890
by: bbb | last post by:
Hi, I need to convert XML files from Japanese encoding to UTF-8. I was using the following code: using ( FileStream fs = File.OpenRead(fromFile) ) { int fileSize = (int)fs.Length; int buffer...
8
8382
by: Polaris431 | last post by:
I have a buffer that holds characters. Four characters in a row represent an unsigned 32 bit value. I want to convert these characters to a 32 bit value. For example: char buffer; buffer =...
23
11309
by: Carl K | last post by:
I need to take the take the pdf output from reportlab and create a preview image for a web page. so png or something. I am sure ghostscript will be involved. I am guessing PIL or ImageMagic ? ...
2
4134
by: Rasheed | last post by:
Hi, i have a char pointer buffer which will hold the bitmap buffer, So i need to convert char *buffer as a bitmap. becuase when i draw on the Dialog using char *buffer. Nothing will be dispalyed....
0
7132
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7009
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7178
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
302
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.