aacdec.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /* ***** BEGIN LICENSE BLOCK *****
  2. * Source last modified: $Id: aacdec.h,v 1.8 2005/11/10 00:15:08 margotm Exp $
  3. *
  4. * Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved.
  5. *
  6. * The contents of this file, and the files included with this file,
  7. * are subject to the current version of the RealNetworks Public
  8. * Source License (the "RPSL") available at
  9. * http://www.helixcommunity.org/content/rpsl unless you have licensed
  10. * the file under the current version of the RealNetworks Community
  11. * Source License (the "RCSL") available at
  12. * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
  13. * will apply. You may also obtain the license terms directly from
  14. * RealNetworks. You may not use this file except in compliance with
  15. * the RPSL or, if you have a valid RCSL with RealNetworks applicable
  16. * to this file, the RCSL. Please see the applicable RPSL or RCSL for
  17. * the rights, obligations and limitations governing use of the
  18. * contents of the file.
  19. *
  20. * This file is part of the Helix DNA Technology. RealNetworks is the
  21. * developer of the Original Code and owns the copyrights in the
  22. * portions it created.
  23. *
  24. * This file, and the files included with this file, is distributed
  25. * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
  26. * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
  27. * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
  28. * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
  29. * ENJOYMENT OR NON-INFRINGEMENT.
  30. *
  31. * Technology Compatibility Kit Test Suite(s) Location:
  32. * http://www.helixcommunity.org/content/tck
  33. *
  34. * Contributor(s):
  35. *
  36. * ***** END LICENSE BLOCK ***** */
  37. /**************************************************************************************
  38. * Fixed-point HE-AAC decoder
  39. * Jon Recker (jrecker@real.com)
  40. * February 2005
  41. *
  42. * aacdec.h - public C API for AAC decoder
  43. **************************************************************************************/
  44. #ifndef _AACDEC_H
  45. #define _AACDEC_H
  46. #if defined(_WIN32) && !defined(_WIN32_WCE)
  47. #
  48. #elif defined(_WIN32) && defined(_WIN32_WCE) && defined(ARM)
  49. #
  50. #elif defined(_WIN32) && defined(WINCE_EMULATOR)
  51. #
  52. #elif defined (__arm) && defined (__ARMCC_VERSION)
  53. #
  54. #elif defined(_SYMBIAN) && defined(__WINS__)
  55. #
  56. #elif defined(__GNUC__) && defined(__arm__)
  57. #
  58. #elif defined(__GNUC__) && defined(__i386__)
  59. #
  60. #elif defined(__GNUC__) && defined(__amd64__)
  61. #
  62. #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__POWERPC__))
  63. #
  64. #elif defined(_OPENWAVE_SIMULATOR) || defined(_OPENWAVE_ARMULATOR)
  65. #
  66. #elif defined(_SOLARIS) && !defined(__GNUC__)
  67. #
  68. #elif defined(__XTENSA__)
  69. #
  70. #else
  71. #error No platform defined. See valid options in aacdec.h
  72. #endif
  73. #ifndef USE_DEFAULT_STDLIB
  74. #define USE_DEFAULT_STDLIB
  75. #endif
  76. #ifdef __cplusplus
  77. extern "C" {
  78. #endif
  79. /* according to spec (13818-7 section 8.2.2, 14496-3 section 4.5.3)
  80. * max size of input buffer =
  81. * 6144 bits = 768 bytes per SCE or CCE-I
  82. * 12288 bits = 1536 bytes per CPE
  83. * 0 bits = 0 bytes per CCE-D (uses bits from the SCE/CPE/CCE-I it is coupled to)
  84. */
  85. #ifndef AAC_MAX_NCHANS /* if max channels isn't set in makefile, */
  86. #define AAC_MAX_NCHANS 2 /* set to default max number of channels */
  87. #endif
  88. #define AAC_MAX_NSAMPS 1024
  89. #define AAC_MAINBUF_SIZE (768 * AAC_MAX_NCHANS)
  90. #define AAC_NUM_PROFILES 3
  91. #define AAC_PROFILE_MP 0
  92. #define AAC_PROFILE_LC 1
  93. #define AAC_PROFILE_SSR 2
  94. /* define these to enable decoder features */
  95. #if defined(HELIX_FEATURE_AUDIO_CODEC_AAC_SBR)
  96. #define AAC_ENABLE_SBR
  97. #endif // HELIX_FEATURE_AUDIO_CODEC_AAC_SBR.
  98. #define AAC_ENABLE_MPEG4
  99. enum {
  100. ERR_AAC_NONE = 0,
  101. ERR_AAC_INDATA_UNDERFLOW = -1,
  102. ERR_AAC_NULL_POINTER = -2,
  103. ERR_AAC_INVALID_ADTS_HEADER = -3,
  104. ERR_AAC_INVALID_ADIF_HEADER = -4,
  105. ERR_AAC_INVALID_FRAME = -5,
  106. ERR_AAC_MPEG4_UNSUPPORTED = -6,
  107. ERR_AAC_CHANNEL_MAP = -7,
  108. ERR_AAC_SYNTAX_ELEMENT = -8,
  109. ERR_AAC_DEQUANT = -9,
  110. ERR_AAC_STEREO_PROCESS = -10,
  111. ERR_AAC_PNS = -11,
  112. ERR_AAC_SHORT_BLOCK_DEINT = -12,
  113. ERR_AAC_TNS = -13,
  114. ERR_AAC_IMDCT = -14,
  115. ERR_AAC_NCHANS_TOO_HIGH = -15,
  116. ERR_AAC_SBR_INIT = -16,
  117. ERR_AAC_SBR_BITSTREAM = -17,
  118. ERR_AAC_SBR_DATA = -18,
  119. ERR_AAC_SBR_PCM_FORMAT = -19,
  120. ERR_AAC_SBR_NCHANS_TOO_HIGH = -20,
  121. ERR_AAC_SBR_SINGLERATE_UNSUPPORTED = -21,
  122. ERR_AAC_RAWBLOCK_PARAMS = -22,
  123. ERR_AAC_UNKNOWN = -9999
  124. };
  125. typedef struct _AACFrameInfo {
  126. int bitRate;
  127. int nChans;
  128. int sampRateCore;
  129. int sampRateOut;
  130. int bitsPerSample;
  131. int outputSamps;
  132. int profile;
  133. int tnsUsed;
  134. int pnsUsed;
  135. } AACFrameInfo;
  136. typedef void *HAACDecoder;
  137. /* public C API */
  138. HAACDecoder AACInitDecoder(void);
  139. HAACDecoder AACInitDecoderPre(void *ptr, int sz);
  140. void AACFreeDecoder(HAACDecoder hAACDecoder);
  141. int AACDecode(HAACDecoder hAACDecoder, unsigned char **inbuf, int *bytesLeft, short *outbuf);
  142. int AACFindSyncWord(unsigned char *buf, int nBytes);
  143. void AACGetLastFrameInfo(HAACDecoder hAACDecoder, AACFrameInfo *aacFrameInfo);
  144. int AACSetRawBlockParams(HAACDecoder hAACDecoder, int copyLast, AACFrameInfo *aacFrameInfo);
  145. int AACFlushCodec(HAACDecoder hAACDecoder);
  146. #ifdef HELIX_CONFIG_AAC_GENERATE_TRIGTABS_FLOAT
  147. int AACInitTrigtabsFloat(void);
  148. void AACFreeTrigtabsFloat(void);
  149. #endif
  150. #ifdef __cplusplus
  151. }
  152. #endif
  153. #endif /* _AACDEC_H */