2 /* -----------------------------------------------------------------------------------------------------------
3 Software License for The Fraunhofer FDK AAC Codec Library for Android
5 © Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
9 The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software that implements
10 the MPEG Advanced Audio Coding ("AAC") encoding and decoding scheme for digital audio.
11 This FDK AAC Codec software is intended to be used on a wide variety of Android devices.
13 AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient general perceptual
14 audio codecs. AAC-ELD is considered the best-performing full-bandwidth communications codec by
15 independent studies and is widely deployed. AAC has been standardized by ISO and IEC as part
16 of the MPEG specifications.
18 Patent licenses for necessary patent claims for the FDK AAC Codec (including those of Fraunhofer)
19 may be obtained through Via Licensing (www.vialicensing.com) or through the respective patent owners
20 individually for the purpose of encoding or decoding bit streams in products that are compliant with
21 the ISO/IEC MPEG audio standards. Please note that most manufacturers of Android devices already license
22 these patent claims through Via Licensing or directly from the patent owners, and therefore FDK AAC Codec
23 software may already be covered under those patent licenses when it is used for those licensed purposes only.
25 Commercially-licensed AAC software libraries, including floating-point versions with enhanced sound quality,
26 are also available from Fraunhofer. Users are encouraged to check the Fraunhofer website for additional
27 applications information and documentation.
31 Redistribution and use in source and binary forms, with or without modification, are permitted without
32 payment of copyright license fees provided that you satisfy the following conditions:
34 You must retain the complete text of this software license in redistributions of the FDK AAC Codec or
35 your modifications thereto in source code form.
37 You must retain the complete text of this software license in the documentation and/or other materials
38 provided with redistributions of the FDK AAC Codec or your modifications thereto in binary form.
39 You must make available free of charge copies of the complete source code of the FDK AAC Codec and your
40 modifications thereto to recipients of copies in binary form.
42 The name of Fraunhofer may not be used to endorse or promote products derived from this library without
43 prior written permission.
45 You may not charge copyright license fees for anyone to use, copy or distribute the FDK AAC Codec
46 software or your modifications thereto.
48 Your modified versions of the FDK AAC Codec must carry prominent notices stating that you changed the software
49 and the date of any change. For modified versions of the FDK AAC Codec, the term
50 "Fraunhofer FDK AAC Codec Library for Android" must be replaced by the term
51 "Third-Party Modified Version of the Fraunhofer FDK AAC Codec Library for Android."
55 NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without limitation the patents of Fraunhofer,
56 ARE GRANTED BY THIS SOFTWARE LICENSE. Fraunhofer provides no warranty of patent non-infringement with
57 respect to this software.
59 You may use this FDK AAC Codec software or modifications thereto only for purposes that are authorized
60 by appropriate patent licenses.
64 This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright holders and contributors
65 "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, including but not limited to the implied warranties
66 of merchantability and fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
67 CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, or consequential damages,
68 including but not limited to procurement of substitute goods or services; loss of use, data, or profits,
69 or business interruption, however caused and on any theory of liability, whether in contract, strict
70 liability, or tort (including negligence), arising in any way out of the use of this software, even if
71 advised of the possibility of such damage.
73 5. CONTACT INFORMATION
75 Fraunhofer Institute for Integrated Circuits IIS
76 Attention: Audio and Multimedia Departments - FDK AAC LL
78 91058 Erlangen, Germany
80 www.iis.fraunhofer.de/amm
81 amm-info@iis.fraunhofer.de
82 ----------------------------------------------------------------------------------------------------------- */
84 /******************************** MPEG Audio Encoder **************************
86 Initial author: M.Werner
87 contents/description: Noiseless coder module
89 ******************************************************************************/
93 #include "psy_const.h"
94 #include "aacenc_pns.h"
95 #include "aacEnc_ram.h"
96 #include "aacEnc_rom.h"
98 typedef INT (*lookUpTable
)[CODE_BOOK_ESC_NDX
+ 1];
100 static INT
FDKaacEnc_getSideInfoBits(
101 const SECTION_INFO
* const huffsection
,
102 const SHORT
* const sideInfoTab
,
108 if ( useHCR
&& ((huffsection
->codeBook
== 11) || (huffsection
->codeBook
>= 16)) ) {
112 sideInfoBits
= sideInfoTab
[huffsection
->sfbCnt
];
115 return (sideInfoBits
);
118 /* count bits using all possible tables */
119 static void FDKaacEnc_buildBitLookUp(
120 const SHORT
* const quantSpectrum
,
122 const INT
* const sfbOffset
,
123 const UINT
* const sfbMax
,
124 INT bitLookUp
[MAX_SFB_LONG
][CODE_BOOK_ESC_NDX
+ 1],
125 SECTION_INFO
* const huffsection
130 for (i
= 0; i
< maxSfb
; i
++)
132 huffsection
[i
].sfbCnt
= 1;
133 huffsection
[i
].sfbStart
= i
;
134 huffsection
[i
].sectionBits
= INVALID_BITCOUNT
;
135 huffsection
[i
].codeBook
= -1;
136 sfbWidth
= sfbOffset
[i
+ 1] - sfbOffset
[i
];
137 FDKaacEnc_bitCount(quantSpectrum
+ sfbOffset
[i
], sfbWidth
, sfbMax
[i
], bitLookUp
[i
]);
141 /* essential helper functions */
142 static INT
FDKaacEnc_findBestBook(
148 INT minBits
= INVALID_BITCOUNT
, j
;
150 int end
= CODE_BOOK_ESC_NDX
;
153 for (j
= 0; j
<= end
; j
++)
164 static INT
FDKaacEnc_findMinMergeBits(
165 const INT
* const bc1
,
166 const INT
* const bc2
,
170 INT minBits
= INVALID_BITCOUNT
, j
;
172 int end
= CODE_BOOK_ESC_NDX
;
175 for (j
= 0; j
<= end
; j
++)
177 if (bc1
[j
] + bc2
[j
] < minBits
)
179 minBits
= bc1
[j
] + bc2
[j
];
185 static void FDKaacEnc_mergeBitLookUp(
192 for (j
= 0; j
<= CODE_BOOK_ESC_NDX
; j
++)
194 bc1
[j
] = fixMin(bc1
[j
] + bc2
[j
], INVALID_BITCOUNT
);
198 static INT
FDKaacEnc_findMaxMerge(
199 const INT
* const mergeGainLookUp
,
200 const SECTION_INFO
* const huffsection
,
205 INT i
, maxMergeGain
= 0;
207 for (i
= 0; i
+ huffsection
[i
].sfbCnt
< maxSfb
; i
+= huffsection
[i
].sfbCnt
)
209 if (mergeGainLookUp
[i
] > maxMergeGain
)
211 maxMergeGain
= mergeGainLookUp
[i
];
215 return (maxMergeGain
);
218 static INT
FDKaacEnc_CalcMergeGain(
219 const SECTION_INFO
* const huffsection
,
220 const INT bitLookUp
[MAX_SFB_LONG
][CODE_BOOK_ESC_NDX
+ 1],
221 const SHORT
* const sideInfoTab
,
227 INT MergeGain
, MergeBits
, SplitBits
;
229 MergeBits
= sideInfoTab
[huffsection
[ndx1
].sfbCnt
+ huffsection
[ndx2
].sfbCnt
] + FDKaacEnc_findMinMergeBits(bitLookUp
[ndx1
], bitLookUp
[ndx2
], useVCB11
);
230 SplitBits
= huffsection
[ndx1
].sectionBits
+ huffsection
[ndx2
].sectionBits
; /* Bit amount for splitted huffsections */
231 MergeGain
= SplitBits
- MergeBits
;
233 if ( (huffsection
[ndx1
].codeBook
==CODE_BOOK_PNS_NO
)||(huffsection
[ndx2
].codeBook
==CODE_BOOK_PNS_NO
)
234 || (huffsection
[ndx1
].codeBook
==CODE_BOOK_IS_OUT_OF_PHASE_NO
)||(huffsection
[ndx2
].codeBook
==CODE_BOOK_IS_OUT_OF_PHASE_NO
)
235 || (huffsection
[ndx1
].codeBook
==CODE_BOOK_IS_IN_PHASE_NO
)||(huffsection
[ndx2
].codeBook
==CODE_BOOK_IS_IN_PHASE_NO
)
245 /* sectioning Stage 0:find minimum codbooks */
246 static void FDKaacEnc_gmStage0(
247 SECTION_INFO
* const RESTRICT huffsection
,
248 const INT bitLookUp
[MAX_SFB_LONG
][CODE_BOOK_ESC_NDX
+ 1],
250 const INT
* const noiseNrg
,
251 const INT
* const isBook
256 for (i
= 0; i
< maxSfb
; i
++)
258 /* Side-Info bits will be calculated in Stage 1! */
259 if (huffsection
[i
].sectionBits
== INVALID_BITCOUNT
)
261 /* intensity and pns codebooks are already allocated in bitcount.c */
262 if(noiseNrg
[i
] != NO_NOISE_PNS
){
263 huffsection
[i
].codeBook
=CODE_BOOK_PNS_NO
;
264 huffsection
[i
].sectionBits
= 0;
266 else if( isBook
[i
] ) {
267 huffsection
[i
].codeBook
=isBook
[i
];
268 huffsection
[i
].sectionBits
= 0;
271 huffsection
[i
].sectionBits
= FDKaacEnc_findBestBook(bitLookUp
[i
], &(huffsection
[i
].codeBook
), 0); /* useVCB11 must be 0!!! */
278 sectioning Stage 1:merge all connected regions with the same code book and
281 static void FDKaacEnc_gmStage1(
282 SECTION_INFO
* const RESTRICT huffsection
,
283 INT bitLookUp
[MAX_SFB_LONG
][CODE_BOOK_ESC_NDX
+ 1],
285 const SHORT
* const sideInfoTab
,
289 INT mergeStart
= 0, mergeEnd
;
293 for (mergeEnd
= mergeStart
+ 1; mergeEnd
< maxSfb
; mergeEnd
++)
295 if (huffsection
[mergeStart
].codeBook
!= huffsection
[mergeEnd
].codeBook
)
299 /* we can merge. update tables, side info bits will be updated outside of this loop */
300 huffsection
[mergeStart
].sfbCnt
++;
301 huffsection
[mergeStart
].sectionBits
+= huffsection
[mergeEnd
].sectionBits
;
303 /* update bit look up for all code books */
304 FDKaacEnc_mergeBitLookUp(bitLookUp
[mergeStart
], bitLookUp
[mergeEnd
]);
307 /* add side info info bits */
308 huffsection
[mergeStart
].sectionBits
+= FDKaacEnc_getSideInfoBits(&huffsection
[mergeStart
], sideInfoTab
, useVCB11
);
309 huffsection
[mergeEnd
- 1].sfbStart
= huffsection
[mergeStart
].sfbStart
; /* speed up prev search */
311 mergeStart
= mergeEnd
;
313 } while (mergeStart
< maxSfb
);
317 sectioning Stage 2:greedy merge algorithm, merge connected sections with
318 maximum bit gain until no more gain is possible
322 SECTION_INFO
* const RESTRICT huffsection
,
323 INT
* const RESTRICT mergeGainLookUp
,
324 INT bitLookUp
[MAX_SFB_LONG
][CODE_BOOK_ESC_NDX
+ 1],
326 const SHORT
* const sideInfoTab
,
332 for (i
= 0; i
+ huffsection
[i
].sfbCnt
< maxSfb
; i
+= huffsection
[i
].sfbCnt
)
334 mergeGainLookUp
[i
] = FDKaacEnc_CalcMergeGain(huffsection
,
338 i
+ huffsection
[i
].sfbCnt
,
344 INT maxMergeGain
, maxNdx
= 0, maxNdxNext
, maxNdxLast
;
346 maxMergeGain
= FDKaacEnc_findMaxMerge(mergeGainLookUp
, huffsection
, maxSfb
, &maxNdx
);
348 /* exit while loop if no more gain is possible */
349 if (maxMergeGain
<= 0)
352 maxNdxNext
= maxNdx
+ huffsection
[maxNdx
].sfbCnt
;
354 /* merge sections with maximum bit gain */
355 huffsection
[maxNdx
].sfbCnt
+= huffsection
[maxNdxNext
].sfbCnt
;
356 huffsection
[maxNdx
].sectionBits
+= huffsection
[maxNdxNext
].sectionBits
- maxMergeGain
;
358 /* update bit look up table for merged huffsection */
359 FDKaacEnc_mergeBitLookUp(bitLookUp
[maxNdx
], bitLookUp
[maxNdxNext
]);
361 /* update mergeLookUpTable */
364 maxNdxLast
= huffsection
[maxNdx
- 1].sfbStart
;
365 mergeGainLookUp
[maxNdxLast
] = FDKaacEnc_CalcMergeGain(huffsection
,
373 maxNdxNext
= maxNdx
+ huffsection
[maxNdx
].sfbCnt
;
375 huffsection
[maxNdxNext
- 1].sfbStart
= huffsection
[maxNdx
].sfbStart
;
377 if (maxNdxNext
< maxSfb
)
378 mergeGainLookUp
[maxNdx
] = FDKaacEnc_CalcMergeGain(huffsection
,
388 /* count bits used by the noiseless coder */
389 static void FDKaacEnc_noiselessCounter(
390 SECTION_DATA
* const RESTRICT sectionData
,
391 INT mergeGainLookUp
[MAX_SFB_LONG
],
392 INT bitLookUp
[MAX_SFB_LONG
][CODE_BOOK_ESC_NDX
+ 1],
393 const SHORT
* const quantSpectrum
,
394 const UINT
* const maxValueInSfb
,
395 const INT
* const sfbOffset
,
397 const INT
* const noiseNrg
,
398 const INT
* const isBook
,
403 const SHORT
*sideInfoTab
= NULL
;
404 SECTION_INFO
*huffsection
;
406 /* use appropriate side info table */
412 sideInfoTab
= FDKaacEnc_sideInfoTabLong
;
415 sideInfoTab
= FDKaacEnc_sideInfoTabShort
;
419 sectionData
->noOfSections
= 0;
420 sectionData
->huffmanBits
= 0;
421 sectionData
->sideInfoBits
= 0;
424 if (sectionData
->maxSfbPerGroup
== 0)
427 /* loop trough groups */
428 for (grpNdx
= 0; grpNdx
< sectionData
->sfbCnt
; grpNdx
+= sectionData
->sfbPerGroup
)
430 huffsection
= sectionData
->huffsection
+ sectionData
->noOfSections
;
432 /* count bits in this group */
433 FDKaacEnc_buildBitLookUp(quantSpectrum
,
434 sectionData
->maxSfbPerGroup
,
436 maxValueInSfb
+ grpNdx
,
440 /* 0.Stage :Find minimum Codebooks */
441 FDKaacEnc_gmStage0(huffsection
, bitLookUp
, sectionData
->maxSfbPerGroup
, noiseNrg
+grpNdx
, isBook
+grpNdx
);
443 /* 1.Stage :Merge all connected regions with the same code book */
444 FDKaacEnc_gmStage1(huffsection
, bitLookUp
, sectionData
->maxSfbPerGroup
, sideInfoTab
, useVCB11
);
449 greedy merge algorithm, merge connected huffsections with maximum bit
450 gain until no more gain is possible
453 FDKaacEnc_gmStage2(huffsection
,
456 sectionData
->maxSfbPerGroup
,
463 compress output, calculate total huff and side bits
464 since we did not update the actual codebook in stage 2
465 to save time, we must set it here for later use in bitenc
468 for (i
= 0; i
< sectionData
->maxSfbPerGroup
; i
+= huffsection
[i
].sfbCnt
)
470 if ((huffsection
[i
].codeBook
==CODE_BOOK_PNS_NO
) ||
471 (huffsection
[i
].codeBook
==CODE_BOOK_IS_OUT_OF_PHASE_NO
) ||
472 (huffsection
[i
].codeBook
==CODE_BOOK_IS_IN_PHASE_NO
))
474 huffsection
[i
].sectionBits
=0;
476 /* the sections in the sectionData are now marked with the optimal code book */
478 FDKaacEnc_findBestBook(bitLookUp
[i
], &(huffsection
[i
].codeBook
), useVCB11
);
480 sectionData
->huffmanBits
+= huffsection
[i
].sectionBits
- FDKaacEnc_getSideInfoBits(&huffsection
[i
], sideInfoTab
, useVCB11
);
483 huffsection
[i
].sfbStart
+= grpNdx
;
485 /* sum up side info bits (section data bits) */
486 sectionData
->sideInfoBits
+= FDKaacEnc_getSideInfoBits(&huffsection
[i
], sideInfoTab
, useVCB11
);
487 sectionData
->huffsection
[sectionData
->noOfSections
++] = huffsection
[i
];
493 /*******************************************************************************
495 functionname: FDKaacEnc_scfCount
497 description : count bits used by scalefactors.
499 not in all cases if maxValueInSfb[] == 0 we set deltaScf
500 to zero. only if the difference of the last and future
501 scalefacGain is not greater then CODE_BOOK_SCF_LAV (60).
518 --- ... ---------------------------- ... --------->
522 if maxValueInSfb[] of current is zero because of a
523 notfallstrategie, we do not save bits and transmit a
524 deltaScf of 25. otherwise the deltaScf between the last
525 scalfacGain (75) and the future scalefacGain (5) is 70.
527 ********************************************************************************/
528 static void FDKaacEnc_scfCount(
529 const INT
* const scalefacGain
,
530 const UINT
* const maxValueInSfb
,
531 SECTION_DATA
* const RESTRICT sectionData
,
532 const INT
* const isScale
540 INT scfSkipCounter
= 0;
543 sectionData
->scalefacBits
= 0;
545 if (scalefacGain
== NULL
)
548 sectionData
->firstScf
= 0;
550 for (i
=0; i
<sectionData
->noOfSections
; i
++)
552 if (sectionData
->huffsection
[i
].codeBook
!= CODE_BOOK_ZERO_NO
)
554 sectionData
->firstScf
= sectionData
->huffsection
[i
].sfbStart
;
555 lastValScf
= scalefacGain
[sectionData
->firstScf
];
560 for (i
=0; i
<sectionData
->noOfSections
; i
++)
562 if ((sectionData
->huffsection
[i
].codeBook
== CODE_BOOK_IS_OUT_OF_PHASE_NO
) ||
563 (sectionData
->huffsection
[i
].codeBook
== CODE_BOOK_IS_IN_PHASE_NO
))
565 for (j
= sectionData
->huffsection
[i
].sfbStart
;
566 j
< sectionData
->huffsection
[i
].sfbStart
+ sectionData
->huffsection
[i
].sfbCnt
;
569 INT deltaIs
= isScale
[j
]-lastValIs
;
570 lastValIs
= isScale
[j
];
571 sectionData
->scalefacBits
+=FDKaacEnc_bitCountScalefactorDelta(deltaIs
);
574 else if ((sectionData
->huffsection
[i
].codeBook
!= CODE_BOOK_ZERO_NO
) &&
575 (sectionData
->huffsection
[i
].codeBook
!= CODE_BOOK_PNS_NO
))
577 INT tmp
= sectionData
->huffsection
[i
].sfbStart
+ sectionData
->huffsection
[i
].sfbCnt
;
578 for (j
= sectionData
->huffsection
[i
].sfbStart
; j
<tmp
; j
++)
580 /* check if we can repeat the last value to save bits */
581 if (maxValueInSfb
[j
] == 0)
584 /* are scalefactors skipped? */
585 if (scfSkipCounter
== 0)
589 found
= 0; /* search in other sections for maxValueInSfb != 0 */
592 /* search in this section for the next maxValueInSfb[] != 0 */
593 for (k
= (j
+1); k
< tmp
; k
++)
595 if (maxValueInSfb
[k
] != 0)
598 if ( (fixp_abs(scalefacGain
[k
] - lastValScf
)) <= CODE_BOOK_SCF_LAV
)
599 deltaScf
= 0; /* save bits */
602 /* do not save bits */
603 deltaScf
= lastValScf
- scalefacGain
[j
];
604 lastValScf
= scalefacGain
[j
];
609 /* count scalefactor skip */
614 /* search for the next maxValueInSfb[] != 0 in all other sections */
615 for (m
=(i
+1); (m
< sectionData
->noOfSections
) && (found
== 0); m
++)
617 if ((sectionData
->huffsection
[m
].codeBook
!= CODE_BOOK_ZERO_NO
) && (sectionData
->huffsection
[m
].codeBook
!= CODE_BOOK_PNS_NO
))
619 INT end
= sectionData
->huffsection
[m
].sfbStart
+ sectionData
->huffsection
[m
].sfbCnt
;
620 for (n
= sectionData
->huffsection
[m
].sfbStart
; n
<end
; n
++)
622 if (maxValueInSfb
[n
] != 0)
625 if (fixp_abs(scalefacGain
[n
] - lastValScf
) <= CODE_BOOK_SCF_LAV
)
626 deltaScf
= 0; /* save bits */
629 /* do not save bits */
630 deltaScf
= lastValScf
- scalefacGain
[j
];
631 lastValScf
= scalefacGain
[j
];
636 /* count scalefactor skip */
641 /* no maxValueInSfb[] != 0 found */
649 /* consider skipped scalefactors */
655 deltaScf
= lastValScf
- scalefacGain
[j
];
656 lastValScf
= scalefacGain
[j
];
658 sectionData
->scalefacBits
+= FDKaacEnc_bitCountScalefactorDelta(deltaScf
);
661 } /* for (i=0; i<sectionData->noOfSections; i++) */
664 #ifdef PNS_PRECOUNT_ENABLE
666 preCount bits used pns
668 /* estimate bits used by pns for correction of static bits */
669 /* no codebook switch estimation, see AAC LD FASTENC */
670 INT
noisePreCount(const INT
*noiseNrg
, INT maxSfb
)
672 INT noisePCMFlag
= TRUE
;
673 INT lastValPns
= 0, deltaPns
;
676 for (i
= 0; i
< maxSfb
; i
++) {
677 if (noiseNrg
[i
] != NO_NOISE_PNS
) {
681 lastValPns
= noiseNrg
[i
];
682 noisePCMFlag
= FALSE
;
684 deltaPns
= noiseNrg
[i
]-lastValPns
;
685 lastValPns
= noiseNrg
[i
];
686 bits
+=FDKaacEnc_bitCountScalefactorDelta(deltaPns
);
692 #endif /* PNS_PRECOUNT_ENABLE */
694 /* count bits used by pns */
695 static void FDKaacEnc_noiseCount(
696 SECTION_DATA
* const RESTRICT sectionData
,
697 const INT
* const noiseNrg
700 INT noisePCMFlag
= TRUE
;
701 INT lastValPns
= 0, deltaPns
;
704 sectionData
->noiseNrgBits
= 0;
706 for (i
= 0; i
< sectionData
->noOfSections
; i
++) {
707 if (sectionData
->huffsection
[i
].codeBook
== CODE_BOOK_PNS_NO
) {
708 int sfbStart
= sectionData
->huffsection
[i
].sfbStart
;
709 int sfbEnd
= sfbStart
+ sectionData
->huffsection
[i
].sfbCnt
;
710 for (j
=sfbStart
; j
<sfbEnd
; j
++) {
713 sectionData
->noiseNrgBits
+=PNS_PCM_BITS
;
714 lastValPns
= noiseNrg
[j
];
715 noisePCMFlag
= FALSE
;
717 deltaPns
= noiseNrg
[j
]-lastValPns
;
718 lastValPns
= noiseNrg
[j
];
719 sectionData
->noiseNrgBits
+=FDKaacEnc_bitCountScalefactorDelta(deltaPns
);
726 INT
FDKaacEnc_dynBitCount(
727 BITCNTR_STATE
* const hBC
,
728 const SHORT
* const quantSpectrum
,
729 const UINT
* const maxValueInSfb
,
730 const INT
* const scalefac
,
733 const INT maxSfbPerGroup
,
734 const INT sfbPerGroup
,
735 const INT
* const sfbOffset
,
736 SECTION_DATA
* const RESTRICT sectionData
,
737 const INT
* const noiseNrg
,
738 const INT
* const isBook
,
739 const INT
* const isScale
,
740 const UINT syntaxFlags
743 sectionData
->blockType
= blockType
;
744 sectionData
->sfbCnt
= sfbCnt
;
745 sectionData
->sfbPerGroup
= sfbPerGroup
;
746 sectionData
->noOfGroups
= sfbCnt
/ sfbPerGroup
;
747 sectionData
->maxSfbPerGroup
= maxSfbPerGroup
;
749 FDKaacEnc_noiselessCounter(
751 hBC
->mergeGainLookUp
,
752 (lookUpTable
)hBC
->bitLookUp
,
759 (syntaxFlags
& AC_ER_VCB11
)?1:0);
767 FDKaacEnc_noiseCount(sectionData
,
770 return (sectionData
->huffmanBits
+
771 sectionData
->sideInfoBits
+
772 sectionData
->scalefacBits
+
773 sectionData
->noiseNrgBits
);
776 INT
FDKaacEnc_BCNew(BITCNTR_STATE
**phBC
780 BITCNTR_STATE
*hBC
= GetRam_aacEnc_BitCntrState();
785 hBC
->bitLookUp
= GetRam_aacEnc_BitLookUp(0,dynamic_RAM
);
786 hBC
->mergeGainLookUp
= GetRam_aacEnc_MergeGainLookUp(0,dynamic_RAM
);
787 if (hBC
->bitLookUp
== 0 ||
788 hBC
->mergeGainLookUp
== 0)
793 return (hBC
== 0) ? 1 : 0;
796 void FDKaacEnc_BCClose(BITCNTR_STATE
**phBC
)
800 FreeRam_aacEnc_BitCntrState(phBC
);