convert M bit buffer to N bit buffer

Discussion in 'C++' started by runcyclexcski@yahoo.com, Mar 26, 2007.

  1. Guest

    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, 2007
    #1
    1. Advertising

  2. Sarath Guest

    On Mar 26, 9:15 am, 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/
     
    Sarath, Mar 26, 2007
    #2
    1. Advertising

  3. sergejusz Guest

    On Mar 26, 1:15 am, 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
     
    sergejusz, Mar 26, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    1,764
    Timothy Bendfelt
    Jan 19, 2007
  2. Replies:
    4
    Views:
    1,169
  3. Replies:
    7
    Views:
    836
  4. Fore
    Replies:
    29
    Views:
    15,276
    Rashad
    Sep 21, 2008
  5. Wanderer
    Replies:
    1
    Views:
    588
    Wanderer
    Mar 24, 2011
Loading...

Share This Page