473,624 Members | 2,281 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 2248
On Mar 26, 9:15 am, runcyclexc...@y ahoo.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.wordpre ss.com/

Mar 26 '07 #2
On Mar 26, 1:15 am, runcyclexc...@y ahoo.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
2513
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 unsigned char* buffer, size_t start_pos, size_t length) { char value = 0;
2
12170
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
12680
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
1761
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; counter = 0; while ( size > 0 ) { UInt16 val = buffer;
12
2965
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 and not have it affected by the null? because it is right now causes truncated data at wierd places... but as soon as i manually with a hex editor change char(00) to char(20) in the files it reads prerfectly... which leads me to my 2nd...
43
8426
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 is not extremely convenient. -- NOUN:1. Money or property bequeathed to another by will. 2. Something handed down from an ancestor or a predecessor or from the past: a legacy of religious freedom. ETYMOLOGY: MidE legacie, office of a deputy,...
5
3901
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 = fileSize; byte b = new byte;
8
8405
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 = "aabbccdd"; where aa is the LSB and dd is the MSB.
23
11347
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 ? all sugestions welcome. Carl K
2
4150
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. So kindly can any body help me how to convert char *buffer to bitmap. i want the solution in C++
0
8242
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8681
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8629
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8341
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7170
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1793
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1488
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.