Commit 161e303c authored by Jan Kiene's avatar Jan Kiene
Browse files

generalize fix

parent 93e9b080
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@
#define FIX_FLOAT_1573_POSITION_UPDATE                  /* Eri: Float issue 1573: For static orientation and listener movement, the PoseUpdated flag is cleared and prevents 5 ms update rate. */
#define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE  /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */
#define FIX_1452_DEFAULT_REVERB                         /* Nokia/Philips/FhG: Fix default room presets and their usage in renderer */
#define FIX_TMP_1559                                    /* Eri/FhG: Temporary fix for Issue 1559 in FD CNG with bitrate/bw switching */
#define FIX_1559                                        /* Eri/FhG: fix for Issue 1559 in FD CNG with bitrate/bw switching */

/* ##################### End NON-BE switches ########################### */

+13 −3
Original line number Diff line number Diff line
@@ -191,6 +191,9 @@ void configureFdCngDec(
{
    int16_t j, stopBandFR;
    HANDLE_FD_CNG_COM hsCom = hFdCngDec->hFdCngCom;
#ifdef FIX_1559
    int16_t nFFTpart_prev;
#endif

    hsCom->CngBandwidth = bwidth;
    if ( hsCom->CngBandwidth == FB )
@@ -296,6 +299,10 @@ void configureFdCngDec(
    hsCom->startBand = 2;
    hsCom->stopBand = hsCom->FdCngSetup.sidPartitions[hsCom->FdCngSetup.numPartitions - 1] + 1;
    initPartitions( hsCom->FdCngSetup.sidPartitions, hsCom->FdCngSetup.numPartitions, hsCom->startBand, hsCom->stopBand, hsCom->part, &hsCom->npart, hsCom->midband, hsCom->psize, hsCom->psize_inv, 0 );
#ifdef FIX_1559

    nFFTpart_prev = hsCom->nFFTpart;
#endif
    if ( hsCom->stopFFTbin == 160 )
    {
        hsCom->nFFTpart = 17;
@@ -315,10 +322,13 @@ void configureFdCngDec(
        hsCom->CLDFBpsize_inv[j] = hsCom->psize_inv[j + hsCom->nFFTpart];
    }

#ifdef FIX_TMP_1559
    if ( last_L_frame == L_FRAME && L_frame == L_FRAME16k && hFdCngDec->partNoiseShape[20] == 0 )
#ifdef FIX_1559
    /* In case of going from a lower number of partitions to a higher number, initialize
       the higher ines which might be zero and/or outdated with the highest partitions value
       this avoids almost-zero values to linger around and causing signal bursts after switching to higher bitrate */
    for ( j = nFFTpart_prev; j < hsCom->nFFTpart; ++j )
    {
        hFdCngDec->partNoiseShape[20] = hFdCngDec->partNoiseShape[19];
        hFdCngDec->partNoiseShape[j] = hFdCngDec->partNoiseShape[nFFTpart_prev - 1];
    }
#endif