Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dmG722Encode(3dm) — IRIX 6.5.3f

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

dmG722EncoderCreate(3dm)

dmG722EncoderDestroy(3dm)

dmG722Decode(3dm)



dmG722Encode(3dm)                                            dmG722Encode(3dm)



NAME
     dmG722Encode - implements the ITU (International Telecommunication Union)
     Recommendation G.722 compression.


SYNOPSIS
     #include <dmedia/dmaudioutil.h>

     DMstatus dmG722Encode(DMG722encoder handle,
                       short *ibuf, unsigned char *obuf, int nsamples)


PARAMETER
     handle    DMG722encoder structure, created by dmG722EncoderCreate(3dm),
               specifies the signal processing parameters.


     ibuf      pointer to input sample data buffer. The data format is short
               (16-bit).  The samples are assumed to be two's complement.
               Sampling rate must be 16 kHz or less.


     obuf      pointer to output data buffer.  The data format is unsigned
               char (8-bit).


     nsamples  number of samples in the input buffer to be processed. the
               value of nsamples passed to the G.722 encode/decode routines
               must always be a multiple of 2.  It will fail if nsamples
               exceeds the the maximum value specified when the DMG722encoder
               was created.


RETURNED VALUE
     Returns DMFAILURE or DMSUCCESS.



DESCRIPTION
     dmG722Encode(3dm) implements the ITU Recommendation G.722 compression.
     If sampling rate is less than 16 kHz, the algorithm still works, except
     the upper bits contains less useful information.


     dmG722Encode(3dm) algorithm uses bandpass filter operations that convolve
     past input samples with a filter M-coefficient array. The linear phase
     filter has a constant time delay of G = (M-1)/2 samples.
     dmG722Decode(3dm) algorithm also uses bandpass filter operations.  The
     total delay for operating dmG722Encode(3dm) and dmG722Decode(3dm) will be
     2*G = M-1 samples. This constant is _AU_G722_QMF_DELAY, which is 23.





                                                                        Page 1





dmG722Encode(3dm)                                            dmG722Encode(3dm)



     In real time operation, bandpass filtering simply delays the output by 23
     samples. In file conversion expecting N samples in and out, the output
     signal is offset by 23 samples from the first sample.  The application
     may want to discard the first 23 samples returned in output date buffer
     from dmG722Decode.  The application may also want to flush out an
     additional 23 samples from dmG722Encode after feeding in all the input
     data to be compressed.  This flushing operation is performed by calling
     dmG722Encode with a value nsamples = 23 (the corresponding inbuf will
     typically be bzero'd).


     ITU Recommendation G.722 compression also uses a linear prediction
     scheme.  This means that the compressed bits, which carrying compressed
     information, are interrelated or interdependent.  If a application calls
     afSeekFrame() 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 dmG722Decode(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.  We recommend
     2 second "preroll".  The application may also consider adding extra 23
     samples for "preroll" for compensation of the filter delays encountered
     in the encoding and decoding processes, as we discussed above.


NOTE
     G.722 algorithm was developed for sampling rate of 16 kHz.


SEE ALSO
     dmG722EncoderCreate(3dm), dmG722EncoderDestroy(3dm), dmG722Decode(3dm),
     ITU Recommendation G.722.

















                                                                        Page 2



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026