Browse code

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.

Originally committed as revision 21183 to svn://svn.ffmpeg.org/ffmpeg/trunk

Måns Rullgård authored on 2010/01/13 12:11:02
Showing 1 changed files
... ...
@@ -46,6 +46,8 @@
46 46
 /**  Subframe size for all modes except 16k */
47 47
 #define SUBFR_SIZE           48
48 48
 
49
+#define MAX_SUBFRAME_COUNT   5
50
+
49 51
 #include "siprdata.h"
50 52
 
51 53
 typedef enum {
... ...
@@ -233,8 +235,8 @@ static void decode_parameters(SiprParameters* parms, GetBitContext *pgb,
233 233
 static void lsp2lpc_sipr(const double *lsp, float *Az)
234 234
 {
235 235
     int lp_half_order = LP_FILTER_ORDER >> 1;
236
-    double buf[lp_half_order + 1];
237
-    double pa[lp_half_order + 1];
236
+    double buf[(LP_FILTER_ORDER >> 1) + 1];
237
+    double pa[(LP_FILTER_ORDER >> 1) + 1];
238 238
     double *qa = buf + 1;
239 239
     int i,j;
240 240
 
... ...
@@ -409,7 +411,7 @@ static void decode_frame(SiprContext *ctx, SiprParameters *params,
409 409
 {
410 410
     int i, j;
411 411
     int frame_size = ctx->m.subframe_count * SUBFR_SIZE;
412
-    float Az[LP_FILTER_ORDER * ctx->m.subframe_count];
412
+    float Az[LP_FILTER_ORDER * MAX_SUBFRAME_COUNT];
413 413
     float *excitation;
414 414
     float ir_buf[SUBFR_SIZE + LP_FILTER_ORDER];
415 415
     float lsf_new[LP_FILTER_ORDER];