aacdec_usac: dequantize scalefactors after noise synthesis

The issue here is that the spec implied that the offset is done
on the dequantized scalefactor, but in fact, it is done on the
scalefactor offset. Delay dequantizing the scalefactors until
after noise synthesis is performed, and change to apply the
offset onto the offset.
This commit is contained in:
Lynne 2024-06-12 03:20:56 +02:00
parent a4630d479a
commit 11a8e0a4e5
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
1 changed files with 4 additions and 3 deletions

View File

@ -971,7 +971,7 @@ static void apply_noise_fill(AACDecContext *ac, SingleChannelElement *sce,
}
if (band_quantized_to_zero)
sce->sf[g*ics->max_sfb + sfb] += noise_offset;
sce->sfo[g*ics->max_sfb + sfb] += noise_offset;
}
coef += g_len << 7;
}
@ -987,6 +987,9 @@ static void spectrum_scale(AACDecContext *ac, SingleChannelElement *sce,
if (ue->noise.level)
apply_noise_fill(ac, sce, ue);
/* Noise filling may apply an offset to the scalefactor offset */
ac->dsp.dequant_scalefactors(sce);
/* Apply scalefactors */
coef = sce->coeffs;
for (int g = 0; g < ics->num_window_groups; g++) {
@ -1371,8 +1374,6 @@ static int decode_usac_core_coder(AACDecContext *ac, AACUSACConfig *usac,
if (ret < 0)
return ret;
ac->dsp.dequant_scalefactors(sce);
if (ue->tns_data_present) {
sce->tns.present = 1;
ret = ff_aac_decode_tns(ac, &sce->tns, gb, ics);