Commit 4fc68156 authored by multrus's avatar multrus
Browse files

potential fix for overflow on ramp_up_flag

parent ce26b0c9
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -160,7 +160,7 @@
#define FIX_575_LOW_OVERLAP_PLC_RECOVERY                /* FhG: Issue 575 fix for PLC and transistion to TCX5*/
#define FIX_575_LOW_OVERLAP_PLC_RECOVERY                /* FhG: Issue 575 fix for PLC and transistion to TCX5*/
#define ISM_FB_16k4                                     /* VA: Issue: 579: change BW from SWB to FB in NxISM conditions to match the EVS codec */
#define ISM_FB_16k4                                     /* VA: Issue: 579: change BW from SWB to FB in NxISM conditions to match the EVS codec */
#define FIX_580_PARAMMC_ENER_BURSTS                     /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */
#define FIX_580_PARAMMC_ENER_BURSTS                     /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */

#define FIX_583_CLANG_TRANS_DET                         /* FhG: Issue 583: clang left shift on ramp_up_flag in transient detector */


/* ################## End DEVELOPMENT switches ######################### */
/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
/* clang-format on */
+4 −0
Original line number Original line Diff line number Diff line
@@ -124,7 +124,11 @@ typedef struct
    float firState1;
    float firState1;
    float firState2;
    float firState2;


#ifdef FIX_583_CLANG_TRANS_DET
    uint16_t ramp_up_flag; /* bit map flags to indicate a ramp up in beginning of TCX frame */
#else
    int16_t ramp_up_flag; /* bit map flags to indicate a ramp up in beginning of TCX frame */
    int16_t ramp_up_flag; /* bit map flags to indicate a ramp up in beginning of TCX frame */
#endif


} SubblockEnergies;
} SubblockEnergies;


+4 −0
Original line number Original line Diff line number Diff line
@@ -241,7 +241,11 @@ void RunTransientDetection(
    UpdateDelayBuffer( filteredInput, length, &hTranDet->delayBuffer );
    UpdateDelayBuffer( filteredInput, length, &hTranDet->delayBuffer );


    /* compute ramp up flag */
    /* compute ramp up flag */
#ifdef FIX_583_CLANG_TRANS_DET
    pSubblockEnergies->ramp_up_flag = ((pSubblockEnergies->ramp_up_flag << 1) & 0x0003);
#else
    pSubblockEnergies->ramp_up_flag = pSubblockEnergies->ramp_up_flag << 1;
    pSubblockEnergies->ramp_up_flag = pSubblockEnergies->ramp_up_flag << 1;
#endif
    e0 = dotp( filteredInput + length / 2, filteredInput + length / 2, pSubblockEnergies->pDelayBuffer->nSubblockSize / 2 ) + 0.5f * MIN_BLOCK_ENERGY;
    e0 = dotp( filteredInput + length / 2, filteredInput + length / 2, pSubblockEnergies->pDelayBuffer->nSubblockSize / 2 ) + 0.5f * MIN_BLOCK_ENERGY;
    e1 = pSubblockEnergies->subblockNrg[pSubblockEnergies->nDelay + 4] - e0;
    e1 = pSubblockEnergies->subblockNrg[pSubblockEnergies->nDelay + 4] - e0;
    if ( e1 > e0 )
    if ( e1 > e0 )