shithub: opus

Download patch

ref: fbbd9bf6082043d368b1892b630f5b20a1e28fe5
parent: 242da53aa03f48939a081900a6305ff8351078a9
author: Jean-Marc Valin <[email protected]>
date: Mon Sep 5 17:13:53 EDT 2011

Renumbering the ctl() calls to make programming errors more obvious

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -871,7 +871,6 @@
          > MULT16_32_Q15(m->eBands[13]<<(LM+1), sumLR);
 }
 
-CELT_STATIC
 int celt_encode_with_ec(CELTEncoder * restrict st, const opus_val16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc)
 {
    int i, c, N;
@@ -2223,7 +2222,6 @@
    RESTORE_STACK;
 }
 
-CELT_STATIC
 int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, int len, opus_val16 * restrict pcm, int frame_size, ec_dec *dec)
 {
    int c, i, N;
--- a/libcelt/celt.h
+++ b/libcelt/celt.h
@@ -38,6 +38,9 @@
 #include "opus_types.h"
 #include "opus_defines.h"
 #include "opus_custom.h"
+#include "entenc.h"
+#include "entdec.h"
+#include "arch.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -51,7 +54,7 @@
 
 /* Encoder/decoder Requests */
 
-#define CELT_SET_PREDICTION_REQUEST    3002
+#define CELT_SET_PREDICTION_REQUEST    10002
 /** Controls the use of interframe prediction.
     0=Independent frames
     1=Short term interframe prediction allowed
@@ -59,35 +62,37 @@
  */
 #define CELT_SET_PREDICTION(x) CELT_SET_PREDICTION_REQUEST, __opus_check_int(x)
 
-#define CELT_SET_INPUT_CLIPPING_REQUEST    3004
+#define CELT_SET_INPUT_CLIPPING_REQUEST    10004
 #define CELT_SET_INPUT_CLIPPING(x) CELT_SET_INPUT_CLIPPING_REQUEST, __opus_check_int(x)
 
-#define CELT_GET_AND_CLEAR_ERROR_REQUEST   3005
+#define CELT_GET_AND_CLEAR_ERROR_REQUEST   10007
 #define CELT_GET_AND_CLEAR_ERROR(x) CELT_GET_AND_CLEAR_ERROR_REQUEST, __opus_check_int_ptr(x)
 
-#define CELT_SET_CHANNELS_REQUEST    3008
+#define CELT_SET_CHANNELS_REQUEST    10008
 #define CELT_SET_CHANNELS(x) CELT_SET_CHANNELS_REQUEST, __opus_check_int(x)
 
 
 /* Internal */
-#define CELT_SET_START_BAND_REQUEST    10000
+#define CELT_SET_START_BAND_REQUEST    10010
 #define CELT_SET_START_BAND(x) CELT_SET_START_BAND_REQUEST, __opus_check_int(x)
 
-#define CELT_SET_END_BAND_REQUEST    10001
+#define CELT_SET_END_BAND_REQUEST    10012
 #define CELT_SET_END_BAND(x) CELT_SET_END_BAND_REQUEST, __opus_check_int(x)
 
+#define CELT_GET_MODE_REQUEST    10015
+/** Get the CELTMode used by an encoder or decoder */
+#define CELT_GET_MODE(x) CELT_GET_MODE_REQUEST, _celt_check_mode_ptr_ptr(x)
 
+#define CELT_SET_SIGNALLING_REQUEST    10016
+#define CELT_SET_SIGNALLING(x) CELT_SET_SIGNALLING_REQUEST, __opus_check_int(x)
 
-/** \defgroup codec Encoding and decoding */
-/*  @{ */
 
-/* Mode calls */
 
-
 /* Encoder stuff */
 
 int celt_encoder_get_size(int channels);
 
+int celt_encode_with_ec(OpusCustomEncoder * restrict st, const opus_val16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc);
 
 int celt_encoder_init(CELTEncoder *st, opus_int32 sampling_rate, int channels);
 
@@ -100,8 +105,7 @@
 
 int celt_decoder_init(CELTDecoder *st, opus_int32 sampling_rate, int channels);
 
-
-/*  @} */
+int celt_decode_with_ec(OpusCustomDecoder * restrict st, const unsigned char *data, int len, opus_val16 * restrict pcm, int frame_size, ec_dec *dec);
 
 #define celt_encoder_ctl opus_custom_encoder_ctl
 #define celt_decoder_ctl opus_custom_decoder_ctl
--- a/libcelt/modes.h
+++ b/libcelt/modes.h
@@ -87,23 +87,5 @@
    PulseCache cache;
 };
 
-#ifndef OPUS_BUILD
-#define CELT_STATIC static
-#else
-#define CELT_STATIC
-#endif
-
-#ifdef OPUS_BUILD
-#define CELT_SET_SIGNALLING_REQUEST    10003
-#define CELT_SET_SIGNALLING(x) CELT_SET_SIGNALLING_REQUEST, __opus_check_int(x)
-
-#define CELT_GET_MODE_REQUEST    10004
-/** Get the CELTMode used by an encoder or decoder */
-#define CELT_GET_MODE(x) CELT_GET_MODE_REQUEST, _celt_check_mode_ptr_ptr(x)
-
-/* Prototypes for _ec versions of the encoder/decoder calls (not public) */
-int celt_encode_with_ec(CELTEncoder * restrict st, const opus_val16 * 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, opus_val16 * restrict pcm, int frame_size, ec_dec *dec);
-#endif /* OPUS_BUILD */
 
 #endif
--- a/libcelt/opus_defines.h
+++ b/libcelt/opus_defines.h
@@ -77,72 +77,72 @@
 
 
 /* OPUS_APPLICATION_VOIP or OPUS_APPLICATION_AUDIO */
-#define OPUS_SET_APPLICATION_REQUEST 0
+#define OPUS_SET_APPLICATION_REQUEST 4000
 #define OPUS_SET_APPLICATION(x) OPUS_SET_APPLICATION_REQUEST, __opus_check_int(x)
-#define OPUS_GET_APPLICATION_REQUEST 1
+#define OPUS_GET_APPLICATION_REQUEST 4001
 #define OPUS_GET_APPLICATION(x) OPUS_GET_APPLICATION_REQUEST, __opus_check_int_ptr(x)
 
 /* Coding bit-rate in bit/second */
-#define OPUS_SET_BITRATE_REQUEST 2
+#define OPUS_SET_BITRATE_REQUEST 4002
 #define OPUS_SET_BITRATE(x) OPUS_SET_BITRATE_REQUEST, __opus_check_int(x)
-#define OPUS_GET_BITRATE_REQUEST 3
+#define OPUS_GET_BITRATE_REQUEST 4003
 #define OPUS_GET_BITRATE(x) OPUS_GET_BITRATE_REQUEST, __opus_check_int_ptr(x)
 
 /* 0 for CBR, 1 for VBR */
-#define OPUS_SET_VBR_REQUEST 6
+#define OPUS_SET_VBR_REQUEST 4006
 #define OPUS_SET_VBR(x) OPUS_SET_VBR_REQUEST, __opus_check_int(x)
-#define OPUS_GET_VBR_REQUEST 7
+#define OPUS_GET_VBR_REQUEST 4007
 #define OPUS_GET_VBR(x) OPUS_GET_VBR_REQUEST, __opus_check_int_ptr(x)
 
-#define OPUS_SET_BANDWIDTH_REQUEST 8
+#define OPUS_SET_BANDWIDTH_REQUEST 4008
 #define OPUS_SET_BANDWIDTH(x) OPUS_SET_BANDWIDTH_REQUEST, __opus_check_int(x)
-#define OPUS_GET_BANDWIDTH_REQUEST 9
+#define OPUS_GET_BANDWIDTH_REQUEST 4009
 #define OPUS_GET_BANDWIDTH(x) OPUS_GET_BANDWIDTH_REQUEST, __opus_check_int_ptr(x)
 
-#define OPUS_SET_COMPLEXITY_REQUEST 10
+#define OPUS_SET_COMPLEXITY_REQUEST 4010
 #define OPUS_SET_COMPLEXITY(x) OPUS_SET_COMPLEXITY_REQUEST, __opus_check_int(x)
-#define OPUS_GET_COMPLEXITY_REQUEST 11
+#define OPUS_GET_COMPLEXITY_REQUEST 4011
 #define OPUS_GET_COMPLEXITY(x) OPUS_GET_COMPLEXITY_REQUEST, __opus_check_int_ptr(x)
 
-#define OPUS_SET_INBAND_FEC_REQUEST 12
+#define OPUS_SET_INBAND_FEC_REQUEST 4012
 #define OPUS_SET_INBAND_FEC(x) OPUS_SET_INBAND_FEC_REQUEST, __opus_check_int(x)
-#define OPUS_GET_INBAND_FEC_REQUEST 13
+#define OPUS_GET_INBAND_FEC_REQUEST 4013
 #define OPUS_GET_INBAND_FEC(x) OPUS_GET_INBAND_FEC_REQUEST, __opus_check_int_ptr(x)
 
-#define OPUS_SET_PACKET_LOSS_PERC_REQUEST 14
+#define OPUS_SET_PACKET_LOSS_PERC_REQUEST 4014
 #define OPUS_SET_PACKET_LOSS_PERC(x) OPUS_SET_PACKET_LOSS_PERC_REQUEST, __opus_check_int(x)
-#define OPUS_GET_PACKET_LOSS_PERC_REQUEST 15
+#define OPUS_GET_PACKET_LOSS_PERC_REQUEST 4015
 #define OPUS_GET_PACKET_LOSS_PERC(x) OPUS_GET_PACKET_LOSS_PERC_REQUEST, __opus_check_int_ptr(x)
 
-#define OPUS_SET_DTX_REQUEST 16
+#define OPUS_SET_DTX_REQUEST 4016
 #define OPUS_SET_DTX(x) OPUS_SET_DTX_REQUEST, __opus_check_int(x)
-#define OPUS_GET_DTX_REQUEST 17
+#define OPUS_GET_DTX_REQUEST 4017
 #define OPUS_GET_DTX(x) OPUS_GET_DTX_REQUEST, __opus_check_int_ptr(x)
 
-#define OPUS_SET_VOICE_RATIO_REQUEST 18
+#define OPUS_SET_VOICE_RATIO_REQUEST 4018
 #define OPUS_SET_VOICE_RATIO(x) OPUS_SET_VOICE_RATIO_REQUEST, __opus_check_int(x)
-#define OPUS_GET_VOICE_RATIO_REQUEST 19
+#define OPUS_GET_VOICE_RATIO_REQUEST 4019
 #define OPUS_GET_VOICE_RATIO(x) OPUS_GET_VOICE_RATIO_REQUEST, __opus_check_int_ptr(x)
 
-#define OPUS_SET_VBR_CONSTRAINT_REQUEST 20
+#define OPUS_SET_VBR_CONSTRAINT_REQUEST 4020
 #define OPUS_SET_VBR_CONSTRAINT(x) OPUS_SET_VBR_CONSTRAINT_REQUEST, __opus_check_int(x)
-#define OPUS_GET_VBR_CONSTRAINT_REQUEST 21
+#define OPUS_GET_VBR_CONSTRAINT_REQUEST 4021
 #define OPUS_GET_VBR_CONSTRAINT(x) OPUS_GET_VBR_CONSTRAINT_REQUEST, __opus_check_int_ptr(x)
 
-#define OPUS_SET_FORCE_MONO_REQUEST 22
+#define OPUS_SET_FORCE_MONO_REQUEST 4022
 #define OPUS_SET_FORCE_MONO(x) OPUS_SET_FORCE_MONO_REQUEST, __opus_check_int(x)
-#define OPUS_GET_FORCE_MONO_REQUEST 23
+#define OPUS_GET_FORCE_MONO_REQUEST 4023
 #define OPUS_GET_FORCE_MONO(x) OPUS_GET_FORCE_MONO_REQUEST, __opus_check_int_ptr(x)
 
-#define OPUS_SET_SIGNAL_REQUEST 24
+#define OPUS_SET_SIGNAL_REQUEST 4024
 #define OPUS_SET_SIGNAL(x) OPUS_SET_SIGNAL_REQUEST, __opus_check_int(x)
-#define OPUS_GET_SIGNAL_REQUEST 25
+#define OPUS_GET_SIGNAL_REQUEST 4025
 #define OPUS_GET_SIGNAL(x) OPUS_GET_SIGNAL_REQUEST, __opus_check_int_ptr(x)
 
-#define OPUS_GET_LOOKAHEAD_REQUEST 27
+#define OPUS_GET_LOOKAHEAD_REQUEST 4027
 #define OPUS_GET_LOOKAHEAD(x) OPUS_GET_LOOKAHEAD_REQUEST, __opus_check_int_ptr(x)
 
-#define OPUS_RESET_STATE 28
+#define OPUS_RESET_STATE 4028
 
 /* For testing purposes: the encoder and decoder state should
    always be identical after coding a payload */