shithub: opus

Download patch

ref: 02fa913c32f43a3855db4ccc98b87f3018f672db
parent: a85657bd2919f51e442c13d33c7e9f6b017f4627
author: Jean-Marc Valin <[email protected]>
date: Wed Feb 20 07:09:29 EST 2008

More C89 fixes, making sure to include config.h from all source files.

--- a/libcelt/bitrdec.c
+++ b/libcelt/bitrdec.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "bitree.h"
 
 int ec_bitree_find_and_update(unsigned *_this,int _sz,int _split,
--- a/libcelt/bitree.c
+++ b/libcelt/bitree.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "bitree.h"
 
 void ec_bitree_to_counts(unsigned *_this,int _sz,int _split){
--- a/libcelt/bitrenc.c
+++ b/libcelt/bitrenc.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "bitrenc.h"
 
 void ec_bitree_update(unsigned *_this,int _sz,int _sym,int _val){
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -29,6 +29,10 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "os_support.h"
 #include "mdct.h"
 #include <math.h>
@@ -82,10 +86,11 @@
 CELTEncoder *celt_encoder_new(const CELTMode *mode)
 {
    int i, N, B, C, N4;
+   CELTEncoder *st;
    N = mode->mdctSize;
    B = mode->nbMdctBlocks;
    C = mode->nbChannels;
-   CELTEncoder *st = celt_alloc(sizeof(CELTEncoder));
+   st = celt_alloc(sizeof(CELTEncoder));
    
    st->mode = mode;
    st->frame_size = B*N;
@@ -153,13 +158,15 @@
 {
    int i, c;
    float E = 1e-15;
+   VARDECL(float *x);
+   VARDECL(float *tmp);
+   ALLOC(x, 2*N, float);
+   ALLOC(tmp, N, float);
    for (c=0;c<C;c++)
    {
       for (i=0;i<B;i++)
       {
          int j;
-         float x[2*N];
-         float tmp[N];
          for (j=0;j<2*N;j++)
          {
             x[j] = window[j]*in[C*i*N+C*j+c];
@@ -177,6 +184,10 @@
 static void compute_inv_mdcts(mdct_lookup *mdct_lookup, float *window, float *X, float *out_mem, float *mdct_overlap, int N, int overlap, int B, int C)
 {
    int i, c, N4;
+   VARDECL(float *x);
+   VARDECL(float *tmp);
+   ALLOC(x, 2*N, float);
+   ALLOC(tmp, N, float);
    N4 = (N-overlap)/2;
    for (c=0;c<C;c++)
    {
@@ -183,8 +194,6 @@
       for (i=0;i<B;i++)
       {
          int j;
-         float x[2*N];
-         float tmp[N];
          /* De-interleaving the sub-frames */
          for (j=0;j<N;j++)
             tmp[j] = X[C*B*j+C*i+c];
--- a/libcelt/cwrs.c
+++ b/libcelt/cwrs.c
@@ -32,6 +32,11 @@
 /* Functions for encoding and decoding pulse vectors. For more details, see:
    http://people.xiph.org/~tterribe/notes/cwrs.html
 */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdlib.h>
 #include "cwrs.h"
 
--- a/libcelt/entcode.c
+++ b/libcelt/entcode.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "entcode.h"
 
 
--- a/libcelt/entdec.c
+++ b/libcelt/entdec.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stddef.h>
 #include "entdec.h"
 
--- a/libcelt/entenc.c
+++ b/libcelt/entenc.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdlib.h>
 #include <string.h>
 #include "entenc.h"
--- a/libcelt/laplace.c
+++ b/libcelt/laplace.c
@@ -29,6 +29,10 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "entenc.h"
 #include "entdec.h"
 
--- a/libcelt/mdct.c
+++ b/libcelt/mdct.c
@@ -42,6 +42,10 @@
    and scaling in many places. 
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "mdct.h"
 #include "kiss_fft.h"
 #include <math.h>
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -29,6 +29,10 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "celt.h"
 #include "modes.h"
 #include "rate.h"
--- a/libcelt/pitch.c
+++ b/libcelt/pitch.c
@@ -20,6 +20,9 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <stdio.h>
 #include <math.h>
--- a/libcelt/psy.c
+++ b/libcelt/psy.c
@@ -29,6 +29,10 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "psy.h"
 #include <math.h>
 #include "os_support.h"
--- a/libcelt/quant_bands.c
+++ b/libcelt/quant_bands.c
@@ -29,6 +29,9 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include "quant_bands.h"
 #include "laplace.h"
--- a/libcelt/quant_pitch.c
+++ b/libcelt/quant_pitch.c
@@ -29,6 +29,10 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "quant_pitch.h"
 #include <math.h>
 #include "pgain_table.h"
--- a/libcelt/rangedec.c
+++ b/libcelt/rangedec.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stddef.h>
 #include "entdec.h"
 #include "mfrngcod.h"
--- a/libcelt/rangeenc.c
+++ b/libcelt/rangeenc.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stddef.h>
 #include "entenc.h"
 #include "mfrngcod.h"
--- a/libcelt/rate.c
+++ b/libcelt/rate.c
@@ -29,6 +29,10 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <math.h>
 #include "modes.h"
 #include "cwrs.h"
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -29,6 +29,10 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <math.h>
 #include <stdlib.h>
 #include "cwrs.h"