case SND_PCM_FORMAT_DSD_U32_BE:
s16->dsd_bits = dsd_frame_bits(spcm->format);
/* Smooth over about a quarter of a millisecond, taken from the
- * rate so the behaviour is the same at every DSD rate. */
+ * rate so the behaviour is the same at every DSD rate. The
+ * cap keeps the window below what overflows the int32 EMA
+ * accumulator (acc <= 65534 << shift); 12 covers DSD512 while
+ * staying far inside that bound. */
s16->dsd_shift = 1;
while ((1U << (s16->dsd_shift + 1)) <= spcm->rate / 4000 &&
- s16->dsd_shift < 8)
+ s16->dsd_shift < 12)
s16->dsd_shift++;
idx = 0;
break;
*/
s16->buf = calloc(meter->buf_size * 2 * spcm->channels, 1);
if (!s16->buf) {
+ free(s16->dsd_states);
free(s16->adpcm_states);
return -ENOMEM;
}
a = calloc(spcm->channels, sizeof(*a));
if (!a) {
free(s16->buf);
+ free(s16->dsd_states);
free(s16->adpcm_states);
return -ENOMEM;
}