aboutsummaryrefslogtreecommitdiffstats
path: root/libSBRdec/src
diff options
context:
space:
mode:
Diffstat (limited to 'libSBRdec/src')
-rw-r--r--libSBRdec/src/arm/lpp_tran_arm.cpp5
-rw-r--r--libSBRdec/src/psbitdec.cpp2
-rw-r--r--libSBRdec/src/psdec.cpp22
-rw-r--r--libSBRdec/src/sbr_dec.cpp4
-rw-r--r--libSBRdec/src/sbrdecoder.cpp7
5 files changed, 31 insertions, 9 deletions
diff --git a/libSBRdec/src/arm/lpp_tran_arm.cpp b/libSBRdec/src/arm/lpp_tran_arm.cpp
index 78bbc2c..028a26f 100644
--- a/libSBRdec/src/arm/lpp_tran_arm.cpp
+++ b/libSBRdec/src/arm/lpp_tran_arm.cpp
@@ -97,7 +97,10 @@ amm-info@iis.fraunhofer.de
#ifdef FUNCTION_LPPTRANSPOSER_func1
/* Note: This code requires only 43 cycles per iteration instead of 61 on ARM926EJ-S */
-__attribute__ ((noinline)) static void lppTransposer_func1(
+#ifdef __GNUC__
+__attribute__ ((noinline))
+#endif
+static void lppTransposer_func1(
FIXP_DBL *lowBandReal,
FIXP_DBL *lowBandImag,
FIXP_DBL **qmfBufferReal,
diff --git a/libSBRdec/src/psbitdec.cpp b/libSBRdec/src/psbitdec.cpp
index 29bddf7..ec6e484 100644
--- a/libSBRdec/src/psbitdec.cpp
+++ b/libSBRdec/src/psbitdec.cpp
@@ -498,7 +498,7 @@ ReadPsData (HANDLE_PS_DEC h_ps_d, /*!< handle to struct PS_DEC */
h_ps_d->bPsDataAvail[h_ps_d->bsReadSlot] = ppt_none;
/* discard all remaining bits */
nBitsLeft -= startbits - FDKgetValidBits(hBitBuf);
- while (nBitsLeft) {
+ while (nBitsLeft > 0) {
int i = nBitsLeft;
if (i>8) {
i = 8;
diff --git a/libSBRdec/src/psdec.cpp b/libSBRdec/src/psdec.cpp
index 965917a..1729f90 100644
--- a/libSBRdec/src/psdec.cpp
+++ b/libSBRdec/src/psdec.cpp
@@ -938,13 +938,13 @@ void initSlotBasedRotation( HANDLE_PS_DEC h_ps_d, /*!< pointer to the module sta
INT group = 0;
INT bin = 0;
- INT noIidSteps;
+ INT noIidSteps, noFactors;
/* const UCHAR *pQuantizedIIDs;*/
FIXP_SGL invL;
FIXP_DBL ScaleL, ScaleR;
- FIXP_DBL Alpha, Beta;
+ FIXP_DBL Alpha, Beta, AlphasValue;
FIXP_DBL h11r, h12r, h21r, h22r;
const FIXP_DBL *PScaleFactors;
@@ -984,6 +984,7 @@ void initSlotBasedRotation( HANDLE_PS_DEC h_ps_d, /*!< pointer to the module sta
{
PScaleFactors = ScaleFactorsFine; /* values are shiftet right by one */
noIidSteps = NO_IID_STEPS_FINE;
+ noFactors = NO_IID_LEVELS_FINE;
/*pQuantizedIIDs = quantizedIIDsFine;*/
}
@@ -991,6 +992,7 @@ void initSlotBasedRotation( HANDLE_PS_DEC h_ps_d, /*!< pointer to the module sta
{
PScaleFactors = ScaleFactors; /* values are shiftet right by one */
noIidSteps = NO_IID_STEPS;
+ noFactors = NO_IID_LEVELS;
/*pQuantizedIIDs = quantizedIIDs;*/
}
@@ -1012,11 +1014,17 @@ void initSlotBasedRotation( HANDLE_PS_DEC h_ps_d, /*!< pointer to the module sta
/* ScaleR and ScaleL are scaled by 1 shift right */
- ScaleR = PScaleFactors[noIidSteps + h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin]];
- ScaleL = PScaleFactors[noIidSteps - h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin]];
-
- Beta = fMult (fMult( Alphas[h_ps_d->specificTo.mpeg.coef.aaIccIndexMapped[env][bin]], ( ScaleR - ScaleL )), FIXP_SQRT05);
- Alpha = Alphas[h_ps_d->specificTo.mpeg.coef.aaIccIndexMapped[env][bin]]>>1;
+ ScaleL = ScaleR = 0;
+ if (noIidSteps + h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin] >= 0 && noIidSteps + h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin] < noFactors)
+ ScaleR = PScaleFactors[noIidSteps + h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin]];
+ if (noIidSteps - h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin] >= 0 && noIidSteps - h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin] < noFactors)
+ ScaleL = PScaleFactors[noIidSteps - h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin]];
+
+ AlphasValue = 0;
+ if (h_ps_d->specificTo.mpeg.coef.aaIccIndexMapped[env][bin] >= 0)
+ AlphasValue = Alphas[h_ps_d->specificTo.mpeg.coef.aaIccIndexMapped[env][bin]];
+ Beta = fMult (fMult( AlphasValue, ( ScaleR - ScaleL )), FIXP_SQRT05);
+ Alpha = AlphasValue>>1;
/* Alpha and Beta are now both scaled by 2 shifts right */
diff --git a/libSBRdec/src/sbr_dec.cpp b/libSBRdec/src/sbr_dec.cpp
index 0864348..76009ba 100644
--- a/libSBRdec/src/sbr_dec.cpp
+++ b/libSBRdec/src/sbr_dec.cpp
@@ -940,6 +940,10 @@ resetSbrDec (HANDLE_SBR_DEC hSbrDec,
FIXP_DBL **OverlapBufferReal = hSbrDec->QmfBufferReal;
FIXP_DBL **OverlapBufferImag = hSbrDec->QmfBufferImag;
+ if (!hSbrDec->LppTrans.pSettings) {
+ return SBRDEC_NOT_INITIALIZED;
+ }
+
/* assign qmf time slots */
assignTimeSlots( hSbrDec, hHeaderData->numberTimeSlots * hHeaderData->timeStep, useLP);
diff --git a/libSBRdec/src/sbrdecoder.cpp b/libSBRdec/src/sbrdecoder.cpp
index f9ded54..a341746 100644
--- a/libSBRdec/src/sbrdecoder.cpp
+++ b/libSBRdec/src/sbrdecoder.cpp
@@ -1444,6 +1444,13 @@ sbrDecoder_DecodeElement (
self->flags |= (applyPs) ? SBRDEC_PS_DECODED : 0;
}
+ if (channelMapping[0] == 255 || ((*numOutChannels == 2) && channelMapping[1] == 255))
+ return SBRDEC_UNSUPPORTED_CONFIG;
+ if (!pSbrChannel[0]->SbrDec.LppTrans.pSettings)
+ return SBRDEC_UNSUPPORTED_CONFIG;
+ if (stereo && !pSbrChannel[1]->SbrDec.LppTrans.pSettings)
+ return SBRDEC_UNSUPPORTED_CONFIG;
+
/* Set strides for reading and writing */
if (interleaved) {
strideIn = numInChannels;