changeset 10871:c06d95ce2db0 libavcodec

SIPR: kill variable-length arrays Two of these are in fact constant size, so use the constant instead of a variable in the declarations. The remaining one is small enough that always using the maximum size is acceptable.
author mru
date Wed, 13 Jan 2010 03:11:02 +0000
parents 12bdac3c245b
children a4fbfc917c2e
files sipr.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sipr.c	Wed Jan 13 02:44:38 2010 +0000
+++ b/sipr.c	Wed Jan 13 03:11:02 2010 +0000
@@ -46,6 +46,8 @@
 /**  Subframe size for all modes except 16k */
 #define SUBFR_SIZE           48
 
+#define MAX_SUBFRAME_COUNT   5
+
 #include "siprdata.h"
 
 typedef enum {
@@ -233,8 +235,8 @@
 static void lsp2lpc_sipr(const double *lsp, float *Az)
 {
     int lp_half_order = LP_FILTER_ORDER >> 1;
-    double buf[lp_half_order + 1];
-    double pa[lp_half_order + 1];
+    double buf[(LP_FILTER_ORDER >> 1) + 1];
+    double pa[(LP_FILTER_ORDER >> 1) + 1];
     double *qa = buf + 1;
     int i,j;
 
@@ -409,7 +411,7 @@
 {
     int i, j;
     int frame_size = ctx->m.subframe_count * SUBFR_SIZE;
-    float Az[LP_FILTER_ORDER * ctx->m.subframe_count];
+    float Az[LP_FILTER_ORDER * MAX_SUBFRAME_COUNT];
     float *excitation;
     float ir_buf[SUBFR_SIZE + LP_FILTER_ORDER];
     float lsf_new[LP_FILTER_ORDER];