shithub: opus

Download patch

ref: 3a8f04db17201192a915db6a0d105178547b88a6
parent: b44e94ef588bbc31a3d9c60a6d9ee5d4971272d8
author: Jean-Marc Valin <[email protected]>
date: Wed Feb 2 18:02:25 EST 2011

Enabling the post-filter and exporting the ec functions for Opus

--- a/configure.ac
+++ b/configure.ac
@@ -202,6 +202,10 @@
 AC_SUBST(SIZE16)
 AC_SUBST(SIZE32)
 
+if test "$OPUS_BUILD" == "true" ; then
+AC_DEFINE(OPUS_BUILD, [], [We're part of Opus])
+fi
+
 AC_OUTPUT([Makefile libcelt/Makefile tests/Makefile 
            celt.pc tools/Makefile libcelt.spec ])
 
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -37,6 +37,11 @@
 
 #define CELT_C
 
+/* Always enable postfilter for Opus */
+#if defined(OPUS_BUILD) && !defined(ENABLE_POSTFILTER)
+#define ENABLE_POSTFILTER
+#endif
+
 #include "os_support.h"
 #include "mdct.h"
 #include <math.h>
@@ -855,9 +860,11 @@
 }
 
 #ifdef FIXED_POINT
+CELT_STATIC
 int celt_encode_with_ec(CELTEncoder * restrict st, const celt_int16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc)
 {
 #else
+CELT_STATIC
 int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc)
 {
 #endif
--- a/libcelt/modes.h
+++ b/libcelt/modes.h
@@ -99,9 +99,18 @@
    PulseCache cache;
 };
 
+#ifndef OPUS_BUILD
+#define CELT_STATIC static
+#else
+#define CELT_STATIC
+#endif
+
+#ifdef OPUS_BUILD
 /* Prototypes for _ec versions of the encoder/decoder calls (not public) */
 int celt_encode_with_ec(CELTEncoder * restrict st, const celt_int16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc);
 int celt_encode_with_ec_float(CELTEncoder * restrict st, const float * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc);
 int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, int len, celt_int16 * restrict pcm, int frame_size, ec_dec *dec);
 int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *data, int len, float * restrict pcm, int frame_size, ec_dec *dec);
+#endif /* OPUS_BUILD */
+
 #endif
--- a/libcelt/pitch.c
+++ b/libcelt/pitch.c
@@ -40,6 +40,11 @@
 #include "config.h"
 #endif
 
+/* Always enable postfilter for Opus */
+#if defined(OPUS_BUILD) && !defined(ENABLE_POSTFILTER)
+#define ENABLE_POSTFILTER
+#endif
+
 #include "pitch.h"
 #include "os_support.h"
 #include "modes.h"