aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/aac/aacdec_usac.c
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2024-06-06 03:50:44 +0200
committerLynne <dev@lynne.ee>2024-06-08 00:22:39 +0200
commit1ad9a4008bbb4fbcf3691bc56851d877c955b9e4 (patch)
tree3d5957be24456eb2f7d344323358629ace1c9542 /libavcodec/aac/aacdec_usac.c
parentc0fdb0cdfdbd9aff82a18402341827bf23c425f1 (diff)
downloadffmpeg-1ad9a4008bbb4fbcf3691bc56851d877c955b9e4.tar.gz
aacdec_usac: decouple TNS active from TNS data present flag
The issue was that in case of common TNS parameters, TNS was entirely skipped, as tns.present was set to 0.
Diffstat (limited to 'libavcodec/aac/aacdec_usac.c')
-rw-r--r--libavcodec/aac/aacdec_usac.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/libavcodec/aac/aacdec_usac.c b/libavcodec/aac/aacdec_usac.c
index 9b28a9e90b..97655787ee 100644
--- a/libavcodec/aac/aacdec_usac.c
+++ b/libavcodec/aac/aacdec_usac.c
@@ -877,7 +877,7 @@ static int decode_usac_stereo_info(AACDecContext *ac, AACUSACConfig *usac,
}
us->tns_on_lr = 0;
- sce1->tns.present = sce2->tns.present = 0;
+ ue1->tns_data_present = ue2->tns_data_present = 0;
if (tns_active) {
int common_tns = 0;
if (us->common_window)
@@ -889,15 +889,17 @@ static int decode_usac_stereo_info(AACDecContext *ac, AACUSACConfig *usac,
if (ret < 0)
return ret;
memcpy(&sce2->tns, &sce1->tns, sizeof(sce1->tns));
- sce2->tns.present = 0;
- sce1->tns.present = 0;
+ sce2->tns.present = 1;
+ sce1->tns.present = 1;
+ ue1->tns_data_present = 0;
+ ue2->tns_data_present = 0;
} else {
if (get_bits1(gb)) {
- sce2->tns.present = 1;
- sce1->tns.present = 1;
+ ue1->tns_data_present = 1;
+ ue2->tns_data_present = 1;
} else {
- sce2->tns.present = get_bits1(gb);
- sce1->tns.present = !sce2->tns.present;
+ ue2->tns_data_present = get_bits1(gb);
+ ue1->tns_data_present = !ue2->tns_data_present;
}
}
}
@@ -1277,12 +1279,14 @@ static int decode_usac_core_coder(AACDecContext *ac, AACUSACConfig *usac,
uint8_t global_gain;
us->common_window = 0;
- che->ch[0].tns.present = che->ch[1].tns.present = 0;
for (int ch = 0; ch < nb_channels; ch++) {
SingleChannelElement *sce = &che->ch[ch];
AACUsacElemData *ue = &sce->ue;
+ sce->tns.present = 0;
+ ue->tns_data_present = 0;
+
ue->core_mode = get_bits1(gb);
}
@@ -1306,7 +1310,7 @@ static int decode_usac_core_coder(AACDecContext *ac, AACUSACConfig *usac,
if ((nb_channels == 1) ||
(che->ch[0].ue.core_mode != che->ch[1].ue.core_mode))
- sce->tns.present = get_bits1(gb);
+ ue->tns_data_present = get_bits1(gb);
/* fd_channel_stream */
global_gain = get_bits(gb, 8);
@@ -1351,7 +1355,8 @@ static int decode_usac_core_coder(AACDecContext *ac, AACUSACConfig *usac,
ac->dsp.dequant_scalefactors(sce);
- if (sce->tns.present) {
+ if (ue->tns_data_present) {
+ sce->tns.present = 1;
ret = ff_aac_decode_tns(ac, &sce->tns, gb, ics);
if (ret < 0)
return ret;