dmG726Encode(3dm)
dmG726Encode - implements ITU (International Telecommunication Union) Recommendation G.726 ADPCM compression for input of 64 kbit/s A-law, mu- law, or linear data and output of compressed bit stream of 40, 32 ,24, or 16 kbit/s. G.726 replaced G.721 and G.723.
As shipped in IRIX 6.5.5. Unchanged since IRIX 6.5.
NAME dmG726Encode - implements ITU (International Telecommunication Union) Recommendation G.726 ADPCM compression for input of 64 kbit/s A-law, mu- law, or linear data and output of compressed bit stream of 40, 32 ,24, or 16 kbit/s. G.726 replaced G.721 and G.723. SYNOPSIS #include <dmedia/dm_audioutil.h> DMstatus dmG726Encode(DMG726encoder handle, void *ibuf, unsigned char *obuf int numSamples) PARAMETER handle DMG726encoder structure, created by dmG726EncoderCreate(3dm), specifies the signal processing parameters. ibuf pointer to input sample data buffer, an array of short (16 bits) for linear input or unsigned char for A-law or mu-law input. For linear input, samples are assumed to be two's complement. Data buffer must be a multiple (the same multiple as that of output bitstrem buffer) of 4, 8, 2, or 8 for operations at 16, 24, 32, or 40 kbit/s respectively. This assumes the sampling rate of 8 kHz. obuf pointer to output compressed data buffer, an array of bytes. The data format is unsigned char (8-bit). The output bitstrem buffer consists of a multiple of 1, 3, 1, or 5 bytes, for operations at 16, 24, 32, or 40 kbit/s respectively. numSamples number of samples to be processed. it must always be a multiple of 4, 8, 2, or 8 for operations at 16, 24, 32, or 40 kbit/s respectively. RETURNED VALUE Returns DM_FAILURE or DM_SUCCESS. DESCRIPTION dmG726Encode(3dm) implements ITU G726 compression. G.726 compression compresses one input sample to 2, 3, 4, or 5 bits for 16, 24, 32, or 40 kbit/s operations respectively. 16, 24, 32, or 40 kbit/s operation is indicated by setting parameter DM_AUDIO_BITRATE to DM_G726_16_KBITS, DM_G726_24_KBITS, DM_G726_32_KBITS, or DM_G726_40_KBITS using DMparams and passed to dmG726EncoderSetParams(3dm). Input format is indicated by setting DM_G726_NATIVE_FORMAT to DM_G726_ULAW, DM_G726_ALAW, or DM_G726_LINEAR_PCM, respectively for inputting of mu-law, A-law, or linear PCM data, using DMparams and passed to dmG726EncoderSetParams(3dm). If input format is DM_G726_LINEAR_PCM, the PCM data type will be short. Otherwise, the PCM data type will be unsigned char. Therefore, the inbuf is void in the function prototyping. G726 compression uses a linear prediction scheme. This means that the compressed bits, which carrying compressed information, are interrelated or interdependent. If a application calls afSeekFrame(3dm) to an offset into the compressed bit stream file and then starts reading bits in the middle of the bit stream and decompress them with dmG726Decode(3dm), the interdependency of the bits at the cutting point is lost. The application will initially get back data with a lower amplitude than if he had read the same data back during a complete pass over the file from the beginning. There is no way to exactly recreate the decoded data in the middle of the bit stream file without going all the way back to the beginning. However, with a "preroll" value to read ahead a portion of the compressed file, application can compensate for the amplitude problem. NOTE G.726 algorithm was developed for sampling rate of 8 kHz, but could be used from 8 kHz to 48 kHz. SEE ALSO dmG726EncoderCreate(3dm), dmG726EncoderSetParams(3dm), dmG726EncoderDestroy(3dm), dmG726Decode(3dm), ITU (International Telecommunication Union) Recommendation G.726.