LinToMuLaw

Encodes the linear samples using 8-bit μ-law format and stores them in a vector.

Syntax

IppStatus ippsLinToMuLaw_16s8u(const Ipp16s* pSrc, Ipp8u* pDst, int len);

IppStatus ippsLinToMuLaw_32f8u(const Ipp32f* pSrc, Ipp8u* pDst, int len);

Parameters

pSrc

Pointer to the source vector.

pDst

Pointer to the destination vector.

len

Number of samples in the vector.

Description

The function ippsLinToMuLaw is declared in the ipps.h file. This function encodes the PCM-linear samples in the vector pSrc using 8-bit μ-law format and stores them in the vector pDst.

The formula for μ-law companding is as follows:



where x is the linear signal sample and Cμ(x) is the μ -law encoded sample.

The formula is shown in terms of absolute values of both the original and compressed signals since positive and negative values are compressed in an identical manner. The sign of the input is preserved in the output.

The formula shown above should not be implemented directly, since such an implementation would be slow. Encoding or decoding of μ -law format is usually performed using look-up Tables 2a/G.711 and 2b/G.711 shown in the CCITT specification G.711 [CCITT]. Refer to the G.711 specification for details.

Code example  shows how to use the function ippsLinToMuLaw_32f8u.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when the pDst or pSrc pointer is NULL.

ippStsSizeErr

Indicates an error when len is less than or equal to 0.

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.