[FFmpeg-cvslog] lpc: Reduce stack usage by allocating LLSModel in context.

Reimar Döffinger git at videolan.org
Sun Nov 23 06:53:32 CET 2014


ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Sat Nov 22 20:49:13 2014 +0100| [458aadf8627c27c35cc29e7842c6f7fc9a5695ad] | committer: Reimar Döffinger

lpc: Reduce stack usage by allocating LLSModel in context.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>

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

 libavcodec/lpc.c |    2 +-
 libavcodec/lpc.h |    4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
index f54f6f8..deb02e7 100644
--- a/libavcodec/lpc.c
+++ b/libavcodec/lpc.c
@@ -208,7 +208,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
     }
 
     if (lpc_type == FF_LPC_TYPE_CHOLESKY) {
-        LLSModel m[2];
+        LLSModel *m = s->lls_models;
         LOCAL_ALIGNED(32, double, var, [FFALIGN(MAX_LPC_ORDER+1,4)]);
         double av_uninit(weight);
         memset(var, 0, FFALIGN(MAX_LPC_ORDER+1,4)*sizeof(*var));
diff --git a/libavcodec/lpc.h b/libavcodec/lpc.h
index 9e0b056..96acb37 100644
--- a/libavcodec/lpc.h
+++ b/libavcodec/lpc.h
@@ -24,6 +24,7 @@
 
 #include <stdint.h>
 #include "libavutil/avassert.h"
+#include "libavutil/lls.h"
 
 #define ORDER_METHOD_EST     0
 #define ORDER_METHOD_2LEVEL  1
@@ -79,6 +80,9 @@ typedef struct LPCContext {
      */
     void (*lpc_compute_autocorr)(const double *data, int len, int lag,
                                  double *autoc);
+
+    // TODO: these should be allocated to reduce ABI compatibility issues
+    LLSModel lls_models[2];
 } LPCContext;
 
 



More information about the ffmpeg-cvslog mailing list