shithub: aacdec

Download patch

ref: 2783bdac5d524a0574b7eca273e8ca6b9a6b8014
parent: fd7a5f8ba3b130319bc184ada17a77a08be5cd56
author: Andrew Wesie <awesie@gmail.com>
date: Mon Oct 5 02:43:16 EDT 2020

Fix PNS decoding when only right channel is noise.

Fixes #53.

--- a/libfaad/pns.c
+++ b/libfaad/pns.c
@@ -236,7 +236,17 @@
                 if ((ics_right != NULL)
                     && is_noise(ics_right, g, sfb))
                 {
-                    if (channel_pair &&
+#ifdef LTP_DEC
+                    /* See comment above. */
+                    ics_right->ltp.long_used[sfb] = 0;
+                    ics_right->ltp2.long_used[sfb] = 0;
+#endif
+#ifdef MAIN_DEC
+                    /* See comment above. */
+                    ics_right->pred.prediction_used[sfb] = 0;
+#endif
+
+                    if (channel_pair && is_noise(ics_left, g, sfb) &&
                         (((ics_left->ms_mask_present == 1) &&
                         (ics_left->ms_used[g][sfb])) ||
                         (ics_left->ms_mask_present == 2)))
@@ -251,14 +261,6 @@
                             ics_right->scale_factors[g][sfb], size, sub, &r1_dep, &r2_dep);
 
                     } else /*if (ics_left->ms_mask_present == 0)*/ {
-
-#ifdef LTP_DEC
-                        ics_right->ltp.long_used[sfb] = 0;
-                        ics_right->ltp2.long_used[sfb] = 0;
-#endif
-#ifdef MAIN_DEC
-                        ics_right->pred.prediction_used[sfb] = 0;
-#endif
 
                         offs = ics_right->swb_offset[sfb];
                         size = min(ics_right->swb_offset[sfb+1], ics_right->swb_offset_max) - offs;