shithub: sox

Download patch

ref: fdd3ba29de1cc8e75383268e28417f03189bb860
parent: f27797e752a6289e1483da69004af56764469269
author: Ulrich Klauer <ulrich@chirlu.de>
date: Sat Jan 28 03:58:29 EST 2012

sox_flow_effects: only allocate buffers if needed

If there's no effect using two or more flows (because there is only
one channel, or because they are all MCHAN effects), interleave
buffers aren't needed. Don't allocate them in that case.

--- a/src/effects.c
+++ b/src/effects.c
@@ -370,7 +370,8 @@
       /* Memory will be freed by sox_delete_effect() later. */
     max_flows = max(max_flows, chain->effects[e][0].flows);
   }
-
+  if (max_flows == 1) /* don't need interleave buffers */
+    max_flows = 0;
   chain->ibufc = lsx_calloc(max_flows, sizeof(*chain->ibufc));
   chain->obufc = lsx_calloc(max_flows, sizeof(*chain->obufc));
   for (f = 0; f < max_flows; ++f) {