[music-dsp] A-Law Mu-Law Compression on adsp2186m

Erik de Castro Lopo erikd-music-dsp at mega-nerd.com
Sun Jan 18 23:57:01 EST 2004

On Sun, 18 Jan 2004 18:56:10 -0800 (PST)
ayyams ayyams <japintokio at yahoo.com> wrote:

> hi,
> 1.actually its working fine between the value...0x0000 to 0x1fff and 0xe000 to 0xffff 
> 2. between 0x1fff to 0x7fff giving constant value(0x1fff)
> 3. between 0x8000 to 0xcfff giving constant value(0xffff)

Now that you have provided a proper explanation of the problem, the source
of that problem is obvious.

A-law and u-law compress 14 (or 13, I can't remember which) bit data into 
8 bits. From the symptoms you describe above, it seems that the algorithm
you are using is expecting the 13/14 bit data in the lower bits while 
you are providing full 16 bit data.

What you need to do when encoding is divide all sample values by 4 (or 8)
and when decoding, multiply by 4 (or 8).

  Erik de Castro Lopo  nospam at mega-nerd.com (Yes it's valid)
Linux: Because rebooting is for adding new hardware

More information about the music-dsp mailing list