Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8233739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:14:00+00:00 2026-06-07T18:14:00+00:00

I am getting signal that is stored as a buffer of char data (8

  • 0

I am getting signal that is stored as a buffer of char data (8 bits).
I am also getting the same signal plus 24 dB and my boss told me that it should be possible to reconstruct from those two buffers, one (which will be used as output) that will be stored as 12 bits.
I would like to know the mathematical operation that can do that and why choosing +24dB.
Thanks (I am dumb ><).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:14:02+00:00Added an answer on June 7, 2026 at 6:14 pm

    From the problem statement, I guess you have an analog signal which are sampled at two amlitudes. Both signals has a resolution of 8 bits, but one is shifted and truncated.

    You could get a 12 bit signal by combining the upper 4 bits of the first signal, and concatenating them with the second signal.

    sOut = ((sIn1 & 0xF0) << 4) | sIn2
    

    If you want to get a little better accuracy, you could try to calculate an average over the common bits of the two signals. Normally, the lower 4 bits of the first signal should be approximately equal to the upper 4 bits of the second signal. Due to rounding-errors or noise, the values could be slightly different. One of the values could even have overflowed, and moved to the other end of the range.

    int Combine(byte sIn1, byte sIn2)
    {
        int a = sIn1 >> 4; // Upper 4 bits
        int b1 = sIn1 & 0x0F; // Common middle 4 bits
        int b2 = sIn2 >> 4;  // Common middle 4 bits
        int c = sIn2 & 0x0F; // Lower 4 bits
    
        int b;
    
        if (b1 >= 12 && b2 < 4)
        {
            // Assume b2 has overflowed, and wrapped around to a smaller value.
            // We need to add 16 to it to compensate the average.
            b = (b1 + b2 + 16)/2;
        }
        else if (b1 < 4 && b2 >= 12)
        {
            // Assume b2 has underflowed, and wrapped around to a larger value.
            // We need to subtract 16 from it to compensate the average.
            b = (b1 + b2 - 16)/2;
        }
        else
        {
            // Neither or both has overflowed. Just take the average.
            b = (b1 + b2)/2;
        }
    
        // Construct the combined signal.
        return a * 256 + b * 16 + c;
    }
    

    When I tested this, it reproduced the signal accurately more often than the first formula.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting from server data using signal and slot. Here is slot part: QString
37 Signal's Getting Real convinced me that wireframing and writing functional specification documents are
I have a signal and a slot that should fit together quite nicely. class
I'm getting mixed signals. The warning in the PDO documentation seems pretty clear that
I have a problem while scrolling images on tableview. I am getting a Signal
I keep getting a -> Program received signal: EXC_BAD_ACCESS. In the following code but
Is there a framework for Flex that uses the Qt Signal and Slots paradigm?
I'm writing a shell program that must handle signals. My relevant signal handling related
Hi I'm building a program that uses a signal handler shown below ... struct
I'm getting weird seg fault that seems to be coming from somewhere not in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.