diff --git a/configure.ac b/configure.ac index ac45a857d184191beba44128398673cf60b95239..4c21ec0bd3d93358663b4f3081297a3cfb161156 100644 --- a/configure.ac +++ b/configure.ac @@ -202,6 +202,10 @@ fi 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 ]) diff --git a/libcelt/celt.c b/libcelt/celt.c index 6f93bcfc482afcf958eb216ed4c5392aad18eeef..e9642462e49e14d30a1372cb0f6115cafd84d256 100644 --- 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 @@ static int stereo_analysis(const CELTMode *m, const celt_norm *X, } #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 diff --git a/libcelt/modes.h b/libcelt/modes.h index 447e38b7f80cc986d03dc09ffc1d9925f2252099..43bdccc0eb0e09bea5996304d6538d8aae99fc1d 100644 --- a/libcelt/modes.h +++ b/libcelt/modes.h @@ -99,9 +99,18 @@ struct CELTMode { 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 diff --git a/libcelt/pitch.c b/libcelt/pitch.c index 476aadb08b89723fe9c961404db8ba5fb3e61635..2356c9d3bbb398ce630ead346fd4d1b2997b6f19 100644 --- 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"