summaryrefslogtreecommitdiffstats
path: root/libAACenc/src/bit_cnt.h
diff options
context:
space:
mode:
authorDave Burke <daveburke@google.com>2012-04-17 09:51:45 -0700
committerDave Burke <daveburke@google.com>2012-04-17 23:04:43 -0700
commit9bf37cc9712506b2483650c82d3c41152337ef7e (patch)
tree77db44e2bae06e3d144b255628be2b7a55c581d3 /libAACenc/src/bit_cnt.h
parenta37315fe10ee143d6d0b28c19d41a476a23e63ea (diff)
downloadODR-AudioEnc-9bf37cc9712506b2483650c82d3c41152337ef7e.tar.gz
ODR-AudioEnc-9bf37cc9712506b2483650c82d3c41152337ef7e.tar.bz2
ODR-AudioEnc-9bf37cc9712506b2483650c82d3c41152337ef7e.zip
Fraunhofer AAC codec.
License boilerplate update to follow. Change-Id: I2810460c11a58b6d148d84673cc031f3685e79b5
Diffstat (limited to 'libAACenc/src/bit_cnt.h')
-rw-r--r--libAACenc/src/bit_cnt.h124
1 files changed, 124 insertions, 0 deletions
diff --git a/libAACenc/src/bit_cnt.h b/libAACenc/src/bit_cnt.h
new file mode 100644
index 0000000..6baf7df
--- /dev/null
+++ b/libAACenc/src/bit_cnt.h
@@ -0,0 +1,124 @@
+/******************************** MPEG Audio Encoder **************************
+
+ (C) Copyright Fraunhofer IIS (1999)
+ All Rights Reserved
+
+ Please be advised that this software and/or program delivery is
+ Confidential Information of Fraunhofer and subject to and covered by the
+
+ Fraunhofer IIS Software Evaluation Agreement
+ between Google Inc. and Fraunhofer
+ effective and in full force since March 1, 2012.
+
+ You may use this software and/or program only under the terms and
+ conditions described in the above mentioned Fraunhofer IIS Software
+ Evaluation Agreement. Any other and/or further use requires a separate agreement.
+
+
+ This software and/or program is protected by copyright law and international
+ treaties. Any reproduction or distribution of this software and/or program,
+ or any portion of it, may result in severe civil and criminal penalties, and
+ will be prosecuted to the maximum extent possible under law.
+
+ $Id$
+ Initial author: M.Werner
+ contents/description: Huffman Bitcounter & coder
+
+******************************************************************************/
+#ifndef __BITCOUNT_H
+#define __BITCOUNT_H
+
+
+#include "common_fix.h"
+#include "FDK_bitstream.h"
+#include "aacEnc_rom.h"
+
+#define INVALID_BITCOUNT (FDK_INT_MAX/4)
+
+/*
+ code book number table
+*/
+
+enum codeBookNo{
+ CODE_BOOK_ZERO_NO= 0,
+ CODE_BOOK_1_NO= 1,
+ CODE_BOOK_2_NO= 2,
+ CODE_BOOK_3_NO= 3,
+ CODE_BOOK_4_NO= 4,
+ CODE_BOOK_5_NO= 5,
+ CODE_BOOK_6_NO= 6,
+ CODE_BOOK_7_NO= 7,
+ CODE_BOOK_8_NO= 8,
+ CODE_BOOK_9_NO= 9,
+ CODE_BOOK_10_NO= 10,
+ CODE_BOOK_ESC_NO= 11,
+ CODE_BOOK_RES_NO= 12,
+ CODE_BOOK_PNS_NO= 13,
+ CODE_BOOK_IS_OUT_OF_PHASE_NO= 14,
+ CODE_BOOK_IS_IN_PHASE_NO= 15
+
+};
+
+/*
+ code book index table
+*/
+
+enum codeBookNdx{
+ CODE_BOOK_ZERO_NDX,
+ CODE_BOOK_1_NDX,
+ CODE_BOOK_2_NDX,
+ CODE_BOOK_3_NDX,
+ CODE_BOOK_4_NDX,
+ CODE_BOOK_5_NDX,
+ CODE_BOOK_6_NDX,
+ CODE_BOOK_7_NDX,
+ CODE_BOOK_8_NDX,
+ CODE_BOOK_9_NDX,
+ CODE_BOOK_10_NDX,
+ CODE_BOOK_ESC_NDX,
+ CODE_BOOK_RES_NDX,
+ CODE_BOOK_PNS_NDX,
+ CODE_BOOK_IS_OUT_OF_PHASE_NDX,
+ CODE_BOOK_IS_IN_PHASE_NDX,
+ NUMBER_OF_CODE_BOOKS
+};
+
+/*
+ code book lav table
+*/
+
+enum codeBookLav{
+ CODE_BOOK_ZERO_LAV=0,
+ CODE_BOOK_1_LAV=1,
+ CODE_BOOK_2_LAV=1,
+ CODE_BOOK_3_LAV=2,
+ CODE_BOOK_4_LAV=2,
+ CODE_BOOK_5_LAV=4,
+ CODE_BOOK_6_LAV=4,
+ CODE_BOOK_7_LAV=7,
+ CODE_BOOK_8_LAV=7,
+ CODE_BOOK_9_LAV=12,
+ CODE_BOOK_10_LAV=12,
+ CODE_BOOK_ESC_LAV=16,
+ CODE_BOOK_SCF_LAV=60,
+ CODE_BOOK_PNS_LAV=60
+ };
+
+INT FDKaacEnc_bitCount(const SHORT *aQuantSpectrum,
+ const INT noOfSpecLines,
+ INT maxVal,
+ INT *bitCountLut);
+
+INT FDKaacEnc_countValues(SHORT *values, INT width, INT codeBook);
+
+INT FDKaacEnc_codeValues(SHORT *values, INT width, INT codeBook, HANDLE_FDK_BITSTREAM hBitstream);
+
+INT FDKaacEnc_codeScalefactorDelta(INT scalefactor, HANDLE_FDK_BITSTREAM hBitstream);
+
+inline INT FDKaacEnc_bitCountScalefactorDelta(const INT delta)
+{
+ FDK_ASSERT( (0 <= (delta+CODE_BOOK_SCF_LAV)) && ((delta+CODE_BOOK_SCF_LAV)<(int)(sizeof(FDKaacEnc_huff_ltabscf)/sizeof((FDKaacEnc_huff_ltabscf[0])))) );
+ return((INT)FDKaacEnc_huff_ltabscf[delta+CODE_BOOK_SCF_LAV]);
+}
+
+#endif