More DRED tuning

This commit is contained in:
Jean-Marc Valin 2024-01-23 19:22:05 -05:00
parent 19dd96b3fa
commit 7b73c9bc7f
No known key found for this signature in database
GPG Key ID: 5E5DD9A36F9189C8

View File

@ -597,9 +597,15 @@ static opus_int32 compute_dred_bitrate(OpusEncoder *st, opus_int32 bitrate_bps,
dred_frac = MIN16(.7f, 3.f*st->silk_mode.packetLossPercentage/100.f);
bitrate_offset = 20000;
} else {
dred_frac = MIN16(.8f, 4.f*st->silk_mode.packetLossPercentage/100.f);
if (st->silk_mode.packetLossPercentage > 5) {
dred_frac = MIN16(.8f, .55f + st->silk_mode.packetLossPercentage/100.f);
} else {
dred_frac = 12*st->silk_mode.packetLossPercentage/100.f;
}
bitrate_offset = 12000;
}
/* Account for the fact that longer packets require less redundancy. */
dred_frac = dred_frac/(dred_frac + (1-dred_frac)*(frame_size*50.f)/st->Fs);
/* Approximate fit based on a few experiments. Could probably be improved. */
q0 = IMIN(15, IMAX(4, 51 - 3*EC_ILOG(IMAX(1, bitrate_bps-bitrate_offset))));
dQ = bitrate_bps-bitrate_offset > 36000 ? 3 : 5;