diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index f230cca25081cd3b3589ae76547b37051bffab7b..9cab741826e79a08c82f80572417f6673cd95669 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4564,40 +4564,58 @@ static void renderBufferChannelLerp_fx( { i = 0; Word32 tmp = Q31_BY_SUB_FRAME_240; + Word32 tmp1 = 239; + move32(); move32(); move32(); SWITCH( outAudio.config.numSamplesPerChannel ) { case NUM_SAMPLES_960: tmp = Q31_BY_NUM_SAMPLES_960; + tmp1 = 959; + move32(); move32(); BREAK; case NUM_SAMPLES_720: tmp = Q31_BY_NUM_SAMPLES_720; + tmp1 = 719; + move32(); move32(); BREAK; case NUM_SAMPLES_320: tmp = Q31_BY_NUM_SAMPLES_320; + tmp1 = 319; + move32(); move32(); BREAK; case NUM_SAMPLES_160: tmp = Q31_BY_NUM_SAMPLES_160; + tmp1 = 159; + move32(); move32(); BREAK; case L_SUBFRAME_48k: tmp = Q31_BY_SUB_FRAME_240; + tmp1 = 239; + move32(); move32(); BREAK; case L_SUBFRAME_32k: tmp = Q31_BY_SUB_FRAME_180; + tmp1 = 179; + move32(); move32(); BREAK; case L_SUBFRAME_16k: tmp = Q31_BY_SUB_FRAME_80; + tmp1 = 79; + move32(); move32(); BREAK; case L_SUBFRAME_8k: tmp = Q31_BY_SUB_FRAME_40; + tmp1 = 39; + move32(); move32(); BREAK; default: @@ -4606,7 +4624,15 @@ static void renderBufferChannelLerp_fx( /* Otherwise use weighted average between previous and current gain */ DO { - fadeIn = UL_Mpy_32_32( i, tmp ); + IF( EQ_32( i, tmp1 ) ) + { + fadeIn = ONE_IN_Q31; + move32(); + } + ELSE + { + fadeIn = UL_Mpy_32_32( i, tmp ); + } fadeOut = L_sub( ONE_IN_Q31, fadeIn ); *outSmpl = L_add( Mpy_32_32( L_add( Mpy_32_32( fadeIn, currentGain ), Mpy_32_32( fadeOut, previousGain ) ), ( *inSmpl ) ), *outSmpl );