aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2024-06-12 03:31:58 +0200
committerLynne <dev@lynne.ee>2024-06-12 03:33:45 +0200
commitbdd3c6ca5015e29d12fa3d317a6d8b6958156a93 (patch)
tree09c870c7cd7b2726b621f330fa1c5aac496f78c9 /libavcodec
parentd79fbad366896873d9d4d219cce9578797944dea (diff)
downloadffmpeg-bdd3c6ca5015e29d12fa3d317a6d8b6958156a93.tar.gz
aacdec_usac: always zero out alpha_q values for stereo streams
The issue is that if a frame has no complex stereo prediction, the alpha values must all be assumed to be zero if the next frame has complex prediction and uses delta coding.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/aac/aacdec_usac.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/aac/aacdec_usac.c b/libavcodec/aac/aacdec_usac.c
index 81aba5ddf4..98e8c1c0bc 100644
--- a/libavcodec/aac/aacdec_usac.c
+++ b/libavcodec/aac/aacdec_usac.c
@@ -690,10 +690,6 @@ static int decode_usac_stereo_cplx(AACDecContext *ac, AACUsacStereo *us,
if (!indep_flag)
delta_code_time = get_bits1(gb);
- /* Alpha values must be zeroed out if pred_used is 0. */
- memset(us->alpha_q_re, 0, sizeof(us->alpha_q_re));
- memset(us->alpha_q_im, 0, sizeof(us->alpha_q_im));
-
/* TODO: shouldn't be needed */
for (int g = 0; g < num_window_groups; g++) {
for (int sfb = 0; sfb < cpe->max_sfb_ste; sfb += SFB_PER_PRED_BAND) {
@@ -828,6 +824,11 @@ static int decode_usac_stereo_info(AACDecContext *ac, AACUSACConfig *usac,
us->common_window = 0;
us->common_tw = 0;
+ /* Alpha values must always be zeroed out for the current frame,
+ * as they are propagated to the next frame and may be used. */
+ memset(us->alpha_q_re, 0, sizeof(us->alpha_q_re));
+ memset(us->alpha_q_im, 0, sizeof(us->alpha_q_im));
+
if (!(!ue1->core_mode && !ue2->core_mode))
return 0;