Home | History | Annotate | Download | only in inc
      1 /*
      2  ** Copyright 2003-2010, VisualOn, Inc.
      3  **
      4  ** Licensed under the Apache License, Version 2.0 (the "License");
      5  ** you may not use this file except in compliance with the License.
      6  ** You may obtain a copy of the License at
      7  **
      8  **     http://www.apache.org/licenses/LICENSE-2.0
      9  **
     10  ** Unless required by applicable law or agreed to in writing, software
     11  ** distributed under the License is distributed on an "AS IS" BASIS,
     12  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  ** See the License for the specific language governing permissions and
     14  ** limitations under the License.
     15  */
     16 /*******************************************************************************
     17 	File:		aacenc_core.h
     18 
     19 	Content:	aac encoder interface functions
     20 
     21 *******************************************************************************/
     22 
     23 #ifndef _aacenc_core_h_
     24 #define _aacenc_core_h_
     25 
     26 
     27 #include "typedef.h"
     28 #include "config.h"
     29 #include "bitenc.h"
     30 
     31 #include "psy_configuration.h"
     32 #include "psy_main.h"
     33 #include "qc_main.h"
     34 #include "psy_main.h"
     35 /*-------------------------- defines --------------------------------------*/
     36 
     37 
     38 /*-------------------- structure definitions ------------------------------*/
     39 typedef  struct {
     40   Word32   sampleRate;            /* audio file sample rate */
     41   Word32   bitRate;               /* encoder bit rate in bits/sec */
     42   Word16   nChannelsIn;           /* number of channels on input (1,2) */
     43   Word16   nChannelsOut;          /* number of channels on output (1,2) */
     44   Word16   bandWidth;             /* targeted audio bandwidth in Hz */
     45   Word16   adtsUsed;			  /* whether write adts header */
     46 } AACENC_CONFIG;
     47 
     48 
     49 typedef struct {
     50 
     51   AACENC_CONFIG config;     /* Word16 size: 8 */
     52 
     53   ELEMENT_INFO elInfo;      /* Word16 size: 4 */
     54 
     55   QC_STATE qcKernel;        /* Word16 size: 6 + 5(PADDING) + 7(ELEMENT_BITS) + 54(ADJ_THR_STATE) = 72 */
     56   QC_OUT   qcOut;           /* Word16 size: MAX_CHANNELS*920(QC_OUT_CHANNEL) + 5(QC_OUT_ELEMENT) + 7 = 932 / 1852 */
     57 
     58   PSY_OUT    psyOut;        /* Word16 size: MAX_CHANNELS*186 + 2 = 188 / 374 */
     59   PSY_KERNEL psyKernel;     /* Word16 size:  2587 / 4491 */
     60 
     61   struct BITSTREAMENCODER_INIT bseInit; /* Word16 size: 6 */
     62   struct BIT_BUF  bitStream;            /* Word16 size: 8 */
     63   HANDLE_BIT_BUF  hBitStream;
     64   int			  initOK;
     65 
     66   short			*intbuf;
     67   short			*encbuf;
     68   short			*inbuf;
     69   int			enclen;
     70   int			inlen;
     71   int			intlen;
     72   int			uselength;
     73 
     74   void			*hCheck;
     75   VO_MEM_OPERATOR *voMemop;
     76   VO_MEM_OPERATOR voMemoprator;
     77 
     78 }AAC_ENCODER; /* Word16 size: 3809 / 6851 */
     79 
     80 /*-----------------------------------------------------------------------------
     81 
     82 functionname: AacInitDefaultConfig
     83 description:  gives reasonable default configuration
     84 returns:      ---
     85 
     86 ------------------------------------------------------------------------------*/
     87 void AacInitDefaultConfig(AACENC_CONFIG *config);
     88 
     89 /*---------------------------------------------------------------------------
     90 
     91 functionname:AacEncOpen
     92 description: allocate and initialize a new encoder instance
     93 returns:     AACENC_OK if success
     94 
     95 ---------------------------------------------------------------------------*/
     96 
     97 Word16  AacEncOpen (AAC_ENCODER				*hAacEnc,       /* pointer to an encoder handle, initialized on return */
     98                     const  AACENC_CONFIG     config);        /* pre-initialized config struct */
     99 
    100 Word16 AacEncEncode(AAC_ENCODER		   *hAacEnc,
    101                     Word16             *timeSignal,
    102                     const UWord8       *ancBytes,      /*!< pointer to ancillary data bytes */
    103                     Word16             *numAncBytes,   /*!< number of ancillary Data Bytes, send as fill element  */
    104                     UWord8             *outBytes,      /*!< pointer to output buffer            */
    105                     VO_U32             *numOutBytes    /*!< number of bytes in output buffer */
    106                     );
    107 
    108 /*---------------------------------------------------------------------------
    109 
    110 functionname:AacEncClose
    111 description: deallocate an encoder instance
    112 
    113 ---------------------------------------------------------------------------*/
    114 
    115 void AacEncClose (AAC_ENCODER* hAacEnc, VO_MEM_OPERATOR *pMemOP); /* an encoder handle */
    116 
    117 #endif /* _aacenc_h_ */
    118