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.
release/7.1
Lynne 7 months ago
parent a4630d479a
commit 11a8e0a4e5
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
  1. 7
      libavcodec/aac/aacdec_usac.c

@ -971,7 +971,7 @@ static void apply_noise_fill(AACDecContext *ac, SingleChannelElement *sce,
} }
if (band_quantized_to_zero) 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; coef += g_len << 7;
} }
@ -987,6 +987,9 @@ static void spectrum_scale(AACDecContext *ac, SingleChannelElement *sce,
if (ue->noise.level) if (ue->noise.level)
apply_noise_fill(ac, sce, ue); apply_noise_fill(ac, sce, ue);
/* Noise filling may apply an offset to the scalefactor offset */
ac->dsp.dequant_scalefactors(sce);
/* Apply scalefactors */ /* Apply scalefactors */
coef = sce->coeffs; coef = sce->coeffs;
for (int g = 0; g < ics->num_window_groups; g++) { 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) if (ret < 0)
return ret; return ret;
ac->dsp.dequant_scalefactors(sce);
if (ue->tns_data_present) { if (ue->tns_data_present) {
sce->tns.present = 1; sce->tns.present = 1;
ret = ff_aac_decode_tns(ac, &sce->tns, gb, ics); ret = ff_aac_decode_tns(ac, &sce->tns, gb, ics);

Loading…
Cancel
Save