Questions tagged [24-bit]

"24bit" is usually used to specify a specific attribute. It is mostly used with images and audio files.

24bit term is widely used in DSP (Digital Signal Processing).

With images, it can indicate the color depth: the number of bits used to indicate the color of a single pixel. 24-bit color is also known as "True color". In such images each pixel is represented with 3 bytes, and can store one of 16,777,216 colors.

With sound, it can indicate the audio bit depth, which represents the resolution of each audio sample. 24bits is as much as is used in DVD-Audio.

More information can be found on the "Color depth" and "Audio bit depth" articles on Wikipedia

63 questions
13
votes
5 answers

Padding in 24-bits rgb bitmap

could somebody explain to me why in 24-bit rgb bitmap file I have to add a padding which size depends on width of image ? What for ? I mean I must add this code to my program (in C): if( read % 4 != 0 ) { read = 4 - (read%4); printf(…
salieri
  • 131
  • 1
  • 1
  • 3
8
votes
4 answers

How to create a bmp file from byte[] in C#

I have a byte[] array received in TCP Client.The array contains a 24-bit RGB Bitmap file.How to create that bitmap file with given Width ,Height and data? In C++ I use this int WriteBitmapFile(const char *filename, int width, int height, unsigned…
Ivan Prodanov
  • 34,634
  • 78
  • 176
  • 248
7
votes
8 answers

C/C++ - Convert 24-bit signed integer to float

I'm programming in C++. I need to convert a 24-bit signed integer (stored in a 3-byte array) to float (normalizing to [-1.0,1.0]). The platform is MSVC++ on x86 (which means the input is little-endian). I tried this: float convert(const unsigned…
Etienne Dechamps
  • 24,037
  • 4
  • 32
  • 31
6
votes
3 answers

How to convert 24 bit RGB to 8 bit RGB

I was wondering what is the best way to convert a 24-bit RGB color (8 bits per color) into an 8-bit color (2bits Blue, 3 Green, 3 Red). I'd like C code for doing this.
Gootik
  • 526
  • 1
  • 7
  • 18
5
votes
4 answers

Why 24 bits registers?

In my work I deal with different micro-controllers, micro-processors and DSP processors. Many of them have 24-bits registers and counters. I know how to use them, this is not my question. My question is why do they have 24-bits register! why not…
Yousf
  • 3,957
  • 3
  • 27
  • 37
4
votes
3 answers

Efficiently remove every 4th byte from a numpy.int32 array's data bytes

I have a big numpy.int32 array, that can take 4GB or more. It's in fact a 24-bit integer array (quite common in audio applications), but as numpy.int24 doesn't exist, I used an int32. I want to output this array's data as 24-bit, i.e. 3 bytes per…
Basj
  • 41,386
  • 99
  • 383
  • 673
4
votes
0 answers

24-bit and 16-bit to float number in C#

I have a 32-bit tiff file which stores 4-byte values per pixel. I used BitConverter.toSingle() to convert each 4-byte values to the pixel value and it works fine. But the problem is I have 24 and 16-bit tiff files which there are 3 and 2 bytes for…
Nasser Tahani
  • 725
  • 12
  • 33
4
votes
1 answer

Do modern c++ compilers autovectorize code for 24bit image processing?

Do compilers like gcc, visual studio c++, the intel c++ compiler, clang, etc. vectorize code like the following? std::vector img( height * width * 3 ); unsigned char channelMultiplier[3]; // ... initialize img and channelMultiplier…
3
votes
1 answer

How to get 24-bit samples from USB audio device using Python?

I am trying to get a stream of 24-bit audio samples from some USB audio device using Python. I already searched for some solutions and found this thread that is using PyAudio stream with a format of pyaudio.paInt24, unfortunately I still got 16-bit…
3
votes
1 answer

Matlab fast data type conversion 4x1byte to 1x32byte

I am receiving packets of binary data encoding audio samples as 24bit unsigned integers. These need to be converted to 32bit signed (2's complement) integers for output. However, due to the way the data is chunked, it is possible that a 24bit word…
3
votes
1 answer

Swift convert UIImage to 24-bit RGB with no alpha channel

I'd like to convert the UIImage to a 24-bit RGB with no inbetween 32-bit RGBA buffer. I tried this, but it does not work (bytes is all zero) : public func pixelsRGB() -> [UInt8]? { let size = self.size let dataSize = size.width *…
Stéphane de Luca
  • 12,745
  • 9
  • 57
  • 95
3
votes
4 answers

How to write a 24 bit message after reading from a 4-byte integer on a big endian machine (C)?

I am constructing a message to send a 24-bit number over the network. For little endian machines, the code is (ptr is the pointer to the message buffer): *ptr++ = (num >> 16) & 0xFF; *ptr++ = (num >> 8) & 0xFF; *ptr++ = (num) & 0xFF; (So if…
Bikash
  • 33
  • 3
3
votes
1 answer

Working with 24-bit audio samples

What is the "standard way" of working with 24-bit audio? Well, there are no 24-bit data types available, really. Here are the methods that come into my mind: Represent 24-bit audio samples as 32-bit ints and ignore the upper eight bits. Just like…
ezpresso
  • 7,896
  • 13
  • 62
  • 94
3
votes
1 answer

What would the smallest positive value of an IEEE 24-bit float be?

The smallest positive value of an IEEE-754 32-bit float is 2^−149 and that of a 16-bit float is 2^-14. If the IEEE-754 standardized a 24-bit float, what would its smallest positive value be? Excuse me if this is explicitly documented somewhere, but…
Ky -
  • 30,724
  • 51
  • 192
  • 308
3
votes
2 answers

Is 32 bit image processing faster than 24 bit image processing when simd instructions are used?

I had a look on the sse and mmx instruction set and there are no instructions for 3 channel image processing. Of course, for many operations you can use the same instructions, such as averaging two images. But when it comes to operations like…
Ralph Tandetzky
  • 22,780
  • 11
  • 73
  • 120
1
2 3 4 5