ffmpeg | branch: master | Lynne <[email protected]> | Wed Jun 12 03:31:58 2024 
+0200| [bdd3c6ca5015e29d12fa3d317a6d8b6958156a93] | committer: Lynne

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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bdd3c6ca5015e29d12fa3d317a6d8b6958156a93
---

 libavcodec/aac/aacdec_usac.c | 9 +++++----
 1 file 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;
 

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to