shithub: aacenc

Download patch

ref: bf9ad462ec81712184bb6b852dbbec82d9aa3eb0
parent: aa345aeb4988ccf5f4deda10aa062d1c8fa5d17a
author: Krzysztof Nikiel <knik@users.sourceforge.net>
date: Tue Oct 31 11:05:55 EDT 2017

a little M/S optimization

--- a/libfaac/stereo.c
+++ b/libfaac/stereo.c
@@ -140,17 +140,25 @@
 {
     int sfb;
     int win;
+    int sfmin;
 
-    for (sfb = 0; sfb < coder->sfbn; sfb++)
+    if (coder->block_type == ONLY_SHORT_WINDOW)
+        sfmin = 1;
+    else
+        sfmin = 8;
+
+    for (sfb = 0; sfb < sfmin; sfb++)
     {
+        channel->msInfo.ms_used[*sfcnt] = 0;
+        (*sfcnt)++;
+    }
+    for (sfb = sfmin; sfb < coder->sfbn; sfb++)
+    {
         int ms = 0;
         int l, start, end;
         double sum, diff;
         double enrgs, enrgd, enrgl, enrgr;
 
-        if (sfb < 1)
-            goto setms;
-
         start = coder->sfb_offset[sfb];
         end = coder->sfb_offset[sfb + 1];
 
@@ -233,7 +241,6 @@
             }
         }
 
-    setms:
         channel->msInfo.ms_used[*sfcnt] = ms;
         (*sfcnt)++;
     }