g72x.h
上传用户:sy_wanhua
上传日期:2013-07-25
资源大小:3048k
文件大小:3k
源码类别:

流媒体/Mpeg4/MP4

开发平台:

C/C++

  1. /*
  2.  * This source code is a product of Sun Microsystems, Inc. and is provided
  3.  * for unrestricted use.  Users may copy or modify this source code without
  4.  * charge.
  5.  *
  6.  * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
  7.  * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  8.  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  9.  *
  10.  * Sun source code is provided with no support and without any obligation on
  11.  * the part of Sun Microsystems, Inc. to assist in its use, correction,
  12.  * modification or enhancement.
  13.  *
  14.  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  15.  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
  16.  * OR ANY PART THEREOF.
  17.  *
  18.  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  19.  * or profits or other special, indirect and consequential damages, even if
  20.  * Sun has been advised of the possibility of such damages.
  21.  *
  22.  * Sun Microsystems, Inc.
  23.  * 2550 Garcia Avenue
  24.  * Mountain View, California  94043
  25.  */
  26. /*
  27.  * g72x.h
  28.  *
  29.  * Header file for CCITT conversion routines.
  30.  *
  31.  */
  32. #ifndef _G72X_H
  33. #define _G72X_H
  34. #define AUDIO_ENCODING_ULAW (1) /* ISDN u-law */
  35. #define AUDIO_ENCODING_ALAW (2) /* ISDN A-law */
  36. #define AUDIO_ENCODING_LINEAR (3) /* PCM 2's-complement (0-center) */
  37. /*
  38.  * The following is the definition of the state structure
  39.  * used by the G.721/G.723 encoder and decoder to preserve their internal
  40.  * state between successive calls.  The meanings of the majority
  41.  * of the state structure fields are explained in detail in the
  42.  * CCITT Recommendation G.721.  The field names are essentially indentical
  43.  * to variable names in the bit level description of the coding algorithm
  44.  * included in this Recommendation.
  45.  */
  46. struct g72x_state
  47. {
  48.     long yl;  /* Locked or steady state step size multiplier. */
  49.     short yu;  /* Unlocked or non-steady state step size multiplier. */
  50.     short dms;  /* Short term energy estimate. */
  51.     short dml;  /* Long term energy estimate. */
  52.     short ap;  /* Linear weighting coefficient of 'yl' and 'yu'. */
  53.     short a[2];  /* Coefficients of pole portion of prediction filter. */
  54.     short b[6];  /* Coefficients of zero portion of prediction filter. */
  55.     short pk[2];  /*
  56.       * Signs of previous two samples of a partially
  57.       * reconstructed signal.
  58.       */
  59.     short dq[6];  /*
  60.       * Previous 6 samples of the quantized difference
  61.       * signal represented in an internal floating point
  62.       * format.
  63.       */
  64.     short sr[2];  /*
  65.       * Previous 2 samples of the quantized difference
  66.       * signal represented in an internal floating point
  67.       * format.
  68.       */
  69.     char td;  /* delayed tone detect, new in 1988 version */
  70. };
  71. /* External function definitions. */
  72. extern void g72x_init_stat(struct g72x_state *);
  73. extern int g721_encoder(
  74.         int sample,
  75.         int in_coding,
  76.         struct g72x_state *state_ptr);
  77. extern int g721_decoder(
  78.         int code,
  79.         int out_coding,
  80.         struct g72x_state *state_ptr);
  81. extern int g723_24_encoder(
  82.         int sample,
  83.         int in_coding,
  84.         struct g72x_state *state_ptr);
  85. extern int g723_24_decoder(
  86.         int code,
  87.         int out_coding,
  88.         struct g72x_state *state_ptr);
  89. extern int g723_40_encoder(
  90.         int sample,
  91.         int in_coding,
  92.         struct g72x_state *state_ptr);
  93. extern int g723_40_decoder(
  94.         int code,
  95.         int out_coding,
  96.         struct g72x_state *state_ptr);
  97. #include "g711.h"
  98. #endif /* !_G72X_H */