quantization

Dithering gouraud-shaded vertex-colored polygons to remove banding

I'm using OpenGL ES on a low-resolution, embedded device. I've applied a vertical color gradient, using vertex coloring, to a large polygon serving as a backdrop to my rendered scene. I can see clear visible banding artifacts in the color gradient. My main experience is using software renderers. With software renderers it is common to ...

Convert/Quantize Float Range to Integer Range

Say I have a float in the range of [0, 1] and I want to quantize and store it in an unsigned byte. Sounds like a no-brainer, but infact it's quite compliated: The obvious solution looks like this: unsigned char QuantizeFloat (float a) { return (unsigned char) (a * 255.0f); } This works in so far that I get all numbers from 0 to 25...

8 bit audio samples to 16 bit

This is my "weekend" hobby problem. I have some well-loved single-cycle waveforms from the ROMs of a classic synthesizer. These are 8-bit samples (256 possible values). Because they are only 8 bits, the noise floor is pretty high. This is due to quantization error. Quantization error is pretty weird. It messes up all frequencies a bit...

Fastest dithering / halftoning library in C

I'm developing a custom thin-client server that serves rendered webpages to its clients. Server is running on multicore Linux box, with Webkit providing the html rendering engine. The only problem is the fact that clients display is limited with a 4bit (16 colors) grayscale palette. I'm currently using LibGraphicsMagick to dither images...

Does C have a Quantization function?

Dear developers, I have a buffer with many positive 16bit values (which are stored as doubles) that I would like to quantize to 8bit (0-255 values). According to Wikipedia the process would be: Normalize 16 bit values. I.e. find the largest and divide with this. Use the Q(x) formula with M=8. So I wonder, if C have a function that ...

What's the difference between quantize() and str.format()?

I don't mean what's the technical difference, but rather, what's the faster/more logical or Pythonic, etc. way to do this: def __quantized_price(self): TWOPLACES = Decimal(10) ** -2 return self.price.quantize(TWOPLACES) or def __formatted_price(self): TWOPLACES = Decimal(10) ** -2 return '{0:.2...

Vector Quantization in Speech Processing Explanation

Hi all, I'm having trouble determining from this research paper exactly how I can reproduce the Standard Vector Quantization algorithm to determine the language of an unidentified speech input, based on a training set of data. Here's some basic info: Abstract info Language recognition (e.g. Japanese, English, German, etc) using acoustic...

Vector quantization

Hi there, Has anyone heard a way to vector quantize vectors, using opencv ? Thx ...

Vector quantization & LBG

Hi there, In the purpose of vector quantization, I'm using the linde-buzo-gray (LBG) algorithm to generate the codebook. To generate 256 codewords in this codebook, I'm using 256 000 training vectors (all of 128 dimensions). This codebook is initialized with a vector and than split until obtaining 256 codewords. My problem is : at th...

Reducing sample bit-depth by truncating

I have to reduce the bit-depth of a digital audio signal from 24 to 16 bit. Taking only the 16 most significant bits (i.e. truncating) of each sample is equivalent to doing a proportional calculation (out = in * 0xFFFF / 0xFFFFFF)? ...

Need algorithm or help on Quantization of a YUV image bit stream.

package Phase2; import magick.ImageInfo; import magick.MagickImage; import magick.MagickException; import magick.MagickApiException; import magick.ColorspaceType; import java.awt.Dimension; import magick.PixelPacket; public class TASK1 { public static MagickImage scaleColorTable(MagickImage image, int choice) { try ...

Keyboard input to music notation

I am working on a music composition application that supports midi keyboard input. Are there any open/free libraries that can quantize those inputs (with time as the domain) to a format suitable for music notation, such as ABC? Thanks ...