Commit e0f58ca1 authored by Jan Kiene's avatar Jan Kiene
Browse files

improve precision of latencyNsToSamples

NS2SA macro was off by one for low values
parent aa91e67e
Loading
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -289,10 +289,12 @@ static Word16 latencyNsToSamples(
    Word32 sampleRate,
    Word32 latency_ns )
{
    Word16 n_samples;
    Word16 var1, exp;
    Word32 var2;
    var1 = BASOP_Util_Divide3232_Scale( sampleRate, 1000000000, &exp );
    var2 = L_shr_r( Mpy_32_32( latency_ns, L_deposit_h( var1 ) ), negate( exp ) ); /* Q0 */

    n_samples = NS2SA_FX2( sampleRate, latency_ns );
    return n_samples;
    return extract_l(var2);
}

static ivas_error allocateMcLfeDelayBuffer_fx(