lpc: Reduce stack usage by allocating LLSModel in context.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
pull/93/merge
Reimar Döffinger 10 years ago
parent f87a34486a
commit 458aadf862
  1. 2
      libavcodec/lpc.c
  2. 4
      libavcodec/lpc.h

@ -208,7 +208,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
} }
if (lpc_type == FF_LPC_TYPE_CHOLESKY) { 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)]); LOCAL_ALIGNED(32, double, var, [FFALIGN(MAX_LPC_ORDER+1,4)]);
double av_uninit(weight); double av_uninit(weight);
memset(var, 0, FFALIGN(MAX_LPC_ORDER+1,4)*sizeof(*var)); memset(var, 0, FFALIGN(MAX_LPC_ORDER+1,4)*sizeof(*var));

@ -24,6 +24,7 @@
#include <stdint.h> #include <stdint.h>
#include "libavutil/avassert.h" #include "libavutil/avassert.h"
#include "libavutil/lls.h"
#define ORDER_METHOD_EST 0 #define ORDER_METHOD_EST 0
#define ORDER_METHOD_2LEVEL 1 #define ORDER_METHOD_2LEVEL 1
@ -79,6 +80,9 @@ typedef struct LPCContext {
*/ */
void (*lpc_compute_autocorr)(const double *data, int len, int lag, void (*lpc_compute_autocorr)(const double *data, int len, int lag,
double *autoc); double *autoc);
// TODO: these should be allocated to reduce ABI compatibility issues
LLSModel lls_models[2];
} LPCContext; } LPCContext;

Loading…
Cancel
Save