Projects
Staging
fdk-aac
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 3
View file
fdk-aac.changes
Changed
@@ -1,4 +1,13 @@ ------------------------------------------------------------------- +Tue Mar 24 17:47:21 UTC 2020 - Bjørn Lie <zaitor@opensuse.org> + +- Update to version 2.0.1: + * Minor release with a number of crash/fuzz fixes, primarily for + the decoder. +- Modernize spec, replace gcc-c++ with generic c++_compiler + BuildRequires, use current macros. + +------------------------------------------------------------------- Sat Aug 10 14:05:45 UTC 2019 - Luigi Baldoni <aloisio@gmx.com> - Update to version 2.0.0
View file
fdk-aac.spec
Changed
@@ -18,15 +18,15 @@ %define _sover 2 Name: fdk-aac -Version: 2.0.0 +Version: 2.0.1 Release: 0 Summary: A standalone library of the Fraunhofer FDK AAC code from Android License: NonFree -Group: System/Libraries URL: https://github.com/mstorsjo/fdk-aac -Source0: https://github.com/mstorsjo/fdk-aac/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source0: %{url}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Source1: baselibs.conf -BuildRequires: gcc-c++ + +BuildRequires: c++_compiler BuildRequires: libtool BuildRequires: pkgconfig @@ -38,7 +38,6 @@ %package -n libfdk-aac%{_sover} Summary: A standalone library of the Fraunhofer FDK AAC code from Android -Group: System/Libraries %description -n libfdk-aac%{_sover} A standalone library of the Fraunhofer FDK AAC code from Android @@ -48,19 +47,19 @@ %package devel Summary: Development headers for Fraunhofer FDK AAC -Group: Development/Libraries/C and C++ Requires: libfdk-aac%{_sover} = %{version} %description devel This package provides development headers for Fraunhofer FDK AAC code %prep -%setup -q +%autosetup -p1 %build NOCONFIGURE=1 ./autogen.sh -%configure --disable-static -make %{?_smp_mflags} +%configure \ + --disable-static +%make_build %install %make_install @@ -70,10 +69,11 @@ %postun -n libfdk-aac%{_sover} -p /sbin/ldconfig %files -n libfdk-aac%{_sover} -%doc ChangeLog NOTICE +%license NOTICE %{_libdir}/libfdk-aac.so.* %files devel +%doc ChangeLog %{_includedir}/fdk-aac %{_libdir}/libfdk-aac.so %{_libdir}/pkgconfig/fdk-aac.pc
View file
fdk-aac-2.0.0.tar.gz/libFDK/src/arm/dct_arm.cpp
Deleted
@@ -1,572 +0,0 @@ -/* ----------------------------------------------------------------------------- -Software License for The Fraunhofer FDK AAC Codec Library for Android - -© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten -Forschung e.V. All rights reserved. - - 1. INTRODUCTION -The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software -that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding -scheme for digital audio. This FDK AAC Codec software is intended to be used on -a wide variety of Android devices. - -AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient -general perceptual audio codecs. AAC-ELD is considered the best-performing -full-bandwidth communications codec by independent studies and is widely -deployed. AAC has been standardized by ISO and IEC as part of the MPEG -specifications. - -Patent licenses for necessary patent claims for the FDK AAC Codec (including -those of Fraunhofer) may be obtained through Via Licensing -(www.vialicensing.com) or through the respective patent owners individually for -the purpose of encoding or decoding bit streams in products that are compliant -with the ISO/IEC MPEG audio standards. Please note that most manufacturers of -Android devices already license these patent claims through Via Licensing or -directly from the patent owners, and therefore FDK AAC Codec software may -already be covered under those patent licenses when it is used for those -licensed purposes only. - -Commercially-licensed AAC software libraries, including floating-point versions -with enhanced sound quality, are also available from Fraunhofer. Users are -encouraged to check the Fraunhofer website for additional applications -information and documentation. - -2. COPYRIGHT LICENSE - -Redistribution and use in source and binary forms, with or without modification, -are permitted without payment of copyright license fees provided that you -satisfy the following conditions: - -You must retain the complete text of this software license in redistributions of -the FDK AAC Codec or your modifications thereto in source code form. - -You must retain the complete text of this software license in the documentation -and/or other materials provided with redistributions of the FDK AAC Codec or -your modifications thereto in binary form. You must make available free of -charge copies of the complete source code of the FDK AAC Codec and your -modifications thereto to recipients of copies in binary form. - -The name of Fraunhofer may not be used to endorse or promote products derived -from this library without prior written permission. - -You may not charge copyright license fees for anyone to use, copy or distribute -the FDK AAC Codec software or your modifications thereto. - -Your modified versions of the FDK AAC Codec must carry prominent notices stating -that you changed the software and the date of any change. For modified versions -of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android" -must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK -AAC Codec Library for Android." - -3. NO PATENT LICENSE - -NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without -limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE. -Fraunhofer provides no warranty of patent non-infringement with respect to this -software. - -You may use this FDK AAC Codec software or modifications thereto only for -purposes that are authorized by appropriate patent licenses. - -4. DISCLAIMER - -This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright -holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, -including but not limited to the implied warranties of merchantability and -fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, -or consequential damages, including but not limited to procurement of substitute -goods or services; loss of use, data, or profits, or business interruption, -however caused and on any theory of liability, whether in contract, strict -liability, or tort (including negligence), arising in any way out of the use of -this software, even if advised of the possibility of such damage. - -5. CONTACT INFORMATION - -Fraunhofer Institute for Integrated Circuits IIS -Attention: Audio and Multimedia Departments - FDK AAC LL -Am Wolfsmantel 33 -91058 Erlangen, Germany - -www.iis.fraunhofer.de/amm -amm-info@iis.fraunhofer.de ------------------------------------------------------------------------------ */ - -/******************* Library for basic calculation routines ******************** - - Author(s): - - Description: - -*******************************************************************************/ - -#ifdef FUNCTION_dct_IV_func1 - -/* - Note: This assembler routine is here, because the ARM926 compiler does - not encode the inline assembler with optimal speed. - With this version, we save 2 cycles per loop iteration. -*/ - -__asm void dct_IV_func1(int i, const FIXP_SPK *twiddle, - FIXP_DBL *RESTRICT pDat_0, FIXP_DBL *RESTRICT pDat_1) { - /* Register map: - r0 i - r1 twiddle - r2 pDat_0 - r3 pDat_1 - r4 accu1 - r5 accu2 - r6 accu3 - r7 accu4 - r8 val_tw - r9 accuX - */ - PUSH{r4 - r9} - - /* 44 cycles for 2 iterations = 22 cycles/iteration */ - dct_IV_loop1_start - /* First iteration */ - LDR r8, - [r1], -# 4 // val_tw = *twiddle++; - LDR r5, - [ r2, #0 ] // accu2 = pDat_0[0] - LDR r4, - [ r3, #0 ] // accu1 = pDat_1[0] - - SMULWT r9, - r5, - r8 // accuX = accu2*val_tw.l - SMULWB r5, - r5, - r8 // accu2 = accu2*val_tw.h - RSB r9, - r9, -# 0 // accuX =-accu2*val_tw.l - SMLAWT r5, r4, r8, - r5 // accu2 = accu2*val_tw.h + accu1*val_tw.l - SMLAWB r4, - r4, r8, - r9 // accu1 = accu1*val_tw.h - accu2*val_tw.l - - LDR r8, - [r1], -# 4 // val_tw = *twiddle++; - LDR r7, - [ r3, # - 4 ] // accu4 = pDat_1[-1] - LDR r6, - [ r2, #4 ] // accu3 = pDat_0[1] - - SMULWB r9, - r7, - r8 // accuX = accu4*val_tw.h - SMULWT r7, - r7, - r8 // accu4 = accu4*val_tw.l - RSB r9, - r9, -# 0 // accuX =-accu4*val_tw.h - SMLAWB r7, r6, r8, - r7 // accu4 = accu4*val_tw.l+accu3*val_tw.h - SMLAWT r6, - r6, r8, - r9 // accu3 = accu3*val_tw.l-accu4*val_tw.h - - STR r5, - [r2], -# 4 // *pDat_0++ = accu2 - STR r4, [r2], -# 4 // *pDat_0++ = accu1 - STR r6, [r3], -#- 4 // *pDat_1-- = accu3 - STR r7, [r3], -#- 4 // *pDat_1-- = accu4 - - /* Second iteration */ - LDR r8, [r1], -# 4 // val_tw = *twiddle++; - LDR r5, - [ r2, #0 ] // accu2 = pDat_0[0] - LDR r4, - [ r3, #0 ] // accu1 = pDat_1[0] - - SMULWT r9, - r5, - r8 // accuX = accu2*val_tw.l - SMULWB r5, - r5, - r8 // accu2 = accu2*val_tw.h
View file
fdk-aac-2.0.0.tar.gz/Android.bp -> fdk-aac-2.0.1.tar.gz/Android.bp
Changed
@@ -25,9 +25,16 @@ "-Wno-implicit-fallthrough", ], sanitize: { - misc_undefined:["unsigned-integer-overflow", "signed-integer-overflow"], + misc_undefined:[ + "unsigned-integer-overflow", + "signed-integer-overflow", + "bounds", + ], cfi: true, }, + shared_libs: [ + "liblog", + ], export_include_dirs: [ "libAACdec/include", "libAACenc/include",
View file
fdk-aac-2.0.0.tar.gz/ChangeLog -> fdk-aac-2.0.1.tar.gz/ChangeLog
Changed
@@ -1,3 +1,6 @@ +2.0.1 + - Minor release with a number of crash/fuzz fixes, primarily for the decoder + 2.0.0 - Major update in the upstream source base, with support for new profiles and features, and numerous crash/fuzz fixes. The new
View file
fdk-aac-2.0.0.tar.gz/Makefile.vc -> fdk-aac-2.0.1.tar.gz/Makefile.vc
Changed
@@ -6,8 +6,6 @@ # Installing: nmake -f Makefile.vc prefix=\path\to\x install # -VERSION=0.1.5 - # Linker and librarian commands LD = link AR = lib
View file
fdk-aac-2.0.0.tar.gz/configure.ac -> fdk-aac-2.0.1.tar.gz/configure.ac
Changed
@@ -1,7 +1,7 @@ dnl -*- Autoconf -*- dnl Process this file with autoconf to produce a configure script. -AC_INIT([fdk-aac], [2.0.0], [http://sourceforge.net/projects/opencore-amr/]) +AC_INIT([fdk-aac], [2.0.1], [http://sourceforge.net/projects/opencore-amr/]) AC_CONFIG_AUX_DIR(.) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([tar-ustar foreign]) @@ -26,7 +26,7 @@ dnl soname version to use dnl goes by ‘current[:revision[:age]]’ with the soname ending up as dnl current.age.revision -FDK_AAC_VERSION=2:0:0 +FDK_AAC_VERSION=2:1:0 AS_IF([test x$enable_shared = xyes], [LIBS_PRIVATE=$LIBS], [LIBS_PUBLIC=$LIBS]) AC_SUBST(FDK_AAC_VERSION)
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/aacdec_hcr.cpp -> fdk-aac-2.0.1.tar.gz/libAACdec/src/aacdec_hcr.cpp
Changed
@@ -134,17 +134,18 @@ USHORT *pNumExtendedSortedSectionsInSets, int numExtendedSortedSectionsInSetsIdx); -static INT DecodeEscapeSequence(HANDLE_FDK_BITSTREAM bs, INT quantSpecCoef, - INT *pLeftStartOfSegment, +static INT DecodeEscapeSequence(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor, + INT quantSpecCoef, INT *pLeftStartOfSegment, SCHAR *pRemainingBitsInSegment, int *pNumDecodedBits); -static int DecodePCW_Sign(HANDLE_FDK_BITSTREAM bs, UINT codebookDim, - const SCHAR *pQuantVal, FIXP_DBL *pQuantSpecCoef, - int *quantSpecCoefIdx, INT *pLeftStartOfSegment, +static int DecodePCW_Sign(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor, + UINT codebookDim, const SCHAR *pQuantVal, + FIXP_DBL *pQuantSpecCoef, int *quantSpecCoefIdx, + INT *pLeftStartOfSegment, SCHAR *pRemainingBitsInSegment, int *pNumDecodedBits); -static const SCHAR *DecodePCW_Body(HANDLE_FDK_BITSTREAM bs, +static const SCHAR *DecodePCW_Body(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor, const UINT *pCurrentTree, const SCHAR *pQuantValBase, INT *pLeftStartOfSegment, @@ -291,7 +292,7 @@ SPEC_LONG(pAacDecoderChannelInfo->pSpectralCoefficient); FDKsyncCache(bs); - pHcr->decInOut.bitstreamIndex = FDKgetBitCnt(bs); + pHcr->decInOut.bitstreamAnchor = (INT)FDKgetValidBits(bs); if (!IsLongBlock(&pAacDecoderChannelInfo->icsInfo)) /* short block */ { @@ -436,7 +437,7 @@ int pTmp5; INT bitCntOffst; - INT saveBitCnt = FDKgetBitCnt(bs); /* save bitstream position */ + INT saveBitCnt = (INT)FDKgetValidBits(bs); /* save bitstream position */ HcrCalcNumCodeword(pHcr); @@ -487,7 +488,7 @@ pSamplingRateInfo); /* restore bitstream position */ - bitCntOffst = saveBitCnt - FDKgetBitCnt(bs); + bitCntOffst = (INT)FDKgetValidBits(bs) - saveBitCnt; if (bitCntOffst) { FDKpushBiDirectional(bs, bitCntOffst); } @@ -815,7 +816,6 @@ INT *pLeftStartOfSegment = pHcr->segmentInfo.pLeftStartOfSegment; INT *pRightStartOfSegment = pHcr->segmentInfo.pRightStartOfSegment; SCHAR *pRemainingBitsInSegment = pHcr->segmentInfo.pRemainingBitsInSegment; - INT bitstreamIndex = pHcr->decInOut.bitstreamIndex; const UCHAR *pMaxCwLength = aMaxCwLen; for (i = numSortedSection; i != 0; i--) { @@ -825,7 +825,7 @@ for (j = *pNumSortedCodewordInSection; j != 0; j--) { /* width allows a new segment */ - intermediateResult = bitstreamIndex + segmentStart; + intermediateResult = segmentStart; if ((segmentStart + segmentWidth) <= lengthOfReorderedSpectralData) { /* store segment start, segment length and increment the number of * segments */ @@ -841,12 +841,11 @@ pLeftStartOfSegment--; pRightStartOfSegment--; pRemainingBitsInSegment--; - segmentStart = *pLeftStartOfSegment - bitstreamIndex; + segmentStart = *pLeftStartOfSegment; lastSegmentWidth = lengthOfReorderedSpectralData - segmentStart; *pRemainingBitsInSegment = lastSegmentWidth; - *pRightStartOfSegment = - bitstreamIndex + segmentStart + lastSegmentWidth - 1; + *pRightStartOfSegment = segmentStart + lastSegmentWidth - 1; endFlag = 1; break; } @@ -1071,9 +1070,9 @@ numDecodedBits = 0; /* decode PCW_BODY */ - pQuantVal = - DecodePCW_Body(bs, pCurrentTree, pQuantValBase, pLeftStartOfSegment, - pRemainingBitsInSegment, &numDecodedBits); + pQuantVal = DecodePCW_Body( + bs, pHcr->decInOut.bitstreamAnchor, pCurrentTree, pQuantValBase, + pLeftStartOfSegment, pRemainingBitsInSegment, &numDecodedBits); /* result is written out here because NO sign bits follow the body */ for (i = dimension; i != 0; i--) { @@ -1115,14 +1114,14 @@ int err; numDecodedBits = 0; - pQuantVal = - DecodePCW_Body(bs, pCurrentTree, pQuantValBase, pLeftStartOfSegment, - pRemainingBitsInSegment, &numDecodedBits); + pQuantVal = DecodePCW_Body( + bs, pHcr->decInOut.bitstreamAnchor, pCurrentTree, pQuantValBase, + pLeftStartOfSegment, pRemainingBitsInSegment, &numDecodedBits); err = DecodePCW_Sign( - bs, dimension, pQuantVal, pQuantizedSpectralCoefficients, - &quantizedSpectralCoefficientsIdx, pLeftStartOfSegment, - pRemainingBitsInSegment, &numDecodedBits); + bs, pHcr->decInOut.bitstreamAnchor, dimension, pQuantVal, + pQuantizedSpectralCoefficients, &quantizedSpectralCoefficientsIdx, + pLeftStartOfSegment, pRemainingBitsInSegment, &numDecodedBits); if (err != 0) { return; } @@ -1157,14 +1156,14 @@ numDecodedBits = 0; /* decode PCW_BODY */ - pQuantVal = - DecodePCW_Body(bs, pCurrentTree, pQuantValBase, pLeftStartOfSegment, - pRemainingBitsInSegment, &numDecodedBits); + pQuantVal = DecodePCW_Body( + bs, pHcr->decInOut.bitstreamAnchor, pCurrentTree, pQuantValBase, + pLeftStartOfSegment, pRemainingBitsInSegment, &numDecodedBits); err = DecodePCW_Sign( - bs, dimension, pQuantVal, pQuantizedSpectralCoefficients, - &quantizedSpectralCoefficientsIdx, pLeftStartOfSegment, - pRemainingBitsInSegment, &numDecodedBits); + bs, pHcr->decInOut.bitstreamAnchor, dimension, pQuantVal, + pQuantizedSpectralCoefficients, &quantizedSpectralCoefficientsIdx, + pLeftStartOfSegment, pRemainingBitsInSegment, &numDecodedBits); if (err != 0) { return; } @@ -1177,7 +1176,7 @@ (FIXP_DBL)ESCAPE_VALUE) { pQuantizedSpectralCoefficients[quantizedSpectralCoefficientsIdx] = (FIXP_DBL)DecodeEscapeSequence( - bs, + bs, pHcr->decInOut.bitstreamAnchor, pQuantizedSpectralCoefficients [quantizedSpectralCoefficientsIdx], pLeftStartOfSegment, pRemainingBitsInSegment, @@ -1193,7 +1192,7 @@ (FIXP_DBL)ESCAPE_VALUE) { pQuantizedSpectralCoefficients[quantizedSpectralCoefficientsIdx] = (FIXP_DBL)DecodeEscapeSequence( - bs, + bs, pHcr->decInOut.bitstreamAnchor, pQuantizedSpectralCoefficients [quantizedSpectralCoefficientsIdx], pLeftStartOfSegment, pRemainingBitsInSegment, @@ -1331,7 +1330,7 @@ spectral coefficients -------------------------------------------------------------------------------------------- */ -static const SCHAR *DecodePCW_Body(HANDLE_FDK_BITSTREAM bs, +static const SCHAR *DecodePCW_Body(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor, const UINT *pCurrentTree, const SCHAR *pQuantValBase, INT *pLeftStartOfSegment, @@ -1349,7 +1348,7 @@ /* decode whole PCW-codeword-body */ while (1) { - carryBit = HcrGetABitFromBitstream(bs, pLeftStartOfSegment, + carryBit = HcrGetABitFromBitstream(bs, bsAnchor, pLeftStartOfSegment, pLeftStartOfSegment, /* dummy */ FROM_LEFT_TO_RIGHT); *pRemainingBitsInSegment -= 1; @@ -1384,8 +1383,8 @@ -------------------------------------------------------------------------------------------- */ -static INT DecodeEscapeSequence(HANDLE_FDK_BITSTREAM bs, INT quantSpecCoef, - INT *pLeftStartOfSegment, +static INT DecodeEscapeSequence(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor, + INT quantSpecCoef, INT *pLeftStartOfSegment, SCHAR *pRemainingBitsInSegment, int *pNumDecodedBits) { UINT i; @@ -1396,7 +1395,7 @@ /* decode escape prefix */ while (1) { - carryBit = HcrGetABitFromBitstream(bs, pLeftStartOfSegment, + carryBit = HcrGetABitFromBitstream(bs, bsAnchor, pLeftStartOfSegment, pLeftStartOfSegment, /* dummy */ FROM_LEFT_TO_RIGHT); *pRemainingBitsInSegment -= 1; @@ -1412,7 +1411,7 @@ /* decode escape word */ for (i = escapeOnesCounter; i != 0; i--) { - carryBit = HcrGetABitFromBitstream(bs, pLeftStartOfSegment,
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/aacdec_hcr_bit.cpp -> fdk-aac-2.0.1.tar.gz/libAACdec/src/aacdec_hcr_bit.cpp
Changed
@@ -132,13 +132,14 @@ return: - bit from bitstream -------------------------------------------------------------------------------------------- */ -UINT HcrGetABitFromBitstream(HANDLE_FDK_BITSTREAM bs, INT *pLeftStartOfSegment, +UINT HcrGetABitFromBitstream(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor, + INT *pLeftStartOfSegment, INT *pRightStartOfSegment, UCHAR readDirection) { UINT bit; INT readBitOffset; if (readDirection == FROM_LEFT_TO_RIGHT) { - readBitOffset = *pLeftStartOfSegment - FDKgetBitCnt(bs); + readBitOffset = (INT)FDKgetValidBits(bs) - bsAnchor + *pLeftStartOfSegment; if (readBitOffset) { FDKpushBiDirectional(bs, readBitOffset); } @@ -147,7 +148,7 @@ *pLeftStartOfSegment += 1; } else { - readBitOffset = *pRightStartOfSegment - FDKgetBitCnt(bs); + readBitOffset = (INT)FDKgetValidBits(bs) - bsAnchor + *pRightStartOfSegment; if (readBitOffset) { FDKpushBiDirectional(bs, readBitOffset); }
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/aacdec_hcr_bit.h -> fdk-aac-2.0.1.tar.gz/libAACdec/src/aacdec_hcr_bit.h
Changed
@@ -107,7 +107,8 @@ UCHAR ToggleReadDirection(UCHAR readDirection); -UINT HcrGetABitFromBitstream(HANDLE_FDK_BITSTREAM bs, INT *pLeftStartOfSegment, +UINT HcrGetABitFromBitstream(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor, + INT *pLeftStartOfSegment, INT *pRightStartOfSegment, UCHAR readDirection); #endif /* AACDEC_HCR_BIT_H */
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/aacdec_hcr_types.h -> fdk-aac-2.0.1.tar.gz/libAACdec/src/aacdec_hcr_types.h
Changed
@@ -350,7 +350,7 @@ SHORT lengthOfReorderedSpectralData; SHORT numSection; SHORT *pNumLineInSect; - INT bitstreamIndex; + INT bitstreamAnchor; SCHAR lengthOfLongestCodeword; UCHAR *pCodebook; } HCR_INPUT_OUTPUT;
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/aacdec_hcrs.cpp -> fdk-aac-2.0.1.tar.gz/libAACdec/src/aacdec_hcrs.cpp
Changed
@@ -367,7 +367,10 @@ UINT tempWord; USHORT numValidSegment; - *pNumWordForBitfield = ((*pNumSegment - 1) >> THIRTYTWO_LOG_DIV_TWO_LOG) + 1; + *pNumWordForBitfield = + (*pNumSegment == 0) + ? 0 + : ((*pNumSegment - 1) >> THIRTYTWO_LOG_DIV_TWO_LOG) + 1; /* loop over all words, which are completely used or only partial */ /* bit in pSegmentBitfield is zero if segment is empty; bit in @@ -615,9 +618,9 @@ for (; pRemainingBitsInSegment[segmentOffset] > 0; pRemainingBitsInSegment[segmentOffset] -= 1) { - carryBit = HcrGetABitFromBitstream(bs, &pLeftStartOfSegment[segmentOffset], - &pRightStartOfSegment[segmentOffset], - readDirection); + carryBit = HcrGetABitFromBitstream( + bs, pHcr->decInOut.bitstreamAnchor, &pLeftStartOfSegment[segmentOffset], + &pRightStartOfSegment[segmentOffset], readDirection); CarryBitToBranchValue(carryBit, /* make a step in decoding tree */ treeNode, &branchValue, &branchNode); @@ -749,9 +752,9 @@ for (; pRemainingBitsInSegment[segmentOffset] > 0; pRemainingBitsInSegment[segmentOffset] -= 1) { - carryBit = HcrGetABitFromBitstream(bs, &pLeftStartOfSegment[segmentOffset], - &pRightStartOfSegment[segmentOffset], - readDirection); + carryBit = HcrGetABitFromBitstream( + bs, pHcr->decInOut.bitstreamAnchor, &pLeftStartOfSegment[segmentOffset], + &pRightStartOfSegment[segmentOffset], readDirection); CarryBitToBranchValue(carryBit, /* make a step in decoding tree */ treeNode, &branchValue, &branchNode); @@ -884,9 +887,9 @@ /* loop for sign bit decoding */ for (; pRemainingBitsInSegment[segmentOffset] > 0; pRemainingBitsInSegment[segmentOffset] -= 1) { - carryBit = HcrGetABitFromBitstream(bs, &pLeftStartOfSegment[segmentOffset], - &pRightStartOfSegment[segmentOffset], - readDirection); + carryBit = HcrGetABitFromBitstream( + bs, pHcr->decInOut.bitstreamAnchor, &pLeftStartOfSegment[segmentOffset], + &pRightStartOfSegment[segmentOffset], readDirection); cntSign -= 1; /* decrement sign counter because one sign bit has been read */ @@ -997,9 +1000,9 @@ for (; pRemainingBitsInSegment[segmentOffset] > 0; pRemainingBitsInSegment[segmentOffset] -= 1) { - carryBit = HcrGetABitFromBitstream(bs, &pLeftStartOfSegment[segmentOffset], - &pRightStartOfSegment[segmentOffset], - readDirection); + carryBit = HcrGetABitFromBitstream( + bs, pHcr->decInOut.bitstreamAnchor, &pLeftStartOfSegment[segmentOffset], + &pRightStartOfSegment[segmentOffset], readDirection); /* make a step in tree */ CarryBitToBranchValue(carryBit, treeNode, &branchValue, &branchNode); @@ -1159,9 +1162,9 @@ /* loop for sign bit decoding */ for (; pRemainingBitsInSegment[segmentOffset] > 0; pRemainingBitsInSegment[segmentOffset] -= 1) { - carryBit = HcrGetABitFromBitstream(bs, &pLeftStartOfSegment[segmentOffset], - &pRightStartOfSegment[segmentOffset], - readDirection); + carryBit = HcrGetABitFromBitstream( + bs, pHcr->decInOut.bitstreamAnchor, &pLeftStartOfSegment[segmentOffset], + &pRightStartOfSegment[segmentOffset], readDirection); /* decrement sign counter because one sign bit has been read */ cntSign -= 1; @@ -1314,9 +1317,9 @@ /* decode escape prefix */ for (; pRemainingBitsInSegment[segmentOffset] > 0; pRemainingBitsInSegment[segmentOffset] -= 1) { - carryBit = HcrGetABitFromBitstream(bs, &pLeftStartOfSegment[segmentOffset], - &pRightStartOfSegment[segmentOffset], - readDirection); + carryBit = HcrGetABitFromBitstream( + bs, pHcr->decInOut.bitstreamAnchor, &pLeftStartOfSegment[segmentOffset], + &pRightStartOfSegment[segmentOffset], readDirection); /* count ones and store sum in escapePrefixUp */ if (carryBit == 1) { @@ -1435,9 +1438,9 @@ /* decode escape word */ for (; pRemainingBitsInSegment[segmentOffset] > 0; pRemainingBitsInSegment[segmentOffset] -= 1) { - carryBit = HcrGetABitFromBitstream(bs, &pLeftStartOfSegment[segmentOffset], - &pRightStartOfSegment[segmentOffset], - readDirection); + carryBit = HcrGetABitFromBitstream( + bs, pHcr->decInOut.bitstreamAnchor, &pLeftStartOfSegment[segmentOffset], + &pRightStartOfSegment[segmentOffset], readDirection); /* build escape word */ escapeWord <<=
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/aacdecoder.cpp -> fdk-aac-2.0.1.tar.gz/libAACdec/src/aacdecoder.cpp
Changed
@@ -234,7 +234,8 @@ MODE_HQ))) { /* MPS decoder does support the requested mode. */ break; } - } /* Fall-through: */ + } + FDK_FALLTHROUGH; default: if (self->qmfModeUser == NOT_DEFINED) { /* Revert in case mpegSurroundDecoder_SetParam() fails. */ @@ -538,13 +539,7 @@ sizeof(CProgramConfig)); /* Store the complete PCE */ pceStatus = 1; /* New PCE but no change of config */ break; - case 2: /* The number of channels are identical but not the config */ - if (channelConfig == 0) { - FDKmemcpy(pce, tmpPce, - sizeof(CProgramConfig)); /* Store the complete PCE */ - pceStatus = 2; /* Decoder needs re-configuration */ - } - break; + case 2: /* The number of channels are identical but not the config */ case -1: /* The channel configuration is completely different */ pceStatus = -1; /* Not supported! */ break; @@ -775,7 +770,7 @@ /* For every AU get length and offset in the bitstream */ prerollAULength[i] = escapedValue(hBs, 16, 16, 0); if (prerollAULength[i] > 0) { - prerollAUOffset[i] = auStartAnchor - FDKgetValidBits(hBs); + prerollAUOffset[i] = auStartAnchor - (INT)FDKgetValidBits(hBs); independencyFlag = FDKreadBit(hBs); if (i == 0 && !independencyFlag) { *numPrerollAU = 0; @@ -938,6 +933,7 @@ case EXT_SBR_DATA_CRC: crcFlag = 1; + FDK_FALLTHROUGH; case EXT_SBR_DATA: if (IS_CHANNEL_ELEMENT(previous_element)) { SBR_ERROR sbrError; @@ -1076,6 +1072,7 @@ * intentional. */ break; } + FDK_FALLTHROUGH; case EXT_FIL: @@ -1108,12 +1105,13 @@ /* get the remaining bits of this frame */ bitCnt = transportDec_GetAuBitsRemaining(self->hInput, 0); - if ((bitCnt > 0) && (self->flags[0] & AC_SBR_PRESENT) && + if ((self->flags[0] & AC_SBR_PRESENT) && (self->flags[0] & (AC_USAC | AC_RSVD50 | AC_ELD | AC_DRM))) { SBR_ERROR err = SBRDEC_OK; int chElIdx, numChElements = el_cnt[ID_SCE] + el_cnt[ID_CPE] + el_cnt[ID_LFE] + el_cnt[ID_USAC_SCE] + el_cnt[ID_USAC_CPE] + el_cnt[ID_USAC_LFE]; + INT bitCntTmp = bitCnt; if (self->flags[0] & AC_USAC) { chElIdx = numChElements - 1; @@ -1123,6 +1121,7 @@ for (; chElIdx < numChElements; chElIdx += 1) { MP4_ELEMENT_ID sbrType; + SBR_ERROR errTmp; if (self->flags[0] & (AC_USAC)) { FDK_ASSERT((self->elements[element_index] == ID_USAC_SCE) || (self->elements[element_index] == ID_USAC_CPE)); @@ -1132,19 +1131,21 @@ : ID_SCE; } else sbrType = self->elements[chElIdx]; - err = sbrDecoder_Parse(self->hSbrDecoder, bs, self->pDrmBsBuffer, - self->drmBsBufferSize, &bitCnt, -1, - self->flags[0] & AC_SBRCRC, sbrType, chElIdx, - self->flags[0], self->elFlags); - if (err != SBRDEC_OK) { - break; + errTmp = sbrDecoder_Parse(self->hSbrDecoder, bs, self->pDrmBsBuffer, + self->drmBsBufferSize, &bitCnt, -1, + self->flags[0] & AC_SBRCRC, sbrType, chElIdx, + self->flags[0], self->elFlags); + if (errTmp != SBRDEC_OK) { + err = errTmp; + bitCntTmp = bitCnt; + bitCnt = 0; } } switch (err) { case SBRDEC_PARSE_ERROR: /* Can not go on parsing because we do not know the length of the SBR extension data. */ - FDKpushFor(bs, bitCnt); + FDKpushFor(bs, bitCntTmp); bitCnt = 0; break; case SBRDEC_OK: @@ -1495,11 +1496,13 @@ switch (asc->m_aot) { case AOT_AAC_LC: self->streamInfo.profile = 1; + FDK_FALLTHROUGH; case AOT_ER_AAC_SCAL: if (asc->m_sc.m_gaSpecificConfig.m_layer > 0) { /* aac_scalable_extension_element() currently not supported. */ return AAC_DEC_UNSUPPORTED_FORMAT; } + FDK_FALLTHROUGH; case AOT_SBR: case AOT_PS: case AOT_ER_AAC_LC: @@ -1630,17 +1633,9 @@ aacChannelsOffset = 0; aacChannelsOffsetIdx = 0; elementOffset = 0; - if (configMode & AC_CM_ALLOC_MEM) { - if ((ascChannels <= 0) || - (asc->m_channelConfiguration > AACDEC_MAX_CH_CONF)) { - return AAC_DEC_UNSUPPORTED_CHANNELCONFIG; - } - if ((ascChannels + aacChannelsOffsetIdx) > ((8) * 2)) { - return AAC_DEC_UNSUPPORTED_CHANNELCONFIG; - } - if ((ascChannels + aacChannelsOffset) > (8)) { - return AAC_DEC_UNSUPPORTED_CHANNELCONFIG; - } + if ((ascChannels <= 0) || (ascChannels > (8)) || + (asc->m_channelConfiguration > AACDEC_MAX_CH_CONF)) { + return AAC_DEC_UNSUPPORTED_CHANNELCONFIG; } /* Set syntax flags */ @@ -2055,17 +2050,12 @@ if (self->flags[streamIndex] & (AC_RSV603DA | AC_USAC)) { _numElements = (int)asc->m_sc.m_usacConfig.m_usacNumElements; } - if (self->flags[streamIndex] & (AC_ER | AC_LD | AC_ELD)) { - _numElements = (asc->m_channelConfiguration == 7) - ? 8 - : asc->m_channelConfiguration; - } for (int _el = 0; _el < _numElements; _el++) { int el_channels = 0; int el = elementOffset + _el; if (self->flags[streamIndex] & - (AC_ELD | AC_RSV603DA | AC_USAC | AC_RSVD50)) { + (AC_ER | AC_LD | AC_ELD | AC_RSV603DA | AC_USAC | AC_RSVD50)) { if (ch >= ascChannels) { break; } @@ -2115,7 +2105,9 @@ (SPECTRAL_PTR)&self->workBufferCore2[ch * 1024]; if (el_channels == 2) { - FDK_ASSERT(ch < (8) - 1); + if (ch >= (8) - 1) { + return AAC_DEC_UNSUPPORTED_CHANNELCONFIG; + } self->pAacDecoderChannelInfo[ch + 1]->pComData = self->pAacDecoderChannelInfo[ch]->pComData; self->pAacDecoderChannelInfo[ch + 1]->pComStaticData = @@ -2519,8 +2511,14 @@ if (!(self->flags[0] & (AC_USAC | AC_RSVD50 | AC_RSV603DA | AC_ELD | AC_SCALABLE | AC_ER))) type = (MP4_ELEMENT_ID)FDKreadBits(bs, 3); - else + else { + if (element_count >= (3 * ((8) * 2) + (((8) * 2)) / 2 + 4 * (1) + 1)) { + self->frameOK = 0; + ErrorStatus = AAC_DEC_PARSE_ERROR; + break; + } type = self->elements[element_count]; + } if ((self->flags[streamIndex] & (AC_USAC | AC_RSVD50) && element_count == 0) || @@ -2564,6 +2562,11 @@ case ID_USAC_SCE: case ID_USAC_CPE: case ID_USAC_LFE: + if (element_count >= (3 * ((8) * 2) + (((8) * 2)) / 2 + 4 * (1) + 1)) { + self->frameOK = 0; + ErrorStatus = AAC_DEC_PARSE_ERROR; + break; + } el_channels = CAacDecoder_GetELChannels( type, self->usacStereoConfigIndex[element_count]); @@ -2795,12 +2798,24 @@ } break; case ID_EXT: + if (element_count >= (3 * ((8) * 2) + (((8) * 2)) / 2 + 4 * (1) + 1)) {
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/aacdecoder_lib.cpp -> fdk-aac-2.0.1.tar.gz/libAACdec/src/aacdecoder_lib.cpp
Changed
@@ -387,7 +387,7 @@ static INT aacDecoder_SscCallback(void *handle, HANDLE_FDK_BITSTREAM hBs, const AUDIO_OBJECT_TYPE coreCodec, - const INT samplingRate, + const INT samplingRate, const INT frameSize, const INT stereoConfigIndex, const INT coreSbrFrameLengthIndex, const INT configBytes, const UCHAR configMode, @@ -398,8 +398,8 @@ err = mpegSurroundDecoder_Config( (CMpegSurroundDecoder *)hAacDecoder->pMpegSurroundDecoder, hBs, coreCodec, - samplingRate, stereoConfigIndex, coreSbrFrameLengthIndex, configBytes, - configMode, configChanged); + samplingRate, frameSize, stereoConfigIndex, coreSbrFrameLengthIndex, + configBytes, configMode, configChanged); switch (err) { case MPS_UNSUPPORTED_CONFIG: @@ -634,6 +634,7 @@ switch (err) { case PCMDMX_INVALID_HANDLE: errorStatus = AAC_DEC_INVALID_HANDLE; + break; case PCMDMX_OK: break; default: @@ -1399,9 +1400,13 @@ mpegSurroundDecoder_ConfigureQmfDomain( (CMpegSurroundDecoder *)self->pMpegSurroundDecoder, sac_interface, (UINT)self->streamInfo.aacSampleRate, self->streamInfo.aot); - self->qmfDomain.globalConf.nQmfTimeSlots_requested = - self->streamInfo.aacSamplesPerFrame / - self->qmfDomain.globalConf.nBandsAnalysis_requested; + if (self->qmfDomain.globalConf.nBandsAnalysis_requested > 0) { + self->qmfDomain.globalConf.nQmfTimeSlots_requested = + self->streamInfo.aacSamplesPerFrame / + self->qmfDomain.globalConf.nBandsAnalysis_requested; + } else { + self->qmfDomain.globalConf.nQmfTimeSlots_requested = 0; + } } self->qmfDomain.globalConf.TDinput = pTimeData; @@ -1884,7 +1889,7 @@ } /* USAC DASH IPF flushing possible end */ if (accessUnit < numPrerollAU) { - FDKpushBack(hBsAu, auStartAnchor - FDKgetValidBits(hBsAu)); + FDKpushBack(hBsAu, auStartAnchor - (INT)FDKgetValidBits(hBsAu)); } else { if ((self->buildUpStatus == AACDEC_RSV60_BUILD_UP_ON) || (self->buildUpStatus == AACDEC_RSV60_BUILD_UP_ON_IN_BAND) ||
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/channel.cpp -> fdk-aac-2.0.1.tar.gz/libAACdec/src/channel.cpp
Changed
@@ -592,6 +592,7 @@ line: ~599 */ /* Note: The missing "break" is intentional here, since we need to call * CBlock_ReadScaleFactorData(). */ + FDK_FALLTHROUGH; case scale_factor_data: if (flags & AC_ER_RVLC) {
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/channelinfo.h -> fdk-aac-2.0.1.tar.gz/libAACdec/src/channelinfo.h
Changed
@@ -359,7 +359,7 @@ shouldBeUnion { struct { FIXP_DBL fac_data0[LFAC]; - UCHAR fac_data_e[4]; + SCHAR fac_data_e[4]; FIXP_DBL *fac_data[4]; /* Pointers to unused parts of pSpectralCoefficient */
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/conceal.cpp -> fdk-aac-2.0.1.tar.gz/libAACdec/src/conceal.cpp
Changed
@@ -1894,6 +1894,7 @@ case ConcealState_FadeIn: idx = cntFadeFrames; idx -= TDFadeInStopBeforeFullLevel; + FDK_FALLTHROUGH; case ConcealState_Ok: fadeFactor = pConcealParams->fadeInFactor; idx = (concealState == ConcealState_Ok) ? -1 : idx; @@ -2080,11 +2081,11 @@ noiseVal = FX_DBL2FX_PCM(fMult(noiseValLong, TDNoiseAtt)); /* add filtered noise - check for clipping, before */ - if (pcmdata[ii] > (FIXP_PCM)MAXVAL_FIXP_PCM - noiseVal && - noiseVal > (FIXP_PCM)0) { + if (noiseVal > (FIXP_PCM)0 && + pcmdata[ii] > (FIXP_PCM)MAXVAL_FIXP_PCM - noiseVal) { noiseVal = noiseVal * (FIXP_PCM)-1; - } else if (pcmdata[ii] < (FIXP_PCM)MINVAL_FIXP_PCM - noiseVal && - noiseVal < (FIXP_PCM)0) { + } else if (noiseVal < (FIXP_PCM)0 && + pcmdata[ii] < (FIXP_PCM)MINVAL_FIXP_PCM - noiseVal) { noiseVal = noiseVal * (FIXP_PCM)-1; }
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/ldfiltbank.cpp -> fdk-aac-2.0.1.tar.gz/libAACdec/src/ldfiltbank.cpp
Changed
@@ -216,6 +216,7 @@ int scale = mdctData_e + MDCT_OUT_HEADROOM - LDFB_HEADROOM; /* The LDFB_HEADROOM is compensated inside multE2_DinvF_fdk() below */ + int i; /* Select LD window slope */ switch (N) { @@ -261,10 +262,11 @@ } if (gain != (FIXP_DBL)0) { - scaleValuesWithFactor(mdctData, gain, N, scale); - } else { - scaleValues(mdctData, N, scale); + for (i = 0; i < N; i++) { + mdctData[i] = fMult(mdctData[i], gain); + } } + scaleValuesSaturate(mdctData, N, scale); /* Since all exponent and factors have been applied, current exponent is zero. */
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/rvlc.cpp -> fdk-aac-2.0.1.tar.gz/libAACdec/src/rvlc.cpp
Changed
@@ -168,13 +168,14 @@ /* set base bitstream ptr to the RVL-coded part (start of RVLC data (ESC 2)) */ FDKsyncCache(bs); + pRvlc->bsAnchor = (INT)FDKgetValidBits(bs); - pRvlc->bitstreamIndexRvlFwd = FDKgetBitCnt( - bs); /* first bit within RVL coded block as start address for forward - decoding */ - pRvlc->bitstreamIndexRvlBwd = FDKgetBitCnt(bs) + pRvlc->length_of_rvlc_sf - - 1; /* last bit within RVL coded block as start - address for backward decoding */ + pRvlc->bitstreamIndexRvlFwd = + 0; /* first bit within RVL coded block as start address for forward + decoding */ + pRvlc->bitstreamIndexRvlBwd = + pRvlc->length_of_rvlc_sf - 1; /* last bit within RVL coded block as start + address for backward decoding */ /* skip RVLC-bitstream-part -- pointing now to escapes (if present) or to TNS * data (if present) */ @@ -183,7 +184,7 @@ if (pRvlc->sf_escapes_present != 0) { /* locate internal bitstream ptr at escapes (which is the second part) */ FDKsyncCache(bs); - pRvlc->bitstreamIndexEsc = FDKgetBitCnt(bs); + pRvlc->bitstreamIndexEsc = pRvlc->bsAnchor - (INT)FDKgetValidBits(bs); /* skip escapeRVLC-bitstream-part -- pointing to TNS data (if present) to * make decoder continue */ @@ -259,8 +260,9 @@ treeNode = *pEscTree; /* init at starting node */ for (i = MAX_LEN_RVLC_ESCAPE_WORD - 1; i >= 0; i--) { - carryBit = rvlcReadBitFromBitstream(bs, /* get next bit */ - pBitstreamIndexEsc, FWD); + carryBit = + rvlcReadBitFromBitstream(bs, /* get next bit */ + pRvlc->bsAnchor, pBitstreamIndexEsc, FWD); CarryBitToBranchValue(carryBit, /* huffman decoding, do a single step in huffman decoding tree */ @@ -370,8 +372,9 @@ UINT treeNode = *pRvlCodeTree; for (i = MAX_LEN_RVLC_CODE_WORD - 1; i >= 0; i--) { - carryBit = rvlcReadBitFromBitstream(bs, /* get next bit */ - pBitstrIndxRvl, direction); + carryBit = + rvlcReadBitFromBitstream(bs, /* get next bit */ + pRvlc->bsAnchor, pBitstrIndxRvl, direction); CarryBitToBranchValue(carryBit, /* huffman decoding, do a single step in huffman decoding tree */ @@ -1140,7 +1143,7 @@ rvlcInit(pRvlc, pAacDecoderChannelInfo, bs); /* save bitstream position */ - saveBitCnt = FDKgetBitCnt(bs); + saveBitCnt = (INT)FDKgetValidBits(bs); if (pRvlc->sf_escapes_present) rvlcDecodeEscapes( @@ -1155,7 +1158,7 @@ pAacDecoderChannelInfo->data.aac.PnsData.PnsActive = pRvlc->noise_used; /* restore bitstream position */ - bitCntOffst = saveBitCnt - FDKgetBitCnt(bs); + bitCntOffst = (INT)FDKgetValidBits(bs) - saveBitCnt; if (bitCntOffst) { FDKpushBiDirectional(bs, bitCntOffst); }
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/rvlc_info.h -> fdk-aac-2.0.1.tar.gz/libAACdec/src/rvlc_info.h
Changed
@@ -164,6 +164,7 @@ UCHAR direction; /* bitstream indices */ + INT bsAnchor; /* hcr bit buffer reference index */ INT bitstreamIndexRvlFwd; /* base address of RVL-coded-scalefactor data (ESC 2) for forward decoding */ INT bitstreamIndexRvlBwd; /* base address of RVL-coded-scalefactor data (ESC
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/rvlcbit.cpp -> fdk-aac-2.0.1.tar.gz/libAACdec/src/rvlcbit.cpp
Changed
@@ -123,10 +123,10 @@ -------------------------------------------------------------------------------------------- */ -UCHAR rvlcReadBitFromBitstream(HANDLE_FDK_BITSTREAM bs, INT *pPosition, - UCHAR readDirection) { +UCHAR rvlcReadBitFromBitstream(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor, + INT *pPosition, UCHAR readDirection) { UINT bit; - INT readBitOffset = *pPosition - FDKgetBitCnt(bs); + INT readBitOffset = (INT)FDKgetValidBits(bs) - bsAnchor + *pPosition; if (readBitOffset) { FDKpushBiDirectional(bs, readBitOffset);
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/rvlcbit.h -> fdk-aac-2.0.1.tar.gz/libAACdec/src/rvlcbit.h
Changed
@@ -105,7 +105,7 @@ #include "rvlc.h" -UCHAR rvlcReadBitFromBitstream(HANDLE_FDK_BITSTREAM bs, INT *pPosition, - UCHAR readDirection); +UCHAR rvlcReadBitFromBitstream(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor, + INT *pPosition, UCHAR readDirection); #endif /* RVLCBIT_H */
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/usacdec_acelp.cpp -> fdk-aac-2.0.1.tar.gz/libAACdec/src/usacdec_acelp.cpp
Changed
@@ -309,7 +309,7 @@ ener_exc = (FIXP_DBL)0; for (int i = 0; i < L_SUBFR; i++) { ener_exc += fPow2Div2(exc[i]) >> s; - if (ener_exc > FL2FXCONST_DBL(0.5f)) { + if (ener_exc >= FL2FXCONST_DBL(0.5f)) { ener_exc >>= 1; s++; } @@ -579,11 +579,11 @@ L_tmp = (FIXP_DBL)0; for (j = 0; j < M_LP_FILTER_ORDER; j++) { - L_tmp -= fMultDiv2(a[j], y[i - (j + 1)]); + L_tmp -= fMultDiv2(a[j], y[i - (j + 1)]) >> (LP_FILTER_SCALE - 1); } - L_tmp = scaleValue(L_tmp, a_exp + 1); - y[i] = L_tmp + x[i]; + L_tmp = scaleValue(L_tmp, a_exp + LP_FILTER_SCALE); + y[i] = fAddSaturate(L_tmp, x[i]); } return; @@ -631,10 +631,10 @@ s = (FIXP_DBL)0; for (j = 0; j < M_LP_FILTER_ORDER; j++) { - s += fMultDiv2(a[j], x[i - j - 1]); + s += fMultDiv2(a[j], x[i - j - 1]) >> (LP_FILTER_SCALE - 1); } - s = scaleValue(s, a_exp + 1); + s = scaleValue(s, a_exp + LP_FILTER_SCALE); y[i] = fAddSaturate(s, x[i]); }
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/usacdec_const.h -> fdk-aac-2.0.1.tar.gz/libAACdec/src/usacdec_const.h
Changed
@@ -115,6 +115,7 @@ /* definitions which are independent of coreCoderFrameLength */ #define M_LP_FILTER_ORDER 16 /* LP filter order */ +#define LP_FILTER_SCALE 4 /* LP filter scale */ #define PIT_MIN_12k8 34 /* Minimum pitch lag with resolution 1/4 */ #define PIT_MAX_12k8 231 /* Maximum pitch lag for fs=12.8kHz */
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/usacdec_fac.cpp -> fdk-aac-2.0.1.tar.gz/libAACdec/src/usacdec_fac.cpp
Changed
@@ -142,7 +142,7 @@ return ptr; } -int CLpd_FAC_Read(HANDLE_FDK_BITSTREAM hBs, FIXP_DBL *pFac, UCHAR *pFacScale, +int CLpd_FAC_Read(HANDLE_FDK_BITSTREAM hBs, FIXP_DBL *pFac, SCHAR *pFacScale, int length, int use_gain, int frame) { FIXP_DBL fac_gain; int fac_gain_e = 0; @@ -191,13 +191,11 @@ L_tmp = (FIXP_DBL)0; for (j = 0; j < fMin(i, M_LP_FILTER_ORDER); j++) { - L_tmp -= fMultDiv2(a[j], x[i - (j + 1)]); + L_tmp -= fMultDiv2(a[j], x[i - (j + 1)]) >> (LP_FILTER_SCALE - 1); } - L_tmp = scaleValue(L_tmp, a_exp + 1); - - x[i] = scaleValueSaturate((x[i] >> 1) + (L_tmp >> 1), - 1); /* Avoid overflow issues and saturate. */ + L_tmp = scaleValue(L_tmp, a_exp + LP_FILTER_SCALE); + x[i] = fAddSaturate(x[i], L_tmp); } } @@ -536,10 +534,12 @@ /* Optional scaling of time domain - no yet windowed - of current spectrum */ if (total_gain != (FIXP_DBL)0) { - scaleValuesWithFactor(pSpec, total_gain, tl, spec_scale[0] + scale); - } else { - scaleValues(pSpec, tl, spec_scale[0] + scale); + for (i = 0; i < tl; i++) { + pSpec[i] = fMult(pSpec[i], total_gain); + } } + int loc_scale = fixmin_I(spec_scale[0] + scale, (INT)DFRACT_BITS - 1); + scaleValuesSaturate(pSpec, tl, loc_scale); pOut1 += fl / 2 - 1; pCurr = pSpec + tl - fl / 2; @@ -625,10 +625,12 @@ */ /* and de-scale current spectrum signal (time domain, no yet windowed) */ if (total_gain != (FIXP_DBL)0) { - scaleValuesWithFactor(pSpec, total_gain, tl, spec_scale[w] + scale); - } else { - scaleValues(pSpec, tl, spec_scale[w] + scale); + for (i = 0; i < tl; i++) { + pSpec[i] = fMult(pSpec[i], total_gain); + } } + loc_scale = fixmin_I(spec_scale[w] + scale, (INT)DFRACT_BITS - 1); + scaleValuesSaturate(pSpec, tl, loc_scale); if (noOutSamples <= nrSamples) { /* Divert output first half to overlap buffer if we already got enough
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/usacdec_fac.h -> fdk-aac-2.0.1.tar.gz/libAACdec/src/usacdec_fac.h
Changed
@@ -131,7 +131,7 @@ * Always 0 for FD case. * \return 0 on success, -1 on error. */ -int CLpd_FAC_Read(HANDLE_FDK_BITSTREAM hBs, FIXP_DBL *pFac, UCHAR *pFacScale, +int CLpd_FAC_Read(HANDLE_FDK_BITSTREAM hBs, FIXP_DBL *pFac, SCHAR *pFacScale, int length, int use_gain, int frame); /**
View file
fdk-aac-2.0.0.tar.gz/libAACdec/src/usacdec_lpd.cpp -> fdk-aac-2.0.1.tar.gz/libAACdec/src/usacdec_lpd.cpp
Changed
@@ -418,6 +418,7 @@ FIXP_DBL tmp_pow2[32]; s = s * 2 + ALFDPOW2_SCALE; + s = fMin(31, s); k = 8; i_max = lg / 4; /* ALFD range = 1600Hz (lg = 6400Hz) */ @@ -1221,8 +1222,7 @@ (INT)(samplingRate * PIT_MIN_12k8 + (FSCALE_DENOM / 2)) / FSCALE_DENOM - (INT)PIT_MIN_12k8; - if (pSamplingRateInfo->samplingRate > - FAC_FSCALE_MAX /* maximum allowed core sampling frequency */) { + if ((samplingRate < FAC_FSCALE_MIN) || (samplingRate > FAC_FSCALE_MAX)) { error = AAC_DEC_PARSE_ERROR; goto bail; }
View file
fdk-aac-2.0.0.tar.gz/libAACenc/src/aacenc_lib.cpp -> fdk-aac-2.0.1.tar.gz/libAACenc/src/aacenc_lib.cpp
Changed
@@ -907,6 +907,7 @@ case AOT_MP2_AAC_LC: case AOT_MP2_SBR: hAacConfig->usePns = 0; + FDK_FALLTHROUGH; case AOT_AAC_LC: case AOT_SBR: case AOT_PS: @@ -1215,7 +1216,8 @@ INT aacenc_SscCallback(void *self, HANDLE_FDK_BITSTREAM hBs, const AUDIO_OBJECT_TYPE coreCodec, - const INT samplingRate, const INT stereoConfigIndex, + const INT samplingRate, const INT frameSize, + const INT stereoConfigIndex, const INT coreSbrFrameLengthIndex, const INT configBytes, const UCHAR configMode, UCHAR *configChanged) { HANDLE_AACENCODER hAacEncoder = (HANDLE_AACENCODER)self; @@ -1733,9 +1735,10 @@ } /* check if buffer descriptors are filled out properly. */ - if ((AACENC_OK != validateBufDesc(inBufDesc)) || - (AACENC_OK != validateBufDesc(outBufDesc)) || (inargs == NULL) || - (outargs == NULL)) { + if ((inargs == NULL) || (outargs == NULL) || + ((AACENC_OK != validateBufDesc(inBufDesc)) && + (inargs->numInSamples > 0)) || + (AACENC_OK != validateBufDesc(outBufDesc))) { err = AACENC_UNSUPPORTED_PARAMETER; goto bail; } @@ -2090,12 +2093,14 @@ err = AACENC_INVALID_CONFIG; goto bail; } + FDK_FALLTHROUGH; case AOT_SBR: case AOT_MP2_SBR: if (!(hAacEncoder->encoder_modis & (ENC_MODE_FLAG_SBR))) { err = AACENC_INVALID_CONFIG; goto bail; } + FDK_FALLTHROUGH; case AOT_AAC_LC: case AOT_MP2_AAC_LC: case AOT_ER_AAC_LD:
View file
fdk-aac-2.0.0.tar.gz/libAACenc/src/bitenc.cpp -> fdk-aac-2.0.1.tar.gz/libAACenc/src/bitenc.cpp
Changed
@@ -643,6 +643,7 @@ FDKwriteBits(hBitStream, *extPayloadData++, 4); /* nibble */ } extBitsUsed += 4; + FDK_FALLTHROUGH; case EXT_DYNAMIC_RANGE: case EXT_SBR_DATA: case EXT_SBR_DATA_CRC: @@ -690,6 +691,7 @@ case EXT_FILL_DATA: fillByte = 0xA5; + FDK_FALLTHROUGH; case EXT_FIL: default: if (hBitStream != NULL) {
View file
fdk-aac-2.0.0.tar.gz/libArithCoding/src/ac_arith_coder.cpp -> fdk-aac-2.0.1.tar.gz/libArithCoding/src/ac_arith_coder.cpp
Changed
@@ -609,13 +609,16 @@ return (j & 0x3F); } -static void decode2(HANDLE_FDK_BITSTREAM bbuf, UCHAR *RESTRICT c_prev, - FIXP_DBL *RESTRICT pSpectralCoefficient, INT n, INT nt) { +static ARITH_CODING_ERROR decode2(HANDLE_FDK_BITSTREAM bbuf, + UCHAR *RESTRICT c_prev, + FIXP_DBL *RESTRICT pSpectralCoefficient, + INT n, INT nt) { Tastat as; int i, l, r; INT lev, esc_nb, pki; USHORT state_inc; UINT s; + ARITH_CODING_ERROR ErrorStatus = ARITH_CODER_OK; int c_3 = 0; /* context of current frame 3 time steps ago */ int c_2 = 0; /* context of current frame 2 time steps ago */ @@ -655,6 +658,8 @@ lev++; + if (lev > 23) return ARITH_CODER_ERROR; + if (esc_nb < 7) { esc_nb++; } @@ -721,6 +726,8 @@ } FDKmemset(&c_prev[i], 1, sizeof(c_prev[0]) * (nt - i)); + + return ErrorStatus; } CArcoData *CArco_Create(void) { return GetArcoData(); } @@ -763,7 +770,8 @@ pArcoData->m_numberLinesPrev = lg_max; if (lg > 0) { - decode2(hBs, pArcoData->c_prev + 2, mdctSpectrum, lg >> 1, lg_max >> 1); + ErrorStatus = + decode2(hBs, pArcoData->c_prev + 2, mdctSpectrum, lg >> 1, lg_max >> 1); } else { FDKmemset(&pArcoData->c_prev[2], 1, sizeof(pArcoData->c_prev[2]) * (lg_max >> 1));
View file
fdk-aac-2.0.0.tar.gz/libDRCdec/src/drcDec_selectionProcess.cpp -> fdk-aac-2.0.1.tar.gz/libDRCdec/src/drcDec_selectionProcess.cpp
Changed
@@ -1006,15 +1006,23 @@ return DRCDEC_SELECTION_PROCESS_NO_ERROR; } -static void _setSelectionDataInfo(DRCDEC_SELECTION_DATA* pData, - FIXP_DBL loudness, - FIXP_DBL loudnessNormalizationGainDb, - FIXP_DBL loudnessNormalizationGainDbMax, - FIXP_DBL loudnessDeviationMax, - FIXP_DBL signalPeakLevel, - FIXP_DBL outputPeakLevelMax, - int applyAdjustment) { - FIXP_DBL adjustment = 0; +static void _setSelectionDataInfo( + DRCDEC_SELECTION_DATA* pData, FIXP_DBL loudness, /* e = 7 */ + FIXP_DBL loudnessNormalizationGainDb, /* e = 7 */ + FIXP_DBL loudnessNormalizationGainDbMax, /* e = 7 */ + FIXP_DBL loudnessDeviationMax, /* e = 7 */ + FIXP_DBL signalPeakLevel, /* e = 7 */ + FIXP_DBL outputPeakLevelMax, /* e = 7 */ + int applyAdjustment) { + FIXP_DBL adjustment = 0; /* e = 8 */ + + /* use e = 8 for all function parameters to prevent overflow */ + loudness >>= 1; + loudnessNormalizationGainDb >>= 1; + loudnessNormalizationGainDbMax >>= 1; + loudnessDeviationMax >>= 1; + signalPeakLevel >>= 1; + outputPeakLevelMax >>= 1; if (applyAdjustment) { adjustment = @@ -1028,6 +1036,14 @@ pData->outputLoudness = loudness + pData->loudnessNormalizationGainDbAdjusted; pData->outputPeakLevel = signalPeakLevel + pData->loudnessNormalizationGainDbAdjusted; + + /* shift back to e = 7 using saturation */ + pData->loudnessNormalizationGainDbAdjusted = SATURATE_LEFT_SHIFT( + pData->loudnessNormalizationGainDbAdjusted, 1, DFRACT_BITS); + pData->outputLoudness = + SATURATE_LEFT_SHIFT(pData->outputLoudness, 1, DFRACT_BITS); + pData->outputPeakLevel = + SATURATE_LEFT_SHIFT(pData->outputPeakLevel, 1, DFRACT_BITS); } static int _targetLoudnessInRange(
View file
fdk-aac-2.0.0.tar.gz/libDRCdec/src/drcGainDec_preprocess.cpp -> fdk-aac-2.0.1.tar.gz/libDRCdec/src/drcGainDec_preprocess.cpp
Changed
@@ -300,8 +300,9 @@ FIXP_SGL exp = pCChar->exp; DRC_ERROR err = DE_OK; - tmp = fMultDiv2(DRC_INPUT_LOUDNESS_TARGET - inLevelDb, pCChar->ioRatio); - tmp = SATURATE_LEFT_SHIFT(tmp, 2 + 1, DFRACT_BITS); + tmp = fMultDiv2((DRC_INPUT_LOUDNESS_TARGET >> 1) - (inLevelDb >> 1), + pCChar->ioRatio); + tmp = SATURATE_LEFT_SHIFT(tmp, 2 + 1 + 1, DFRACT_BITS); if (exp < (FIXP_SGL)MAXVAL_SGL) { /* x = tmp / gainDbLimit; */ /* *outGainDb = tmp / pow(1.0f + pow(x, exp), 1.0f/exp); */ @@ -675,6 +676,7 @@ nDrcBands = pActiveDrc->bandCountForChannelGroup[g]; for (b = 0; b < nDrcBands; b++) { DRC_ERROR err = DE_OK; + if (gainSetIndex >= 12) return DE_PARAM_OUT_OF_RANGE; GAIN_SET* pGainSet = &(pCoef->gainSet[gainSetIndex]); int seq = pGainSet->gainSequenceIndex[b]; DRC_CHARACTERISTIC* pDChar = &(pGainSet->drcCharacteristic[b]); @@ -693,6 +695,7 @@ err = _prepareDrcCharacteristic(pDChar, pCoef, b, &nodeMod); if (err) return err; + if (seq >= 12) return DE_PARAM_OUT_OF_RANGE; /* copy a node buffer and convert from dB to linear */ pLnb->nNodes[lnbp] = fMin((int)hUniDrcGain->nNodes[seq], 16); for (i = 0; i < pLnb->nNodes[lnbp]; i++) {
View file
fdk-aac-2.0.0.tar.gz/libDRCdec/src/drcGainDec_process.cpp -> fdk-aac-2.0.1.tar.gz/libDRCdec/src/drcGainDec_process.cpp
Changed
@@ -308,6 +308,8 @@ pLinearNodeBuffer[pActiveDrc->lnbIndexForChannel[c][lnbIx] + b]); else pLnbPrevious = pDummyLnb; + if (pLnbPrevious->nNodes[lnbIx] <= 0 || pLnbPrevious->nNodes[lnbIx] > 16) + return DE_NOT_OK; nodePrevious = pLnbPrevious->linearNode[lnbIx][pLnbPrevious->nNodes[lnbIx] - 1]; nodePrevious.time -= hGainDec->frameSize;
View file
fdk-aac-2.0.0.tar.gz/libFDK/include/FDK_bitbuffer.h -> fdk-aac-2.0.1.tar.gz/libFDK/include/FDK_bitbuffer.h
Changed
@@ -113,7 +113,6 @@ UINT ValidBits; UINT ReadOffset; UINT WriteOffset; - UINT BitCnt; UINT BitNdx; UCHAR *Buffer; @@ -159,15 +158,10 @@ void FDK_pushForward(HANDLE_FDK_BITBUF hBitBuffer, const UINT numberOfBits, UCHAR config); -void FDK_byteAlign(HANDLE_FDK_BITBUF hBitBuffer, UCHAR config); - UINT FDK_getValidBits(HANDLE_FDK_BITBUF hBitBuffer); INT FDK_getFreeBits(HANDLE_FDK_BITBUF hBitBuffer); -void FDK_setBitCnt(HANDLE_FDK_BITBUF hBitBuffer, const UINT value); -INT FDK_getBitCnt(HANDLE_FDK_BITBUF hBitBuffer); - void FDK_Feed(HANDLE_FDK_BITBUF hBitBuffer, const UCHAR inputBuffer[], const UINT bufferSize, UINT *bytesValid);
View file
fdk-aac-2.0.0.tar.gz/libFDK/include/FDK_bitstream.h -> fdk-aac-2.0.1.tar.gz/libFDK/include/FDK_bitstream.h
Changed
@@ -481,21 +481,6 @@ } /** - * \brief Byte Alignment Function. - * This function performs the byte_alignment() syntactic function on the - * input stream, i.e. some bits will be discarded/padded so that the next bits - * to be read/written will be aligned on a byte boundary with respect to - * the bit position 0. - * - * \param hBitStream HANDLE_FDK_BITSTREAM handle - * \return void - */ -FDK_INLINE void FDKbyteAlign(HANDLE_FDK_BITSTREAM hBitStream) { - FDKsyncCache(hBitStream); - FDK_byteAlign(&hBitStream->hBitBuf, (UCHAR)hBitStream->ConfigCache); -} - -/** * \brief Byte Alignment Function with anchor * This function performs the byte_alignment() syntactic function on the * input stream, i.e. some bits will be discarded so that the next bits to be @@ -604,37 +589,6 @@ } /** - * \brief reset bitcounter in bitBuffer to zero. - * \param hBitStream HANDLE_FDK_BITSTREAM handle - * \return void - */ -FDK_INLINE void FDKresetBitCnt(HANDLE_FDK_BITSTREAM hBitStream) { - FDKsyncCache(hBitStream); - FDK_setBitCnt(&hBitStream->hBitBuf, 0); -} - -/** - * \brief set bitcoutner in bitBuffer to given value. - * \param hBitStream HANDLE_FDK_BITSTREAM handle - * \param value new value to be assigned to the bit counter - * \return void - */ -FDK_INLINE void FDKsetBitCnt(HANDLE_FDK_BITSTREAM hBitStream, UINT value) { - FDKsyncCache(hBitStream); - FDK_setBitCnt(&hBitStream->hBitBuf, value); -} - -/** - * \brief get bitcounter state from bitBuffer. - * \param hBitStream HANDLE_FDK_BITSTREAM handle - * \return current bit counter value - */ -FDK_INLINE INT FDKgetBitCnt(HANDLE_FDK_BITSTREAM hBitStream) { - FDKsyncCache(hBitStream); - return FDK_getBitCnt(&hBitStream->hBitBuf); -} - -/** * \brief Fill the BitBuffer with a number of input bytes from external source. * The bytesValid variable returns the number of ramaining valid bytes in * extern inputBuffer.
View file
fdk-aac-2.0.0.tar.gz/libFDK/include/scale.h -> fdk-aac-2.0.1.tar.gz/libFDK/include/scale.h
Changed
@@ -268,11 +268,11 @@ * to avoid problems when inverting the sign of the result. */ #ifndef SATURATE_LEFT_SHIFT_ALT -#define SATURATE_LEFT_SHIFT_ALT(src, scale, dBits) \ - (((LONG)(src) > ((LONG)(((1U) << ((dBits)-1)) - 1) >> (scale))) \ - ? (LONG)(((1U) << ((dBits)-1)) - 1) \ - : ((LONG)(src) < ~((LONG)(((1U) << ((dBits)-1)) - 2) >> (scale))) \ - ? ~((LONG)(((1U) << ((dBits)-1)) - 2)) \ +#define SATURATE_LEFT_SHIFT_ALT(src, scale, dBits) \ + (((LONG)(src) > ((LONG)(((1U) << ((dBits)-1)) - 1) >> (scale))) \ + ? (LONG)(((1U) << ((dBits)-1)) - 1) \ + : ((LONG)(src) <= ~((LONG)(((1U) << ((dBits)-1)) - 1) >> (scale))) \ + ? ~((LONG)(((1U) << ((dBits)-1)) - 2)) \ : ((LONG)(src) << (scale))) #endif
View file
fdk-aac-2.0.0.tar.gz/libFDK/src/FDK_bitbuffer.cpp -> fdk-aac-2.0.1.tar.gz/libFDK/src/FDK_bitbuffer.cpp
Changed
@@ -128,7 +128,6 @@ hBitBuf->ValidBits = validBits; hBitBuf->ReadOffset = 0; hBitBuf->WriteOffset = 0; - hBitBuf->BitCnt = 0; hBitBuf->BitNdx = 0; hBitBuf->Buffer = pBuffer; @@ -151,7 +150,6 @@ hBitBuf->ValidBits = 0; hBitBuf->ReadOffset = 0; hBitBuf->WriteOffset = 0; - hBitBuf->BitCnt = 0; hBitBuf->BitNdx = 0; } @@ -161,7 +159,6 @@ UINT bitOffset = hBitBuf->BitNdx & 0x07; hBitBuf->BitNdx = (hBitBuf->BitNdx + numberOfBits) & (hBitBuf->bufBits - 1); - hBitBuf->BitCnt += numberOfBits; hBitBuf->ValidBits -= numberOfBits; UINT byteMask = hBitBuf->bufSize - 1; @@ -184,7 +181,6 @@ INT FDK_get32(HANDLE_FDK_BITBUF hBitBuf) { UINT BitNdx = hBitBuf->BitNdx + 32; hBitBuf->BitNdx = BitNdx & (hBitBuf->bufBits - 1); - hBitBuf->BitCnt += 32; hBitBuf->ValidBits = (UINT)((INT)hBitBuf->ValidBits - (INT)32); UINT byteOffset = (BitNdx - 1) >> 3; @@ -223,7 +219,6 @@ int i; hBitBuf->BitNdx = (hBitBuf->BitNdx - numberOfBits) & (hBitBuf->bufBits - 1); - hBitBuf->BitCnt -= numberOfBits; hBitBuf->ValidBits += numberOfBits; UINT tx = hBitBuf->Buffer[(byteOffset - 3) & byteMask] << 24 | @@ -256,7 +251,6 @@ UINT bitOffset = hBitBuf->BitNdx & 0x7; hBitBuf->BitNdx = (hBitBuf->BitNdx + numberOfBits) & (hBitBuf->bufBits - 1); - hBitBuf->BitCnt += numberOfBits; hBitBuf->ValidBits += numberOfBits; UINT byteMask = hBitBuf->bufSize - 1; @@ -307,7 +301,6 @@ int i; hBitBuf->BitNdx = (hBitBuf->BitNdx - numberOfBits) & (hBitBuf->bufBits - 1); - hBitBuf->BitCnt -= numberOfBits; hBitBuf->ValidBits -= numberOfBits; /* in place turn around */ @@ -344,7 +337,6 @@ #ifndef FUNCTION_FDK_pushBack void FDK_pushBack(HANDLE_FDK_BITBUF hBitBuf, const UINT numberOfBits, UCHAR config) { - hBitBuf->BitCnt = (UINT)((INT)hBitBuf->BitCnt - (INT)numberOfBits); hBitBuf->ValidBits = (config == 0) ? (UINT)((INT)hBitBuf->ValidBits + (INT)numberOfBits) : ((UINT)((INT)hBitBuf->ValidBits - (INT)numberOfBits)); @@ -355,7 +347,6 @@ void FDK_pushForward(HANDLE_FDK_BITBUF hBitBuf, const UINT numberOfBits, UCHAR config) { - hBitBuf->BitCnt = (UINT)((INT)hBitBuf->BitCnt + (INT)numberOfBits); hBitBuf->ValidBits = (config == 0) ? ((UINT)((INT)hBitBuf->ValidBits - (INT)numberOfBits)) : (UINT)((INT)hBitBuf->ValidBits + (INT)numberOfBits); @@ -363,19 +354,6 @@ (UINT)((INT)hBitBuf->BitNdx + (INT)numberOfBits) & (hBitBuf->bufBits - 1); } -void FDK_byteAlign(HANDLE_FDK_BITBUF hBitBuf, UCHAR config) { - INT alignment = hBitBuf->BitCnt & 0x07; - - if (alignment) { - if (config == 0) - FDK_pushForward(hBitBuf, 8 - alignment, config); /* BS_READER */ - else - FDK_put(hBitBuf, 0, 8 - alignment); /* BS_WRITER */ - } - - hBitBuf->BitCnt = 0; -} - #ifndef FUNCTION_FDK_getValidBits UINT FDK_getValidBits(HANDLE_FDK_BITBUF hBitBuf) { return hBitBuf->ValidBits; } #endif /* #ifndef FUNCTION_FDK_getValidBits */ @@ -384,12 +362,6 @@ return (hBitBuf->bufBits - hBitBuf->ValidBits); } -void FDK_setBitCnt(HANDLE_FDK_BITBUF hBitBuf, const UINT value) { - hBitBuf->BitCnt = value; -} - -INT FDK_getBitCnt(HANDLE_FDK_BITBUF hBitBuf) { return hBitBuf->BitCnt; } - void FDK_Feed(HANDLE_FDK_BITBUF hBitBuf, const UCHAR *RESTRICT inputBuffer, const UINT bufferSize, UINT *bytesValid) { inputBuffer = &inputBuffer[bufferSize - *bytesValid]; @@ -438,7 +410,6 @@ h_BitBufSrc->BitNdx = (h_BitBufSrc->BitNdx + bToRead) & (h_BitBufSrc->bufBits - 1); - h_BitBufSrc->BitCnt += bToRead; h_BitBufSrc->ValidBits -= bToRead; }
View file
fdk-aac-2.0.0.tar.gz/libFDK/src/FDK_qmf_domain.cpp -> fdk-aac-2.0.1.tar.gz/libFDK/src/FDK_qmf_domain.cpp
Changed
@@ -786,6 +786,7 @@ hgc->flags_requested = 0; hgc->nInputChannels_requested = 0; hgc->nOutputChannels_requested = 0; + hgc->parkChannel_requested = 0; hgc->nBandsAnalysis_requested = 0; hgc->nBandsSynthesis_requested = 0; hgc->nQmfTimeSlots_requested = 0; @@ -798,6 +799,7 @@ hgc->flags = 0; hgc->nInputChannels = 0; hgc->nOutputChannels = 0; + hgc->parkChannel = 0; hgc->nBandsAnalysis = 0; hgc->nBandsSynthesis = 0; hgc->nQmfTimeSlots = 0; @@ -887,10 +889,6 @@ !(hgc->flags & (QMF_FLAG_CLDFB | QMF_FLAG_MPSLDFB))) { hgc->flags_requested |= QMF_FLAG_DOWNSAMPLED; } - if ((hgc->flags_requested & QMF_FLAG_MPSLDFB) && - (hgc->flags_requested & QMF_FLAG_CLDFB)) { - hgc->flags_requested &= ~QMF_FLAG_CLDFB; - } hasChanged = 1; } @@ -899,6 +897,10 @@ /* 5. set requested flags */ if (hgc->flags != hgc->flags_requested) { + if ((hgc->flags_requested & QMF_FLAG_MPSLDFB) && + (hgc->flags_requested & QMF_FLAG_CLDFB)) { + hgc->flags_requested &= ~QMF_FLAG_CLDFB; + } hgc->flags = hgc->flags_requested; hasChanged = 1; } @@ -981,9 +983,8 @@ } bail: - if (err == QMF_DOMAIN_OUT_OF_MEMORY) { - FDK_QmfDomain_FreePersistentMemory(hqd); - FDK_QmfDomain_ClearConfigured(&hqd->globalConf); + if (err) { + FDK_QmfDomain_FreeMem(hqd); } return err; }
View file
fdk-aac-2.0.0.tar.gz/libFDK/src/dct.cpp -> fdk-aac-2.0.1.tar.gz/libFDK/src/dct.cpp
Changed
@@ -124,10 +124,6 @@ #include "FDK_tools_rom.h" #include "fft.h" -#if defined(__arm__) -#include "arm/dct_arm.cpp" -#endif - void dct_getTables(const FIXP_WTP **ptwiddle, const FIXP_STP **sin_twiddle, int *sin_step, int length) { const FIXP_WTP *twiddle; @@ -387,12 +383,6 @@ dct_getTables(&twiddle, &sin_twiddle, &sin_step, L); -#ifdef FUNCTION_dct_IV_func1 - if (M >= 4 && (M & 3) == 0) { - /* ARM926: 44 cycles for 2 iterations = 22 cycles/iteration */ - dct_IV_func1(M >> 2, twiddle, &pDat[0], &pDat[L - 1]); - } else -#endif /* FUNCTION_dct_IV_func1 */ { FIXP_DBL *RESTRICT pDat_0 = &pDat[0]; FIXP_DBL *RESTRICT pDat_1 = &pDat[L - 2]; @@ -410,10 +400,10 @@ cplxMultDiv2(&accu1, &accu2, accu1, accu2, twiddle[i]); cplxMultDiv2(&accu3, &accu4, accu4, accu3, twiddle[i + 1]); - pDat_0[0] = accu2; - pDat_0[1] = accu1; - pDat_1[0] = accu4; - pDat_1[1] = -accu3; + pDat_0[0] = accu2 >> 1; + pDat_0[1] = accu1 >> 1; + pDat_1[0] = accu4 >> 1; + pDat_1[1] = -(accu3 >> 1); } if (M & 1) { FIXP_DBL accu1, accu2; @@ -423,19 +413,13 @@ cplxMultDiv2(&accu1, &accu2, accu1, accu2, twiddle[i]); - pDat_0[0] = accu2; - pDat_0[1] = accu1; + pDat_0[0] = accu2 >> 1; + pDat_0[1] = accu1 >> 1; } } fft(M, pDat, pDat_e); -#ifdef FUNCTION_dct_IV_func2 - if (M >= 4 && (M & 3) == 0) { - /* ARM926: 42 cycles for 2 iterations = 21 cycles/iteration */ - dct_IV_func2(M >> 2, sin_twiddle, &pDat[0], &pDat[L], sin_step); - } else -#endif /* FUNCTION_dct_IV_func2 */ { FIXP_DBL *RESTRICT pDat_0 = &pDat[0]; FIXP_DBL *RESTRICT pDat_1 = &pDat[L - 2]; @@ -446,20 +430,19 @@ accu1 = pDat_1[0]; accu2 = pDat_1[1]; - pDat_1[1] = -(pDat_0[1] >> 1); - pDat_0[0] = (pDat_0[0] >> 1); + pDat_1[1] = -pDat_0[1]; /* 28 cycles for ARM926 */ for (idx = sin_step, i = 1; i<(M + 1)>> 1; i++, idx += sin_step) { FIXP_STP twd = sin_twiddle[idx]; - cplxMultDiv2(&accu3, &accu4, accu1, accu2, twd); + cplxMult(&accu3, &accu4, accu1, accu2, twd); pDat_0[1] = accu3; pDat_1[0] = accu4; pDat_0 += 2; pDat_1 -= 2; - cplxMultDiv2(&accu3, &accu4, pDat_0[1], pDat_0[0], twd); + cplxMult(&accu3, &accu4, pDat_0[1], pDat_0[0], twd); accu1 = pDat_1[0]; accu2 = pDat_1[1]; @@ -470,8 +453,8 @@ if ((M & 1) == 0) { /* Last Sin and Cos value pair are the same */ - accu1 = fMultDiv2(accu1, WTC(0x5a82799a)); - accu2 = fMultDiv2(accu2, WTC(0x5a82799a)); + accu1 = fMult(accu1, WTC(0x5a82799a)); + accu2 = fMult(accu2, WTC(0x5a82799a)); pDat_1[0] = accu1 + accu2; pDat_0[1] = accu1 - accu2; @@ -497,11 +480,6 @@ dct_getTables(&twiddle, &sin_twiddle, &sin_step, L); -#ifdef FUNCTION_dst_IV_func1 - if ((M >= 4) && ((M & 3) == 0)) { - dst_IV_func1(M, twiddle, &pDat[0], &pDat[L]); - } else -#endif { FIXP_DBL *RESTRICT pDat_0 = &pDat[0]; FIXP_DBL *RESTRICT pDat_1 = &pDat[L - 2]; @@ -519,10 +497,10 @@ cplxMultDiv2(&accu1, &accu2, accu1, accu2, twiddle[i]); cplxMultDiv2(&accu3, &accu4, accu4, accu3, twiddle[i + 1]); - pDat_0[0] = accu2; - pDat_0[1] = accu1; - pDat_1[0] = accu4; - pDat_1[1] = -accu3; + pDat_0[0] = accu2 >> 1; + pDat_0[1] = accu1 >> 1; + pDat_1[0] = accu4 >> 1; + pDat_1[1] = -(accu3 >> 1); } if (M & 1) { FIXP_DBL accu1, accu2; @@ -532,19 +510,13 @@ cplxMultDiv2(&accu1, &accu2, accu1, accu2, twiddle[i]); - pDat_0[0] = accu2; - pDat_0[1] = accu1; + pDat_0[0] = accu2 >> 1; + pDat_0[1] = accu1 >> 1; } } fft(M, pDat, pDat_e); -#ifdef FUNCTION_dst_IV_func2 - if ((M >= 4) && ((M & 3) == 0)) { - dst_IV_func2(M >> 2, sin_twiddle + sin_step, &pDat[0], &pDat[L - 1], - sin_step); - } else -#endif /* FUNCTION_dst_IV_func2 */ { FIXP_DBL *RESTRICT pDat_0; FIXP_DBL *RESTRICT pDat_1; @@ -558,20 +530,20 @@ accu1 = pDat_1[0]; accu2 = pDat_1[1]; - pDat_1[1] = -(pDat_0[0] >> 1); - pDat_0[0] = (pDat_0[1] >> 1); + pDat_1[1] = -pDat_0[0]; + pDat_0[0] = pDat_0[1]; for (idx = sin_step, i = 1; i<(M + 1)>> 1; i++, idx += sin_step) { FIXP_STP twd = sin_twiddle[idx]; - cplxMultDiv2(&accu3, &accu4, accu1, accu2, twd); + cplxMult(&accu3, &accu4, accu1, accu2, twd); pDat_1[0] = -accu3; pDat_0[1] = -accu4; pDat_0 += 2; pDat_1 -= 2; - cplxMultDiv2(&accu3, &accu4, pDat_0[1], pDat_0[0], twd); + cplxMult(&accu3, &accu4, pDat_0[1], pDat_0[0], twd); accu1 = pDat_1[0]; accu2 = pDat_1[1]; @@ -582,8 +554,8 @@ if ((M & 1) == 0) { /* Last Sin and Cos value pair are the same */ - accu1 = fMultDiv2(accu1, WTC(0x5a82799a)); - accu2 = fMultDiv2(accu2, WTC(0x5a82799a)); + accu1 = fMult(accu1, WTC(0x5a82799a)); + accu2 = fMult(accu2, WTC(0x5a82799a)); pDat_0[1] = -accu1 - accu2; pDat_1[0] = accu2 - accu1;
View file
fdk-aac-2.0.0.tar.gz/libFDK/src/nlc_dec.cpp -> fdk-aac-2.0.1.tar.gz/libFDK/src/nlc_dec.cpp
Changed
@@ -647,6 +647,10 @@ } df_rest_flag_1 = num_val_1_int % 2; if (df_rest_flag_1) num_val_1_int -= 1; + if (num_val_1_int < 0) { + err = HUFFDEC_NOTOK; + goto bail; + } } if (out_data_2 != NULL) { if (diff_type_2 == DIFF_FREQ) { @@ -658,6 +662,10 @@ } df_rest_flag_2 = num_val_2_int % 2; if (df_rest_flag_2) num_val_2_int -= 1; + if (num_val_2_int < 0) { + err = HUFFDEC_NOTOK; + goto bail; + } } if (out_data_1 != NULL) {
View file
fdk-aac-2.0.0.tar.gz/libMpegTPDec/include/tp_data.h -> fdk-aac-2.0.1.tar.gz/libMpegTPDec/include/tp_data.h
Changed
@@ -367,7 +367,8 @@ typedef INT (*cbCtrlCFGChange_t)(void *, const CCtrlCFGChange *); typedef INT (*cbSsc_t)(void *, HANDLE_FDK_BITSTREAM, const AUDIO_OBJECT_TYPE coreCodec, - const INT samplingRate, const INT stereoConfigIndex, + const INT samplingRate, const INT frameSize, + const INT stereoConfigIndex, const INT coreSbrFrameLengthIndex, const INT configBytes, const UCHAR configMode, UCHAR *configChanged);
View file
fdk-aac-2.0.0.tar.gz/libMpegTPDec/src/tpdec_adts.cpp -> fdk-aac-2.0.1.tar.gz/libMpegTPDec/src/tpdec_adts.cpp
Changed
@@ -180,7 +180,8 @@ have channelConfig=0 and no PCE in this frame. */ FDKmemcpy(&oldPce, &pAsc->m_progrConfigElement, sizeof(CProgramConfig)); - valBits = FDKgetValidBits(hBs); + valBits = FDKgetValidBits(hBs) + ADTS_SYNCLENGTH; + if (valBits < ADTS_HEADERLENGTH) { return TRANSPORTDEC_NOT_ENOUGH_BITS; } @@ -208,6 +209,10 @@ adtsHeaderLength = ADTS_HEADERLENGTH; + if (valBits < bs.frame_length * 8) { + goto bail; + } + if (!bs.protection_absent) { FDKcrcReset(&pAdts->crcInfo); FDKpushBack(hBs, 56); /* complete fixed and variable header! */ @@ -216,6 +221,9 @@ } if (!bs.protection_absent && bs.num_raw_blocks > 0) { + if ((INT)FDKgetValidBits(hBs) < bs.num_raw_blocks * 16) { + goto bail; + } for (i = 0; i < bs.num_raw_blocks; i++) { pAdts->rawDataBlockDist[i] = (USHORT)FDKreadBits(hBs, 16); adtsHeaderLength += 16; @@ -233,6 +241,11 @@ USHORT crc_check; FDKcrcEndReg(&pAdts->crcInfo, hBs, crcReg); + + if ((INT)FDKgetValidBits(hBs) < Adts_Length_CrcCheck) { + goto bail; + } + crc_check = FDKreadBits(hBs, Adts_Length_CrcCheck); adtsHeaderLength += Adts_Length_CrcCheck; @@ -346,6 +359,10 @@ FDKmemcpy(&pAdts->bs, &bs, sizeof(STRUCT_ADTS_BS)); return TRANSPORTDEC_OK; + +bail: + FDKpushBack(hBs, adtsHeaderLength); + return TRANSPORTDEC_NOT_ENOUGH_BITS; } int adtsRead_GetRawDataBlockLength(HANDLE_ADTS pAdts, INT blockNum) {
View file
fdk-aac-2.0.0.tar.gz/libMpegTPDec/src/tpdec_asc.cpp -> fdk-aac-2.0.1.tar.gz/libMpegTPDec/src/tpdec_asc.cpp
Changed
@@ -139,7 +139,7 @@ ID_SCE, ID_CPE, ID_CPE, ID_CPE, ID_CPE, ID_SCE, ID_LFE, ID_LFE, ID_SCE, ID_CPE, ID_CPE, ID_SCE, ID_CPE, ID_SCE, ID_SCE, ID_CPE, ID_NONE}; static const MP4_ELEMENT_ID channel_configuration_14[] = { - ID_SCE, ID_CPE, ID_CPE, ID_LAST, ID_CPE, ID_NONE}; + ID_SCE, ID_CPE, ID_CPE, ID_LFE, ID_CPE, ID_NONE}; static const MP4_ELEMENT_ID *channel_configuration_array[] = { channel_configuration_0, channel_configuration_1, @@ -467,6 +467,7 @@ pPce->BackElementIsCpe[1] = 1; pPce->NumChannels += 1; pPce->NumEffectiveChannels += 1; + FDK_FALLTHROUGH; case 11: /* 3/0/3.1ch */ pPce->NumFrontChannelElements += 2; pPce->FrontElementIsCpe[0] = 0; @@ -482,25 +483,30 @@ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ case 14: /* 2/0/0-3/0/2-0.1ch front height */ pPce->FrontElementHeightInfo[2] = 1; /* Top speaker */ - case 7: /* 5/0/2.1ch front */ + FDK_FALLTHROUGH; + case 7: /* 5/0/2.1ch front */ pPce->NumFrontChannelElements += 1; pPce->FrontElementIsCpe[2] = 1; pPce->NumChannels += 2; pPce->NumEffectiveChannels += 2; + FDK_FALLTHROUGH; case 6: /* 3/0/2.1ch */ pPce->NumLfeChannelElements += 1; pPce->NumChannels += 1; + FDK_FALLTHROUGH; case 5: /* 3/0/2.0ch */ case 4: /* 3/0/1.0ch */ pPce->NumBackChannelElements += 1; pPce->BackElementIsCpe[0] = (channelConfig > 4) ? 1 : 0; pPce->NumChannels += (channelConfig > 4) ? 2 : 1; pPce->NumEffectiveChannels += (channelConfig > 4) ? 2 : 1; + FDK_FALLTHROUGH; case 3: /* 3/0/0.0ch */ pPce->NumFrontChannelElements += 1; pPce->FrontElementIsCpe[1] = 1; pPce->NumChannels += 2; pPce->NumEffectiveChannels += 2; + FDK_FALLTHROUGH; case 1: /* 1/0/0.0ch */ pPce->NumFrontChannelElements += 1; pPce->FrontElementIsCpe[0] = 0; @@ -713,6 +719,7 @@ switch (elType) { case ID_CPE: isCpe = 1; + FDK_FALLTHROUGH; case ID_SCE: /* search in front channels */ for (i = 0; i < pPce->NumFrontChannelElements; i++) { @@ -1293,7 +1300,11 @@ /* read elements of the passed channel_configuration until there is ID_NONE */ while ((element = channel_configuration_array[channelConfiguration][j]) != ID_NONE) { - if (element == ID_SCE || element == ID_CPE) { + /* Setup LFE element for upsampling too. This is essential especially for + * channel configs where the LFE element is not at the last position for + * example in channel config 13 or 14. It leads to memory leaks if the setup + * of the LFE element would be done later in the core. */ + if (element == ID_SCE || element == ID_CPE || element == ID_LFE) { error |= cb->cbSbr( cb->cbSbrData, hBs, asc->m_samplingFrequency / dsFactor, asc->m_extensionSamplingFrequency / dsFactor, @@ -1402,17 +1413,23 @@ esc->m_useLdQmfTimeAlign = 1; if (cb->cbSsc != NULL) { ErrorStatus = (TRANSPORTDEC_ERROR)cb->cbSsc( - cb->cbSscData, hBs, asc->m_aot, asc->m_extensionSamplingFrequency, + cb->cbSscData, hBs, asc->m_aot, + asc->m_samplingFrequency << esc->m_sbrSamplingRate, + asc->m_samplesPerFrame << esc->m_sbrSamplingRate, 1, /* stereoConfigIndex */ -1, /* nTimeSlots: read from bitstream */ eldExtLen, asc->configMode, &asc->SacConfigChanged); if (ErrorStatus != TRANSPORTDEC_OK) { return TRANSPORTDEC_PARSE_ERROR; } + if (esc->m_downscaledSamplingFrequency != asc->m_samplingFrequency) { + return TRANSPORTDEC_UNSUPPORTED_FORMAT; /* ELDv2 w/ ELD downscaled + mode not allowed */ + } break; } - /* fall-through */ + FDK_FALLTHROUGH; default: for (cnt = 0; cnt < eldExtLen; cnt++) { FDKreadBits(hBs, 8); @@ -1430,6 +1447,10 @@ if (downscale_fill_nibble != 0x0) { return TRANSPORTDEC_PARSE_ERROR; } + if (esc->m_useLdQmfTimeAlign == 1) { + return TRANSPORTDEC_UNSUPPORTED_FORMAT; /* ELDv2 w/ ELD downscaled + mode not allowed */ + } break; } } @@ -1793,9 +1814,16 @@ if (usc->element[i].m_stereoConfigIndex > 0) { if (cb->cbSsc != NULL) { + int samplesPerFrame = asc->m_samplesPerFrame; + + if (usc->m_sbrRatioIndex == 1) samplesPerFrame <<= 2; + if (usc->m_sbrRatioIndex == 2) + samplesPerFrame = (samplesPerFrame * 8) / 3; + if (usc->m_sbrRatioIndex == 3) samplesPerFrame <<= 1; + /* Mps212Config() ISO/IEC FDIS 23003-3 */ if (cb->cbSsc(cb->cbSscData, hBs, asc->m_aot, - asc->m_extensionSamplingFrequency, + asc->m_extensionSamplingFrequency, samplesPerFrame, usc->element[i].m_stereoConfigIndex, usc->m_coreSbrFrameLengthIndex, 0, /* don't know the length */ @@ -2022,6 +2050,7 @@ break; case ASCEXT_MPS: /* 0x76a */ if (self->m_extensionAudioObjectType == AOT_MPEGS) break; + FDK_FALLTHROUGH; case ASCEXT_LDMPS: /* 0x7cc */ if ((ascExtId == ASCEXT_LDMPS) && (self->m_extensionAudioObjectType == AOT_LD_MPEGS)) @@ -2102,7 +2131,9 @@ self->m_aot = getAOT(bs); self->m_samplingFrequency = getSampleRate(bs, &self->m_samplingFrequencyIndex, 4); - if (self->m_samplingFrequency <= 0) { + if (self->m_samplingFrequency <= 0 || + (self->m_samplingFrequency > 96000 && self->m_aot != 39) || + self->m_samplingFrequency > 4 * 96000) { return TRANSPORTDEC_PARSE_ERROR; } @@ -2159,8 +2190,9 @@ case AOT_MPEGS: if (cb->cbSsc != NULL) { if (cb->cbSsc(cb->cbSscData, bs, self->m_aot, self->m_samplingFrequency, - 1, -1, /* nTimeSlots: read from bitstream */ - 0, /* don't know the length */ + self->m_samplesPerFrame, 1, + -1, /* nTimeSlots: read from bitstream */ + 0, /* don't know the length */ self->configMode, &self->SacConfigChanged)) { return TRANSPORTDEC_UNSUPPORTED_FORMAT; } @@ -2343,10 +2375,17 @@ /*usc->element[elemIdx].m_stereoConfigIndex =*/FDKreadBits(hBs, 2); if (usc->element[elemIdx].m_stereoConfigIndex > 0) { if (cb->cbSsc != NULL) { + int samplesPerFrame = asc->m_samplesPerFrame; + + if (usc->m_sbrRatioIndex == 1) samplesPerFrame <<= 2; + if (usc->m_sbrRatioIndex == 2) + samplesPerFrame = (samplesPerFrame * 8) / 3; + if (usc->m_sbrRatioIndex == 3) samplesPerFrame <<= 1; + ErrorStatus = (TRANSPORTDEC_ERROR)cb->cbSsc( cb->cbSscData, hBs, AOT_DRM_USAC, /* syntax differs from MPEG Mps212Config() */ - asc->m_extensionSamplingFrequency, + asc->m_extensionSamplingFrequency, samplesPerFrame, usc->element[elemIdx].m_stereoConfigIndex, usc->m_coreSbrFrameLengthIndex, 0, /* don't know the length */ asc->configMode, &asc->SacConfigChanged); @@ -2496,6 +2535,7 @@ switch (audioMode) { case 1: /* parametric stereo */ self->m_psPresentFlag = 1; + FDK_FALLTHROUGH; case 0: /* mono */ self->m_channelConfiguration = 1; break;
View file
fdk-aac-2.0.0.tar.gz/libMpegTPDec/src/tpdec_lib.cpp -> fdk-aac-2.0.1.tar.gz/libMpegTPDec/src/tpdec_lib.cpp
Changed
@@ -736,9 +736,9 @@ hTp->parser.latm.m_audioMuxLengthBytes > 0) { int loasOffset; - loasOffset = (hTp->parser.latm.m_audioMuxLengthBytes * 8 + - FDKgetValidBits(hBs)) - - hTp->globalFramePos; + loasOffset = ((INT)hTp->parser.latm.m_audioMuxLengthBytes * 8 + + (INT)FDKgetValidBits(hBs)) - + (INT)hTp->globalFramePos; if (loasOffset != 0) { FDKpushBiDirectional(hBs, loasOffset); /* For ELD and other payloads there is an unknown amount of padding, @@ -871,7 +871,7 @@ int fConfigFound = (pfConfigFound != NULL) ? *pfConfigFound : 0; int startPos; - startPos = FDKgetValidBits(hBs); + startPos = (INT)FDKgetValidBits(hBs); switch (hTp->transportFmt) { case TT_MP4_ADTS: @@ -941,7 +941,7 @@ fTraverseMoreFrames = 0; } syncLayerFrameBits = (hTp->parser.adts.bs.frame_length << 3) - - ((INT)startPos - (INT)FDKgetValidBits(hBs)) - + (startPos - (INT)FDKgetValidBits(hBs)) - syncLength; if (syncLayerFrameBits <= 0) { err = TRANSPORTDEC_SYNC_ERROR; @@ -952,10 +952,11 @@ break; case TT_MP4_LOAS: if (hTp->numberOfRawDataBlocks <= 0) { - syncLayerFrameBits = FDKreadBits(hBs, 13); + syncLayerFrameBits = (INT)FDKreadBits(hBs, 13); hTp->parser.latm.m_audioMuxLengthBytes = syncLayerFrameBits; syncLayerFrameBits <<= 3; } + FDK_FALLTHROUGH; case TT_MP4_LATM_MCP1: case TT_MP4_LATM_MCP0: if (hTp->numberOfRawDataBlocks <= 0) { @@ -974,7 +975,7 @@ hTp->numberOfRawDataBlocks = CLatmDemux_GetNrOfSubFrames(&hTp->parser.latm); if (hTp->transportFmt == TT_MP4_LOAS) { - syncLayerFrameBits -= startPos - FDKgetValidBits(hBs) - (13); + syncLayerFrameBits -= startPos - (INT)FDKgetValidBits(hBs) - (13); } } } else {
View file
fdk-aac-2.0.0.tar.gz/libMpegTPEnc/include/tp_data.h -> fdk-aac-2.0.1.tar.gz/libMpegTPEnc/include/tp_data.h
Changed
@@ -367,7 +367,8 @@ typedef INT (*cbCtrlCFGChange_t)(void *, const CCtrlCFGChange *); typedef INT (*cbSsc_t)(void *, HANDLE_FDK_BITSTREAM, const AUDIO_OBJECT_TYPE coreCodec, - const INT samplingRate, const INT stereoConfigIndex, + const INT samplingRate, const INT frameSize, + const INT stereoConfigIndex, const INT coreSbrFrameLengthIndex, const INT configBytes, const UCHAR configMode, UCHAR *configChanged);
View file
fdk-aac-2.0.0.tar.gz/libMpegTPEnc/src/tpenc_asc.cpp -> fdk-aac-2.0.1.tar.gz/libMpegTPEnc/src/tpenc_asc.cpp
Changed
@@ -795,7 +795,7 @@ const INT eldExtLen = (cb->cbSsc(cb->cbSscData, NULL, config->aot, config->extSamplingRate, 0, - 0, 0, 0, NULL) + + 0, 0, 0, 0, NULL) + 7) >> 3; INT cnt = eldExtLen; @@ -818,7 +818,7 @@ } cb->cbSsc(cb->cbSscData, hBs, config->aot, config->extSamplingRate, 0, 0, 0, - 0, NULL); + 0, 0, NULL); } if (config->downscaleSamplingRate != 0 &&
View file
fdk-aac-2.0.0.tar.gz/libMpegTPEnc/src/tpenc_lib.cpp -> fdk-aac-2.0.1.tar.gz/libMpegTPEnc/src/tpenc_lib.cpp
Changed
@@ -212,6 +212,7 @@ for potential matrix mixdown */ break; } + FDK_FALLTHROUGH; case TT_MP4_LOAS: /* PCE in ASC if chChonfig==0 */ case TT_MP4_LATM_MCP1: /* PCE in ASC if chChonfig==0 */ default:
View file
fdk-aac-2.0.0.tar.gz/libPCMutils/src/pcmdmx_lib.cpp -> fdk-aac-2.0.1.tar.gz/libPCMutils/src/pcmdmx_lib.cpp
Changed
@@ -583,6 +583,9 @@ (channelType[ch] & 0x0F) - 1, 0); /* Assign all undefined channels (ACT_NONE) to front channels. */ + if (channelIndices[ch] >= numCh[channelType[ch] >> 4][chGrp]) + return PCMDMX_INVALID_CH_CONFIG; + spkrPos[ch] = getSpeakerPos(channelType[ch], channelIndices[ch], numCh[channelType[ch] >> 4][chGrp]); @@ -1043,6 +1046,7 @@ case CH_MODE_3_2_1_0: isValidCfg = FALSE; err = PCMDMX_INVALID_MODE; + FDK_FALLTHROUGH; case CH_MODE_3_0_3_1: /* chCfg 11 */ /* 6.1ch: C' = C; L' = L; R' = R; LFE' = LFE; Ls' = Ls*dmix_a_idx + Cs*dmix_b_idx; @@ -1080,9 +1084,11 @@ LEFT_REAR_CHANNEL, FL2FXCONST_DMX(0.5f), 1); dmxSetChannel(mixFactors, mixScales, LEFT_REAR_CHANNEL, LEFT_REAR_CHANNEL, FL2FXCONST_DMX(0.5f), 1); + FDK_FALLTHROUGH; case CH_MODE_5_2_1_0: isValidCfg = FALSE; err = PCMDMX_INVALID_MODE; + FDK_FALLTHROUGH; case CH_MODE_5_0_2_1: /* chCfg 7 || 14 */ if (inChCfg == 14) { /* 7.1ch Front Height: C' = C; Ls' = Ls; Rs' = Rs; LFE' = LFE;
View file
fdk-aac-2.0.0.tar.gz/libSACdec/include/sac_dec_lib.h -> fdk-aac-2.0.1.tar.gz/libSACdec/include/sac_dec_lib.h
Changed
@@ -315,9 +315,9 @@ */ SACDEC_ERROR mpegSurroundDecoder_Config( CMpegSurroundDecoder *pMpegSurroundDecoder, HANDLE_FDK_BITSTREAM hBs, - AUDIO_OBJECT_TYPE coreCodec, INT samplingRate, INT stereoConfigIndex, - INT coreSbrFrameLengthIndex, INT configBytes, const UCHAR configMode, - UCHAR *configChanged); + AUDIO_OBJECT_TYPE coreCodec, INT samplingRate, INT frameSize, + INT stereoConfigIndex, INT coreSbrFrameLengthIndex, INT configBytes, + const UCHAR configMode, UCHAR *configChanged); SACDEC_ERROR mpegSurroundDecoder_ConfigureQmfDomain(
View file
fdk-aac-2.0.0.tar.gz/libSACdec/src/sac_bitdec.cpp -> fdk-aac-2.0.1.tar.gz/libSACdec/src/sac_bitdec.cpp
Changed
@@ -291,13 +291,13 @@ if (sacHeaderLen == 127) { sacHeaderLen += FDKreadBits(bitstream, 16); } - numFillBits = FDKgetValidBits(bitstream); + numFillBits = (INT)FDKgetValidBits(bitstream); err = SpatialDecParseSpecificConfig(bitstream, pSpatialSpecificConfig, sacHeaderLen, coreCodec); numFillBits -= - FDKgetValidBits(bitstream); /* the number of read bits (tmpBits) */ + (INT)FDKgetValidBits(bitstream); /* the number of read bits (tmpBits) */ numFillBits = (8 * sacHeaderLen) - numFillBits; if (numFillBits < 0) { /* Parsing went wrong */ @@ -325,6 +325,8 @@ INT coreSbrFrameLengthIndex) { int i; + FDKmemclear(pSpatialSpecificConfig, sizeof(SPATIAL_SPECIFIC_CONFIG)); + pSpatialSpecificConfig->stereoConfigIndex = stereoConfigIndex; pSpatialSpecificConfig->coreSbrFrameLengthIndex = coreSbrFrameLengthIndex; pSpatialSpecificConfig->freqRes = @@ -447,6 +449,8 @@ int numHeaderBits; int cfgStartPos, bitsAvailable; + FDKmemclear(pSpatialSpecificConfig, sizeof(SPATIAL_SPECIFIC_CONFIG)); + cfgStartPos = FDKgetValidBits(bitstream); /* It might be that we do not know the SSC length beforehand. */ if (sacHeaderLen == 0) { @@ -513,6 +517,10 @@ pSpatialSpecificConfig->tempShapeConfig = (SPATIALDEC_TS_CONF)FDKreadBits(bitstream, 2); + if (pSpatialSpecificConfig->tempShapeConfig > 2) { + return MPS_PARSE_ERROR; /* reserved value */ + } + pSpatialSpecificConfig->decorrConfig = (SPATIALDEC_DECORR_CONF)FDKreadBits(bitstream, 2); if (pSpatialSpecificConfig->decorrConfig > 2) { @@ -568,16 +576,18 @@ numHeaderBits = cfgStartPos - (INT)FDKgetValidBits(bitstream); bitsAvailable -= numHeaderBits; + if (bitsAvailable < 0) { + err = MPS_PARSE_ERROR; + goto bail; + } pSpatialSpecificConfig->sacExtCnt = 0; pSpatialSpecificConfig->bResidualCoding = 0; - if ((err == MPS_OK) && (bitsAvailable > 0)) { - err = SpatialDecParseExtensionConfig( - bitstream, pSpatialSpecificConfig, pSpatialSpecificConfig->nOttBoxes, - pSpatialSpecificConfig->nTttBoxes, - pSpatialSpecificConfig->nOutputChannels, bitsAvailable); - } + err = SpatialDecParseExtensionConfig( + bitstream, pSpatialSpecificConfig, pSpatialSpecificConfig->nOttBoxes, + pSpatialSpecificConfig->nTttBoxes, + pSpatialSpecificConfig->nOutputChannels, bitsAvailable); FDKbyteAlign( bitstream, @@ -1864,6 +1874,16 @@ frame->numParameterSets = fixMin(MAX_PARAMETER_SETS, frame->numParameterSets + 1); frame->paramSlot[frame->numParameterSets - 1] = self->timeSlots - 1; + + for (int p = 0; p < frame->numParameterSets; p++) { + if (frame->paramSlot[p] > self->timeSlots - 1) { + frame->paramSlot[p] = self->timeSlots - 1; + err = MPS_PARSE_ERROR; + } + } + if (err != MPS_OK) { + goto bail; + } } bail:
View file
fdk-aac-2.0.0.tar.gz/libSACdec/src/sac_dec_lib.cpp -> fdk-aac-2.0.1.tar.gz/libSACdec/src/sac_dec_lib.cpp
Changed
@@ -237,6 +237,11 @@ SPATIAL_DEC_CONFIG decConfig; }; +SACDEC_ERROR +static sscCheckOutOfBand(const SPATIAL_SPECIFIC_CONFIG *pSsc, + const INT coreCodec, const INT sampleRate, + const INT frameSize); + static SACDEC_ERROR sscParseCheck(const SPATIAL_SPECIFIC_CONFIG *pSsc); /** @@ -694,11 +699,13 @@ **/ SACDEC_ERROR mpegSurroundDecoder_Config( CMpegSurroundDecoder *pMpegSurroundDecoder, HANDLE_FDK_BITSTREAM hBs, - AUDIO_OBJECT_TYPE coreCodec, INT samplingRate, INT stereoConfigIndex, - INT coreSbrFrameLengthIndex, INT configBytes, const UCHAR configMode, - UCHAR *configChanged) { + AUDIO_OBJECT_TYPE coreCodec, INT samplingRate, INT frameSize, + INT stereoConfigIndex, INT coreSbrFrameLengthIndex, INT configBytes, + const UCHAR configMode, UCHAR *configChanged) { SACDEC_ERROR err = MPS_OK; SPATIAL_SPECIFIC_CONFIG spatialSpecificConfig; + SPATIAL_SPECIFIC_CONFIG *pSsc = + &pMpegSurroundDecoder->spatialSpecificConfigBackup; switch (coreCodec) { case AOT_DRM_USAC: @@ -709,6 +716,7 @@ err = SpatialDecParseMps212Config( hBs, &spatialSpecificConfig, samplingRate, coreCodec, stereoConfigIndex, coreSbrFrameLengthIndex); + pSsc = &spatialSpecificConfig; } else { err = SpatialDecParseMps212Config( hBs, &pMpegSurroundDecoder->spatialSpecificConfigBackup, @@ -723,6 +731,7 @@ * into temporarily allocated structure */ err = SpatialDecParseSpecificConfig(hBs, &spatialSpecificConfig, configBytes, coreCodec); + pSsc = &spatialSpecificConfig; } else { err = SpatialDecParseSpecificConfig( hBs, &pMpegSurroundDecoder->spatialSpecificConfigBackup, @@ -738,14 +747,21 @@ goto bail; } + err = sscCheckOutOfBand(pSsc, coreCodec, samplingRate, frameSize); + + if (err != MPS_OK) { + goto bail; + } + if (configMode & AC_CM_DET_CFG_CHANGE) { return err; } if (configMode & AC_CM_ALLOC_MEM) { if (*configChanged) { - if ((err = mpegSurroundDecoder_Open(&pMpegSurroundDecoder, - stereoConfigIndex, NULL))) { + err = mpegSurroundDecoder_Open(&pMpegSurroundDecoder, stereoConfigIndex, + NULL); + if (err) { return err; } } @@ -815,29 +831,9 @@ * \return MPS_OK on sucess, and else on parse error. */ static SACDEC_ERROR sscParseCheck(const SPATIAL_SPECIFIC_CONFIG *pSsc) { - SACDEC_ERROR err = MPS_OK; - if (pSsc->samplingFreq > 96000) return MPS_PARSE_ERROR; if (pSsc->samplingFreq < 8000) return MPS_PARSE_ERROR; - switch (pSsc->freqRes) { - case SPATIALDEC_FREQ_RES_28: - case SPATIALDEC_FREQ_RES_20: - case SPATIALDEC_FREQ_RES_14: - case SPATIALDEC_FREQ_RES_10: - case SPATIALDEC_FREQ_RES_23: - case SPATIALDEC_FREQ_RES_15: - case SPATIALDEC_FREQ_RES_12: - case SPATIALDEC_FREQ_RES_9: - case SPATIALDEC_FREQ_RES_7: - case SPATIALDEC_FREQ_RES_5: - case SPATIALDEC_FREQ_RES_4: - break; - case SPATIALDEC_FREQ_RES_40: /* 40 doesn't exist in ISO/IEC 23003-1 */ - default: - return MPS_PARSE_ERROR; - } - if ((pSsc->treeConfig < 0) || (pSsc->treeConfig > 7)) { return MPS_PARSE_ERROR; } @@ -846,17 +842,9 @@ return MPS_PARSE_ERROR; } - if (pSsc->tempShapeConfig == 3) { - return MPS_PARSE_ERROR; - } - - if (pSsc->decorrConfig == 3) { - return MPS_PARSE_ERROR; - } - /* now we are sure there were no parsing errors */ - return err; + return MPS_OK; } /** @@ -1024,6 +1012,11 @@ FDK_ASSERT(pSsc != NULL); + /* check ssc for parse errors */ + if (sscParseCheck(pSsc) != MPS_OK) { + err = MPS_PARSE_ERROR; + } + /* core fs and mps fs must match */ if (pSsc->samplingFreq != sampleRate) { err = MPS_PARSE_ERROR /* MPEGSDEC_SSC_PARSE_ERROR */; @@ -1087,12 +1080,90 @@ if (coreCodec == AOT_ER_AAC_ELD) { pGC->flags_requested |= QMF_FLAG_MPSLDFB; + pGC->flags_requested &= ~QMF_FLAG_CLDFB; } return err; } /** + * \brief Check out-of-band config + * + * \param pSsc spatial specific config handle. + * \param coreCodec core codec. + * \param sampleRate sampling frequency. + * + * \return errorStatus + */ +SACDEC_ERROR +sscCheckOutOfBand(const SPATIAL_SPECIFIC_CONFIG *pSsc, const INT coreCodec, + const INT sampleRate, const INT frameSize) { + FDK_ASSERT(pSsc != NULL); + int qmfBands = 0; + + /* check ssc for parse errors */ + if (sscParseCheck(pSsc) != MPS_OK) { + return MPS_PARSE_ERROR; + } + + switch (coreCodec) { + case AOT_USAC: + case AOT_DRM_USAC: + /* ISO/IEC 23003-1:2007(E), Chapter 6.3.3, Support for lower and higher + * sampling frequencies */ + if (pSsc->samplingFreq >= 55426) { + return MPS_PARSE_ERROR; + } + break; + case AOT_ER_AAC_LD: + case AOT_ER_AAC_ELD: + /* core fs and mps fs must match */ + if (pSsc->samplingFreq != sampleRate) { + return MPS_PARSE_ERROR; + } + + /* ISO/IEC 14496-3:2009 FDAM 3: Chapter 1.5.2.3, Levels for the Low Delay + * AAC v2 profile */ + if (pSsc->samplingFreq > 48000) { + return MPS_PARSE_ERROR; + } + + qmfBands = mpegSurroundDecoder_GetNrOfQmfBands(pSsc, pSsc->samplingFreq); + switch (frameSize) { + case 480: + if (!((qmfBands == 32) && (pSsc->nTimeSlots == 15))) { + return MPS_PARSE_ERROR; + } + break; + case 960: + if (!((qmfBands == 64) && (pSsc->nTimeSlots == 15))) { + return MPS_PARSE_ERROR; + } + break; + case 512: + if (!(((qmfBands == 32) && (pSsc->nTimeSlots == 16)) || + ((qmfBands == 64) && (pSsc->nTimeSlots == 8)))) { + return MPS_PARSE_ERROR; + } + break;
View file
fdk-aac-2.0.0.tar.gz/libSBRdec/src/env_calc.cpp -> fdk-aac-2.0.1.tar.gz/libSBRdec/src/env_calc.cpp
Changed
@@ -626,7 +626,8 @@ total_power_low >>= diff; total_power_low_sf = new_summand_sf; } else if (new_summand_sf < total_power_low_sf) { - new_summand >>= total_power_low_sf - new_summand_sf; + new_summand >>= + fMin(DFRACT_BITS - 1, total_power_low_sf - new_summand_sf); } total_power_low += (new_summand >> preShift2); @@ -638,7 +639,8 @@ fMin(DFRACT_BITS - 1, new_summand_sf - total_power_high_sf); total_power_high_sf = new_summand_sf; } else if (new_summand_sf < total_power_high_sf) { - new_summand >>= total_power_high_sf - new_summand_sf; + new_summand >>= + fMin(DFRACT_BITS - 1, total_power_high_sf - new_summand_sf); } total_power_high += (new_summand >> preShift2); @@ -1561,13 +1563,14 @@ adjustTimeSlotHQ_GainAndNoise( &analysBufferReal[j][lowSubband], &analysBufferImag[j][lowSubband], h_sbr_cal_env, pNrgs, - lowSubband, noSubbands, scale_change, smooth_ratio, noNoiseFlag, - filtBufferNoiseShift); + lowSubband, noSubbands, fMin(scale_change, DFRACT_BITS - 1), + smooth_ratio, noNoiseFlag, filtBufferNoiseShift); } else { adjustTimeSlotHQ(&analysBufferReal[j][lowSubband], &analysBufferImag[j][lowSubband], h_sbr_cal_env, - pNrgs, lowSubband, noSubbands, scale_change, - smooth_ratio, noNoiseFlag, filtBufferNoiseShift); + pNrgs, lowSubband, noSubbands, + fMin(scale_change, DFRACT_BITS - 1), smooth_ratio, + noNoiseFlag, filtBufferNoiseShift); } } else { FDK_ASSERT(!iTES_enable); /* not supported */ @@ -1575,13 +1578,14 @@ /* FDKmemset(analysBufferReal[j], 0, 64 * sizeof(FIXP_DBL)); */ adjustTimeSlot_EldGrid(&analysBufferReal[j][lowSubband], pNrgs, &h_sbr_cal_env->harmIndex, lowSubband, - noSubbands, scale_change, noNoiseFlag, - &h_sbr_cal_env->phaseIndex, + noSubbands, + fMin(scale_change, DFRACT_BITS - 1), + noNoiseFlag, &h_sbr_cal_env->phaseIndex, EXP2SCALE(adj_e) - sbrScaleFactor->lb_scale); } else { adjustTimeSlotLC(&analysBufferReal[j][lowSubband], pNrgs, &h_sbr_cal_env->harmIndex, lowSubband, noSubbands, - scale_change, noNoiseFlag, + fMin(scale_change, DFRACT_BITS - 1), noNoiseFlag, &h_sbr_cal_env->phaseIndex); } }
View file
fdk-aac-2.0.0.tar.gz/libSBRdec/src/env_dec.cpp -> fdk-aac-2.0.1.tar.gz/libSBRdec/src/env_dec.cpp
Changed
@@ -435,8 +435,8 @@ /* Noisefloor levels are always cleared ... */ h_sbr_data->domain_vec_noise[0] = 1; - for (i = 0; i < hHeaderData->freqBandData.nNfb; i++) - h_sbr_data->sbrNoiseFloorLevel[i] = FL2FXCONST_SGL(0.0f); + FDKmemclear(h_sbr_data->sbrNoiseFloorLevel, + sizeof(h_sbr_data->sbrNoiseFloorLevel)); /* ... and so are the sines */ FDKmemclear(h_sbr_data->addHarmonics, @@ -506,15 +506,20 @@ */ for (i = 0; i < hHeaderData->freqBandData.nSfb[1]; i++) { /* Former Level-Channel will be used for both channels */ - if (h_prev_data->coupling == COUPLING_BAL) - h_prev_data->sfb_nrg_prev[i] = otherChannel->sfb_nrg_prev[i]; + if (h_prev_data->coupling == COUPLING_BAL) { + h_prev_data->sfb_nrg_prev[i] = + (otherChannel != NULL) ? otherChannel->sfb_nrg_prev[i] + : (FIXP_SGL)SBR_ENERGY_PAN_OFFSET; + } /* Former L/R will be combined as the new Level-Channel */ - else if (h_sbr_data->coupling == COUPLING_LEVEL) + else if (h_sbr_data->coupling == COUPLING_LEVEL && + otherChannel != NULL) { h_prev_data->sfb_nrg_prev[i] = (h_prev_data->sfb_nrg_prev[i] + otherChannel->sfb_nrg_prev[i]) >> 1; - else if (h_sbr_data->coupling == COUPLING_BAL) + } else if (h_sbr_data->coupling == COUPLING_BAL) { h_prev_data->sfb_nrg_prev[i] = (FIXP_SGL)SBR_ENERGY_PAN_OFFSET; + } } } }
View file
fdk-aac-2.0.0.tar.gz/libSBRdec/src/env_extr.cpp -> fdk-aac-2.0.1.tar.gz/libSBRdec/src/env_extr.cpp
Changed
@@ -1145,10 +1145,10 @@ \brief Generates frame info for FIXFIXonly frame class used for low delay version - \return nothing + \return zero for error, one for correct. ****************************************************************************/ -static void generateFixFixOnly(FRAME_INFO *hSbrFrameInfo, int tranPosInternal, - int numberTimeSlots, const UINT flags) { +static int generateFixFixOnly(FRAME_INFO *hSbrFrameInfo, int tranPosInternal, + int numberTimeSlots, const UINT flags) { int nEnv, i, tranIdx; const int *pTable; @@ -1159,12 +1159,11 @@ case 15: pTable = FDK_sbrDecoder_envelopeTable_15[tranPosInternal]; break; - default: - FDK_ASSERT(0); - /* fall through */ case 16: pTable = FDK_sbrDecoder_envelopeTable_16[tranPosInternal]; break; + default: + return 0; } /* look number of envelopes in table */ @@ -1187,6 +1186,8 @@ /* nEnv is always > 1, so nNoiseEnvelopes is always 2 (IEC 14496-3 4.6.19.3.2) */ hSbrFrameInfo->nNoiseEnvelopes = 2; + + return 1; } /*! @@ -1230,7 +1231,9 @@ } /* calculate borders according to the transient position */ - generateFixFixOnly(pFrameInfo, temp, numberTimeSlots, flags); + if (!generateFixFixOnly(pFrameInfo, temp, numberTimeSlots, flags)) { + return 0; + } /* decode freq res: */ for (k = 0; k < pFrameInfo->nEnvelopes; k++) {
View file
fdk-aac-2.0.0.tar.gz/libSBRdec/src/hbe.cpp -> fdk-aac-2.0.1.tar.gz/libSBRdec/src/hbe.cpp
Changed
@@ -1056,6 +1056,10 @@ const FIXP_QTW* tmp_t_sin; hQmfTransposer->startBand = FreqBandTable[0][0]; + FDK_ASSERT((!hQmfTransposer->bSbr41 && hQmfTransposer->startBand <= 32) || + (hQmfTransposer->bSbr41 && + hQmfTransposer->startBand <= + 16)); /* is checked by resetFreqBandTables() */ hQmfTransposer->stopBand = FreqBandTable[0][NSfb[0]]; hQmfTransposer->synthSize =
View file
fdk-aac-2.0.0.tar.gz/libSBRdec/src/lpp_tran.cpp -> fdk-aac-2.0.1.tar.gz/libSBRdec/src/lpp_tran.cpp
Changed
@@ -118,6 +118,10 @@ \sa lppTransposer(), main_audio.cpp, sbr_scale.h, \ref documentationOverview */ +#ifdef __ANDROID__ +#include "log/log.h" +#endif + #include "lpp_tran.h" #include "sbr_ram.h" @@ -295,7 +299,6 @@ int ovLowBandShift; int lowBandShift; /* int ovHighBandShift;*/ - int targetStopBand; alphai[0] = FL2FXCONST_SGL(0.0f); alphai[1] = FL2FXCONST_SGL(0.0f); @@ -311,25 +314,34 @@ autoCorrLength = pSettings->nCols + pSettings->overlap; - /* Set upper subbands to zero: - This is required in case that the patches do not cover the complete - highband (because the last patch would be too short). Possible - optimization: Clearing bands up to usb would be sufficient here. */ - targetStopBand = patchParam[pSettings->noOfPatches - 1].targetStartBand + - patchParam[pSettings->noOfPatches - 1].numBandsInPatch; + if (pSettings->noOfPatches > 0) { + /* Set upper subbands to zero: + This is required in case that the patches do not cover the complete + highband (because the last patch would be too short). Possible + optimization: Clearing bands up to usb would be sufficient here. */ + int targetStopBand = + patchParam[pSettings->noOfPatches - 1].targetStartBand + + patchParam[pSettings->noOfPatches - 1].numBandsInPatch; - int memSize = ((64) - targetStopBand) * sizeof(FIXP_DBL); + int memSize = ((64) - targetStopBand) * sizeof(FIXP_DBL); - if (!useLP) { - for (i = startSample; i < stopSampleClear; i++) { - FDKmemclear(&qmfBufferReal[i][targetStopBand], memSize); - FDKmemclear(&qmfBufferImag[i][targetStopBand], memSize); - } - } else { - for (i = startSample; i < stopSampleClear; i++) { - FDKmemclear(&qmfBufferReal[i][targetStopBand], memSize); + if (!useLP) { + for (i = startSample; i < stopSampleClear; i++) { + FDKmemclear(&qmfBufferReal[i][targetStopBand], memSize); + FDKmemclear(&qmfBufferImag[i][targetStopBand], memSize); + } + } else { + for (i = startSample; i < stopSampleClear; i++) { + FDKmemclear(&qmfBufferReal[i][targetStopBand], memSize); + } } } +#ifdef __ANDROID__ + else { + // Safetynet logging + android_errorWriteLog(0x534e4554, "112160868"); + } +#endif /* init bwIndex for each patch */ FDKmemclear(bwIndex, sizeof(bwIndex)); @@ -874,7 +886,6 @@ int ovLowBandShift; int lowBandShift; /* int ovHighBandShift;*/ - int targetStopBand; alphai[0] = FL2FXCONST_SGL(0.0f); alphai[1] = FL2FXCONST_SGL(0.0f); @@ -889,19 +900,28 @@ autoCorrLength = pSettings->nCols + pSettings->overlap; - /* Set upper subbands to zero: - This is required in case that the patches do not cover the complete - highband (because the last patch would be too short). Possible - optimization: Clearing bands up to usb would be sufficient here. */ - targetStopBand = patchParam[pSettings->noOfPatches - 1].targetStartBand + - patchParam[pSettings->noOfPatches - 1].numBandsInPatch; + if (pSettings->noOfPatches > 0) { + /* Set upper subbands to zero: + This is required in case that the patches do not cover the complete + highband (because the last patch would be too short). Possible + optimization: Clearing bands up to usb would be sufficient here. */ + int targetStopBand = + patchParam[pSettings->noOfPatches - 1].targetStartBand + + patchParam[pSettings->noOfPatches - 1].numBandsInPatch; - int memSize = ((64) - targetStopBand) * sizeof(FIXP_DBL); + int memSize = ((64) - targetStopBand) * sizeof(FIXP_DBL); - for (i = startSample; i < stopSampleClear; i++) { - FDKmemclear(&qmfBufferReal[i][targetStopBand], memSize); - FDKmemclear(&qmfBufferImag[i][targetStopBand], memSize); + for (i = startSample; i < stopSampleClear; i++) { + FDKmemclear(&qmfBufferReal[i][targetStopBand], memSize); + FDKmemclear(&qmfBufferImag[i][targetStopBand], memSize); + } + } +#ifdef __ANDROID__ + else { + // Safetynet logging + android_errorWriteLog(0x534e4554, "112160868"); } +#endif /* Calc common low band scale factor
View file
fdk-aac-2.0.0.tar.gz/libSBRdec/src/psbitdec.cpp -> fdk-aac-2.0.1.tar.gz/libSBRdec/src/psbitdec.cpp
Changed
@@ -312,6 +312,7 @@ if (pBsData->bEnableIid) { pBsData->bFineIidQ = h_ps_d->specificTo.mpeg.bPrevFrameFineIidQ; + pBsData->freqResIid = h_ps_d->specificTo.mpeg.prevFreqResIid; for (gr = 0; gr < NO_HI_RES_IID_BINS; gr++) { pBsData->aaIidIndex[pBsData->noEnv - 1][gr] = h_ps_d->specificTo.mpeg.aIidPrevFrameIndex[gr]; @@ -323,6 +324,7 @@ } if (pBsData->bEnableIcc) { + pBsData->freqResIcc = h_ps_d->specificTo.mpeg.prevFreqResIcc; for (gr = 0; gr < NO_HI_RES_ICC_BINS; gr++) { pBsData->aaIccIndex[pBsData->noEnv - 1][gr] = h_ps_d->specificTo.mpeg.aIccPrevFrameIndex[gr]; @@ -337,6 +339,12 @@ /* Update previous frame Iid quantization */ h_ps_d->specificTo.mpeg.bPrevFrameFineIidQ = pBsData->bFineIidQ; + /* Update previous frequency resolution for IID */ + h_ps_d->specificTo.mpeg.prevFreqResIid = pBsData->freqResIid; + + /* Update previous frequency resolution for ICC */ + h_ps_d->specificTo.mpeg.prevFreqResIcc = pBsData->freqResIcc; + /* Update previous frame index buffers */ for (gr = 0; gr < NO_HI_RES_IID_BINS; gr++) { h_ps_d->specificTo.mpeg.aIidPrevFrameIndex[gr] =
View file
fdk-aac-2.0.0.tar.gz/libSBRdec/src/psdec.h -> fdk-aac-2.0.1.tar.gz/libSBRdec/src/psdec.h
Changed
@@ -275,7 +275,11 @@ SCHAR aIccPrevFrameIndex[NO_HI_RES_ICC_BINS]; /*!< The ICC index for previous frame */ UCHAR - bPrevFrameFineIidQ; /*!< The IID quantization of the previous frame */ + bPrevFrameFineIidQ; /*!< The IID quantization of the previous frame */ + UCHAR prevFreqResIid; /*!< Frequency resolution for IID of the previous + frame */ + UCHAR prevFreqResIcc; /*!< Frequency resolution for ICC of the previous + frame */ UCHAR lastUsb; /*!< uppermost WMF delay band of last frame */ FIXP_DBL pHybridAnaStatesLFdmx
View file
fdk-aac-2.0.0.tar.gz/libSBRdec/src/sbr_dec.cpp -> fdk-aac-2.0.1.tar.gz/libSBRdec/src/sbr_dec.cpp
Changed
@@ -1248,7 +1248,7 @@ hSbrDec->savedStates = 0; - if (flags & SBRDEC_USAC_HARMONICSBR) { + if ((flags & SBRDEC_USAC_HARMONICSBR) && applySbrProc) { sbrError = QmfTransposerReInit(hSbrDec->hHBE, hHeaderData->freqBandData.freqBandTable, hHeaderData->freqBandData.nSfb);
View file
fdk-aac-2.0.0.tar.gz/libSBRdec/src/sbrdecoder.cpp -> fdk-aac-2.0.1.tar.gz/libSBRdec/src/sbrdecoder.cpp
Changed
@@ -1150,6 +1150,11 @@ int lastSlot, lastHdrSlot = 0, thisHdrSlot = 0; + if (*count <= 0) { + setFrameErrorFlag(self->pSbrElement[elementIndex], FRAME_ERROR); + return SBRDEC_OK; + } + /* SBR sanity checks */ if (self == NULL) { errorStatus = SBRDEC_NOT_INITIALIZED; @@ -1677,6 +1682,9 @@ /* reset */ if (hSbrHeader->status & SBRDEC_HDR_STAT_RESET) { int ch; + int applySbrProc = (hSbrHeader->syncState == SBR_ACTIVE || + (hSbrHeader->frameErrorFlag == 0 && + hSbrHeader->syncState == SBR_HEADER)); for (ch = 0; ch < numElementChannels; ch++) { SBR_ERROR errorStatusTmp = SBRDEC_OK; @@ -1688,7 +1696,9 @@ hSbrHeader->syncState = UPSAMPLING; } } - hSbrHeader->status &= ~SBRDEC_HDR_STAT_RESET; + if (applySbrProc) { + hSbrHeader->status &= ~SBRDEC_HDR_STAT_RESET; + } } /* decoding */
View file
fdk-aac-2.0.0.tar.gz/libSYS/include/machine_type.h -> fdk-aac-2.0.1.tar.gz/libSYS/include/machine_type.h
Changed
@@ -379,6 +379,26 @@ #define LNK_SECTION_L1_DATA_A #define LNK_SECTION_L1_DATA_B +/************************************************** + * Macros regarding static code analysis + **************************************************/ +#ifdef __cplusplus +#if !defined(__has_cpp_attribute) +#define __has_cpp_attribute(x) 0 +#endif +#if defined(__clang__) && __has_cpp_attribute(clang::fallthrough) +#define FDK_FALLTHROUGH [[clang::fallthrough]] +#endif +#endif + +#ifndef FDK_FALLTHROUGH +#if defined(__GNUC__) && (__GNUC__ >= 7) +#define FDK_FALLTHROUGH __attribute__((fallthrough)) +#else +#define FDK_FALLTHROUGH +#endif +#endif + #ifdef _MSC_VER /* * Sometimes certain features are excluded from compilation and therefore the
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.