mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 11:33:06 +00:00
Use fixed point libopus builds on ARM and MIPS. This improves performance and allows the use of NEON on ARM for a huge perf boost
This commit is contained in:
parent
b4c3f9678a
commit
2296b80edb
Binary file not shown.
Binary file not shown.
@ -14,7 +14,8 @@ export PATH=$PATH:$TOOLCHAIN_PATH/bin
|
|||||||
--build=x86_64-unknown-linux-gnu \
|
--build=x86_64-unknown-linux-gnu \
|
||||||
--host=$TOOLCHAIN_BIN_PREFIX \
|
--host=$TOOLCHAIN_BIN_PREFIX \
|
||||||
--target=$TOOLCHAIN_BIN_PREFIX \
|
--target=$TOOLCHAIN_BIN_PREFIX \
|
||||||
CFLAGS="--sysroot=$SYSROOT -O2 $ADDI_CFLAGS"
|
CFLAGS="--sysroot=$SYSROOT -O2 $ADDI_CFLAGS" \
|
||||||
|
$ADDI_CONFIGURE_FLAGS
|
||||||
make clean
|
make clean
|
||||||
make -j$PARALLEL_JOBS
|
make -j$PARALLEL_JOBS
|
||||||
mkdir android/$CPU
|
mkdir android/$CPU
|
||||||
@ -28,6 +29,7 @@ SYSROOT_CPU=mips
|
|||||||
TOOLCHAIN_BIN_PREFIX=mipsel-linux-android
|
TOOLCHAIN_BIN_PREFIX=mipsel-linux-android
|
||||||
TOOLCHAIN_DIR=mipsel-linux-android-4.9
|
TOOLCHAIN_DIR=mipsel-linux-android-4.9
|
||||||
ADDI_CFLAGS="-mips32 -mhard-float -EL -mno-dsp"
|
ADDI_CFLAGS="-mips32 -mhard-float -EL -mno-dsp"
|
||||||
|
ADDI_CONFIGURE_FLAGS="--enable-fixed-point" # fixed point
|
||||||
build_one
|
build_one
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,6 +40,7 @@ SYSROOT_CPU=mips64
|
|||||||
TOOLCHAIN_BIN_PREFIX=mips64el-linux-android
|
TOOLCHAIN_BIN_PREFIX=mips64el-linux-android
|
||||||
TOOLCHAIN_DIR=mips64el-linux-android-4.9
|
TOOLCHAIN_DIR=mips64el-linux-android-4.9
|
||||||
ADDI_CFLAGS="-mips64r6"
|
ADDI_CFLAGS="-mips64r6"
|
||||||
|
ADDI_CONFIGURE_FLAGS="--enable-fixed-point" # fixed point
|
||||||
build_one
|
build_one
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,6 +51,7 @@ SYSROOT_CPU=x86
|
|||||||
TOOLCHAIN_BIN_PREFIX=i686-linux-android
|
TOOLCHAIN_BIN_PREFIX=i686-linux-android
|
||||||
TOOLCHAIN_DIR=x86-4.9
|
TOOLCHAIN_DIR=x86-4.9
|
||||||
ADDI_CFLAGS="-march=i686 -mtune=atom -mstackrealign -msse -msse2 -msse3 -mssse3 -mfpmath=sse -m32"
|
ADDI_CFLAGS="-march=i686 -mtune=atom -mstackrealign -msse -msse2 -msse3 -mssse3 -mfpmath=sse -m32"
|
||||||
|
ADDI_CONFIGURE_FLAGS="" # floating point for SSE optimizations
|
||||||
build_one
|
build_one
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +62,7 @@ SYSROOT_CPU=x86_64
|
|||||||
TOOLCHAIN_BIN_PREFIX=x86_64-linux-android
|
TOOLCHAIN_BIN_PREFIX=x86_64-linux-android
|
||||||
TOOLCHAIN_DIR=x86_64-4.9
|
TOOLCHAIN_DIR=x86_64-4.9
|
||||||
ADDI_CFLAGS="-msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -mpopcnt -m64"
|
ADDI_CFLAGS="-msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -mpopcnt -m64"
|
||||||
|
ADDI_CONFIGURE_FLAGS="" # floating point for SSE optimizations
|
||||||
build_one
|
build_one
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,10 +74,12 @@ TOOLCHAIN_BIN_PREFIX=arm-linux-androideabi
|
|||||||
TOOLCHAIN_DIR=arm-linux-androideabi-4.9
|
TOOLCHAIN_DIR=arm-linux-androideabi-4.9
|
||||||
ADDI_CFLAGS="-marm -mfpu=vfpv3-d16"
|
ADDI_CFLAGS="-marm -mfpu=vfpv3-d16"
|
||||||
ADDI_LDFLAGS=""
|
ADDI_LDFLAGS=""
|
||||||
ADDI_CONFIGURE_FLAGS=""
|
ADDI_CONFIGURE_FLAGS="--enable-fixed-point" # fixed point for NEON, EDSP, Media
|
||||||
build_one
|
build_one
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ARMv8 doesn't currently have assembly in the opus project. We still use fixed point
|
||||||
|
# anyway in the hopes that it will be more performant even without assembly.
|
||||||
function build_armv8
|
function build_armv8
|
||||||
{
|
{
|
||||||
CPU=aarch64
|
CPU=aarch64
|
||||||
@ -81,7 +88,7 @@ TOOLCHAIN_BIN_PREFIX=aarch64-linux-android
|
|||||||
TOOLCHAIN_DIR=aarch64-linux-android-4.9
|
TOOLCHAIN_DIR=aarch64-linux-android-4.9
|
||||||
ADDI_CFLAGS=""
|
ADDI_CFLAGS=""
|
||||||
ADDI_LDFLAGS=""
|
ADDI_LDFLAGS=""
|
||||||
ADDI_CONFIGURE_FLAGS=""
|
ADDI_CONFIGURE_FLAGS="--enable-fixed-point"
|
||||||
build_one
|
build_one
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,6 +592,20 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_get_nb_samples(const unsigne
|
|||||||
* @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type
|
* @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type
|
||||||
*/
|
*/
|
||||||
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decoder_get_nb_samples(const OpusDecoder *dec, const unsigned char packet[], opus_int32 len) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decoder_get_nb_samples(const OpusDecoder *dec, const unsigned char packet[], opus_int32 len) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
|
||||||
|
|
||||||
|
/** Applies soft-clipping to bring a float signal within the [-1,1] range. If
|
||||||
|
* the signal is already in that range, nothing is done. If there are values
|
||||||
|
* outside of [-1,1], then the signal is clipped as smoothly as possible to
|
||||||
|
* both fit in the range and avoid creating excessive distortion in the
|
||||||
|
* process.
|
||||||
|
* @param [in,out] pcm <tt>float*</tt>: Input PCM and modified PCM
|
||||||
|
* @param [in] frame_size <tt>int</tt> Number of samples per channel to process
|
||||||
|
* @param [in] channels <tt>int</tt>: Number of channels
|
||||||
|
* @param [in,out] softclip_mem <tt>float*</tt>: State memory for the soft clipping process (one float per channel, initialized to zero)
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT void opus_pcm_soft_clip(float *pcm, int frame_size, int channels, float *softclip_mem);
|
||||||
|
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
/** @defgroup opus_repacketizer Repacketizer
|
/** @defgroup opus_repacketizer Repacketizer
|
||||||
@ -897,6 +911,64 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_repacketizer_get_nb_frames(OpusRepa
|
|||||||
*/
|
*/
|
||||||
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_repacketizer_out(OpusRepacketizer *rp, unsigned char *data, opus_int32 maxlen) OPUS_ARG_NONNULL(1);
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_repacketizer_out(OpusRepacketizer *rp, unsigned char *data, opus_int32 maxlen) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/** Pads a given Opus packet to a larger size (possibly changing the TOC sequence).
|
||||||
|
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the
|
||||||
|
* packet to pad.
|
||||||
|
* @param len <tt>opus_int32</tt>: The size of the packet.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @param new_len <tt>opus_int32</tt>: The desired size of the packet after padding.
|
||||||
|
* This must be at least as large as len.
|
||||||
|
* @returns an error code
|
||||||
|
* @retval #OPUS_OK \a on success.
|
||||||
|
* @retval #OPUS_BAD_ARG \a len was less than 1 or new_len was less than len.
|
||||||
|
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT int opus_packet_pad(unsigned char *data, opus_int32 len, opus_int32 new_len);
|
||||||
|
|
||||||
|
/** Remove all padding from a given Opus packet and rewrite the TOC sequence to
|
||||||
|
* minimize space usage.
|
||||||
|
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the
|
||||||
|
* packet to strip.
|
||||||
|
* @param len <tt>opus_int32</tt>: The size of the packet.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @returns The new size of the output packet on success, or an error code
|
||||||
|
* on failure.
|
||||||
|
* @retval #OPUS_BAD_ARG \a len was less than 1.
|
||||||
|
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_packet_unpad(unsigned char *data, opus_int32 len);
|
||||||
|
|
||||||
|
/** Pads a given Opus multi-stream packet to a larger size (possibly changing the TOC sequence).
|
||||||
|
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the
|
||||||
|
* packet to pad.
|
||||||
|
* @param len <tt>opus_int32</tt>: The size of the packet.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @param new_len <tt>opus_int32</tt>: The desired size of the packet after padding.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @param nb_streams <tt>opus_int32</tt>: The number of streams (not channels) in the packet.
|
||||||
|
* This must be at least as large as len.
|
||||||
|
* @returns an error code
|
||||||
|
* @retval #OPUS_OK \a on success.
|
||||||
|
* @retval #OPUS_BAD_ARG \a len was less than 1.
|
||||||
|
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT int opus_multistream_packet_pad(unsigned char *data, opus_int32 len, opus_int32 new_len, int nb_streams);
|
||||||
|
|
||||||
|
/** Remove all padding from a given Opus multi-stream packet and rewrite the TOC sequence to
|
||||||
|
* minimize space usage.
|
||||||
|
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the
|
||||||
|
* packet to strip.
|
||||||
|
* @param len <tt>opus_int32</tt>: The size of the packet.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @param nb_streams <tt>opus_int32</tt>: The number of streams (not channels) in the packet.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @returns The new size of the output packet on success, or an error code
|
||||||
|
* on failure.
|
||||||
|
* @retval #OPUS_BAD_ARG \a len was less than 1 or new_len was less than len.
|
||||||
|
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_packet_unpad(unsigned char *data, opus_int32 len, int nb_streams);
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -42,15 +42,15 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CUSTOM_MODES
|
#ifdef CUSTOM_MODES
|
||||||
#define OPUS_CUSTOM_EXPORT OPUS_EXPORT
|
# define OPUS_CUSTOM_EXPORT OPUS_EXPORT
|
||||||
#define OPUS_CUSTOM_EXPORT_STATIC OPUS_EXPORT
|
# define OPUS_CUSTOM_EXPORT_STATIC OPUS_EXPORT
|
||||||
#else
|
#else
|
||||||
#define OPUS_CUSTOM_EXPORT
|
# define OPUS_CUSTOM_EXPORT
|
||||||
#ifdef CELT_C
|
# ifdef OPUS_BUILD
|
||||||
#define OPUS_CUSTOM_EXPORT_STATIC static inline
|
# define OPUS_CUSTOM_EXPORT_STATIC static OPUS_INLINE
|
||||||
#else
|
# else
|
||||||
#define OPUS_CUSTOM_EXPORT_STATIC
|
# define OPUS_CUSTOM_EXPORT_STATIC
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @defgroup opus_custom Opus Custom
|
/** @defgroup opus_custom Opus Custom
|
||||||
@ -126,6 +126,9 @@ OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomMode *opus_custom_mode_crea
|
|||||||
*/
|
*/
|
||||||
OPUS_CUSTOM_EXPORT void opus_custom_mode_destroy(OpusCustomMode *mode);
|
OPUS_CUSTOM_EXPORT void opus_custom_mode_destroy(OpusCustomMode *mode);
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(OPUS_BUILD) || defined(CELT_ENCODER_C)
|
||||||
|
|
||||||
/* Encoder */
|
/* Encoder */
|
||||||
/** Gets the size of an OpusCustomEncoder structure.
|
/** Gets the size of an OpusCustomEncoder structure.
|
||||||
* @param [in] mode <tt>OpusCustomMode *</tt>: Mode configuration
|
* @param [in] mode <tt>OpusCustomMode *</tt>: Mode configuration
|
||||||
@ -137,6 +140,28 @@ OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_si
|
|||||||
int channels
|
int channels
|
||||||
) OPUS_ARG_NONNULL(1);
|
) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
# ifdef CUSTOM_MODES
|
||||||
|
/** Initializes a previously allocated encoder state
|
||||||
|
* The memory pointed to by st must be the size returned by opus_custom_encoder_get_size.
|
||||||
|
* This is intended for applications which use their own allocator instead of malloc.
|
||||||
|
* @see opus_custom_encoder_create(),opus_custom_encoder_get_size()
|
||||||
|
* To reset a previously initialized state use the OPUS_RESET_STATE CTL.
|
||||||
|
* @param [in] st <tt>OpusCustomEncoder*</tt>: Encoder state
|
||||||
|
* @param [in] mode <tt>OpusCustomMode *</tt>: Contains all the information about the characteristics of
|
||||||
|
* the stream (must be the same characteristics as used for the
|
||||||
|
* decoder)
|
||||||
|
* @param [in] channels <tt>int</tt>: Number of channels
|
||||||
|
* @return OPUS_OK Success or @ref opus_errorcodes
|
||||||
|
*/
|
||||||
|
OPUS_CUSTOM_EXPORT int opus_custom_encoder_init(
|
||||||
|
OpusCustomEncoder *st,
|
||||||
|
const OpusCustomMode *mode,
|
||||||
|
int channels
|
||||||
|
) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/** Creates a new encoder state. Each stream needs its own encoder
|
/** Creates a new encoder state. Each stream needs its own encoder
|
||||||
* state (can't be shared across simultaneous streams).
|
* state (can't be shared across simultaneous streams).
|
||||||
* @param [in] mode <tt>OpusCustomMode*</tt>: Contains all the information about the characteristics of
|
* @param [in] mode <tt>OpusCustomMode*</tt>: Contains all the information about the characteristics of
|
||||||
@ -152,23 +177,6 @@ OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomEncoder *opus_custom_encode
|
|||||||
int *error
|
int *error
|
||||||
) OPUS_ARG_NONNULL(1);
|
) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
/** Initializes a previously allocated encoder state
|
|
||||||
* The memory pointed to by st must be the size returned by opus_custom_encoder_get_size.
|
|
||||||
* This is intended for applications which use their own allocator instead of malloc.
|
|
||||||
* @see opus_custom_encoder_create(),opus_custom_encoder_get_size()
|
|
||||||
* To reset a previously initialized state use the OPUS_RESET_STATE CTL.
|
|
||||||
* @param [in] st <tt>OpusCustomEncoder*</tt>: Encoder state
|
|
||||||
* @param [in] mode <tt>OpusCustomMode *</tt>: Contains all the information about the characteristics of
|
|
||||||
* the stream (must be the same characteristics as used for the
|
|
||||||
* decoder)
|
|
||||||
* @param [in] channels <tt>int</tt>: Number of channels
|
|
||||||
* @return OPUS_OK Success or @ref opus_errorcodes
|
|
||||||
*/
|
|
||||||
OPUS_CUSTOM_EXPORT_STATIC int opus_custom_encoder_init(
|
|
||||||
OpusCustomEncoder *st,
|
|
||||||
const OpusCustomMode *mode,
|
|
||||||
int channels
|
|
||||||
) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
|
|
||||||
|
|
||||||
/** Destroys a an encoder state.
|
/** Destroys a an encoder state.
|
||||||
* @param[in] st <tt>OpusCustomEncoder*</tt>: State to be freed.
|
* @param[in] st <tt>OpusCustomEncoder*</tt>: State to be freed.
|
||||||
@ -229,6 +237,8 @@ OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_encode(
|
|||||||
*/
|
*/
|
||||||
OPUS_CUSTOM_EXPORT int opus_custom_encoder_ctl(OpusCustomEncoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1);
|
OPUS_CUSTOM_EXPORT int opus_custom_encoder_ctl(OpusCustomEncoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(OPUS_BUILD) || defined(CELT_DECODER_C)
|
||||||
/* Decoder */
|
/* Decoder */
|
||||||
|
|
||||||
/** Gets the size of an OpusCustomDecoder structure.
|
/** Gets the size of an OpusCustomDecoder structure.
|
||||||
@ -241,20 +251,6 @@ OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_decoder_get_si
|
|||||||
int channels
|
int channels
|
||||||
) OPUS_ARG_NONNULL(1);
|
) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
/** Creates a new decoder state. Each stream needs its own decoder state (can't
|
|
||||||
* be shared across simultaneous streams).
|
|
||||||
* @param [in] mode <tt>OpusCustomMode</tt>: Contains all the information about the characteristics of the
|
|
||||||
* stream (must be the same characteristics as used for the encoder)
|
|
||||||
* @param [in] channels <tt>int</tt>: Number of channels
|
|
||||||
* @param [out] error <tt>int*</tt>: Returns an error code
|
|
||||||
* @return Newly created decoder state.
|
|
||||||
*/
|
|
||||||
OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomDecoder *opus_custom_decoder_create(
|
|
||||||
const OpusCustomMode *mode,
|
|
||||||
int channels,
|
|
||||||
int *error
|
|
||||||
) OPUS_ARG_NONNULL(1);
|
|
||||||
|
|
||||||
/** Initializes a previously allocated decoder state
|
/** Initializes a previously allocated decoder state
|
||||||
* The memory pointed to by st must be the size returned by opus_custom_decoder_get_size.
|
* The memory pointed to by st must be the size returned by opus_custom_decoder_get_size.
|
||||||
* This is intended for applications which use their own allocator instead of malloc.
|
* This is intended for applications which use their own allocator instead of malloc.
|
||||||
@ -273,6 +269,23 @@ OPUS_CUSTOM_EXPORT_STATIC int opus_custom_decoder_init(
|
|||||||
int channels
|
int channels
|
||||||
) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
|
) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** Creates a new decoder state. Each stream needs its own decoder state (can't
|
||||||
|
* be shared across simultaneous streams).
|
||||||
|
* @param [in] mode <tt>OpusCustomMode</tt>: Contains all the information about the characteristics of the
|
||||||
|
* stream (must be the same characteristics as used for the encoder)
|
||||||
|
* @param [in] channels <tt>int</tt>: Number of channels
|
||||||
|
* @param [out] error <tt>int*</tt>: Returns an error code
|
||||||
|
* @return Newly created decoder state.
|
||||||
|
*/
|
||||||
|
OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomDecoder *opus_custom_decoder_create(
|
||||||
|
const OpusCustomMode *mode,
|
||||||
|
int channels,
|
||||||
|
int *error
|
||||||
|
) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
/** Destroys a an decoder state.
|
/** Destroys a an decoder state.
|
||||||
* @param[in] st <tt>OpusCustomDecoder*</tt>: State to be freed.
|
* @param[in] st <tt>OpusCustomDecoder*</tt>: State to be freed.
|
||||||
*/
|
*/
|
||||||
|
@ -46,7 +46,7 @@ extern "C" {
|
|||||||
#define OPUS_OK 0
|
#define OPUS_OK 0
|
||||||
/** One or more invalid/out of range arguments @hideinitializer*/
|
/** One or more invalid/out of range arguments @hideinitializer*/
|
||||||
#define OPUS_BAD_ARG -1
|
#define OPUS_BAD_ARG -1
|
||||||
/** The mode struct passed is invalid @hideinitializer*/
|
/** Not enough bytes allocated in the buffer @hideinitializer*/
|
||||||
#define OPUS_BUFFER_TOO_SMALL -2
|
#define OPUS_BUFFER_TOO_SMALL -2
|
||||||
/** An internal error was detected @hideinitializer*/
|
/** An internal error was detected @hideinitializer*/
|
||||||
#define OPUS_INTERNAL_ERROR -3
|
#define OPUS_INTERNAL_ERROR -3
|
||||||
@ -98,6 +98,18 @@ extern "C" {
|
|||||||
# define OPUS_RESTRICT restrict
|
# define OPUS_RESTRICT restrict
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
|
||||||
|
# if OPUS_GNUC_PREREQ(2,7)
|
||||||
|
# define OPUS_INLINE __inline__
|
||||||
|
# elif (defined(_MSC_VER))
|
||||||
|
# define OPUS_INLINE __inline
|
||||||
|
# else
|
||||||
|
# define OPUS_INLINE
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define OPUS_INLINE inline
|
||||||
|
#endif
|
||||||
|
|
||||||
/**Warning attributes for opus functions
|
/**Warning attributes for opus functions
|
||||||
* NONNULL is not used in OPUS_BUILD to avoid the compiler optimizing out
|
* NONNULL is not used in OPUS_BUILD to avoid the compiler optimizing out
|
||||||
* some paranoid null checks. */
|
* some paranoid null checks. */
|
||||||
@ -148,8 +160,11 @@ extern "C" {
|
|||||||
#define OPUS_GET_GAIN_REQUEST 4045 /* Should have been 4035 */
|
#define OPUS_GET_GAIN_REQUEST 4045 /* Should have been 4035 */
|
||||||
#define OPUS_SET_LSB_DEPTH_REQUEST 4036
|
#define OPUS_SET_LSB_DEPTH_REQUEST 4036
|
||||||
#define OPUS_GET_LSB_DEPTH_REQUEST 4037
|
#define OPUS_GET_LSB_DEPTH_REQUEST 4037
|
||||||
|
|
||||||
#define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039
|
#define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039
|
||||||
|
#define OPUS_SET_EXPERT_FRAME_DURATION_REQUEST 4040
|
||||||
|
#define OPUS_GET_EXPERT_FRAME_DURATION_REQUEST 4041
|
||||||
|
#define OPUS_SET_PREDICTION_DISABLED_REQUEST 4042
|
||||||
|
#define OPUS_GET_PREDICTION_DISABLED_REQUEST 4043
|
||||||
|
|
||||||
/* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */
|
/* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */
|
||||||
|
|
||||||
@ -157,6 +172,7 @@ extern "C" {
|
|||||||
#define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x))
|
#define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x))
|
||||||
#define __opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr)))
|
#define __opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr)))
|
||||||
#define __opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr)))
|
#define __opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr)))
|
||||||
|
#define __opus_check_val16_ptr(ptr) ((ptr) + ((ptr) - (opus_val16*)(ptr)))
|
||||||
/** @endcond */
|
/** @endcond */
|
||||||
|
|
||||||
/** @defgroup opus_ctlvalues Pre-defined values for CTL interface
|
/** @defgroup opus_ctlvalues Pre-defined values for CTL interface
|
||||||
@ -185,6 +201,14 @@ extern "C" {
|
|||||||
#define OPUS_BANDWIDTH_SUPERWIDEBAND 1104 /**<12 kHz bandpass @hideinitializer*/
|
#define OPUS_BANDWIDTH_SUPERWIDEBAND 1104 /**<12 kHz bandpass @hideinitializer*/
|
||||||
#define OPUS_BANDWIDTH_FULLBAND 1105 /**<20 kHz bandpass @hideinitializer*/
|
#define OPUS_BANDWIDTH_FULLBAND 1105 /**<20 kHz bandpass @hideinitializer*/
|
||||||
|
|
||||||
|
#define OPUS_FRAMESIZE_ARG 5000 /**< Select frame size from the argument (default) */
|
||||||
|
#define OPUS_FRAMESIZE_2_5_MS 5001 /**< Use 2.5 ms frames */
|
||||||
|
#define OPUS_FRAMESIZE_5_MS 5002 /**< Use 5 ms frames */
|
||||||
|
#define OPUS_FRAMESIZE_10_MS 5003 /**< Use 10 ms frames */
|
||||||
|
#define OPUS_FRAMESIZE_20_MS 5004 /**< Use 20 ms frames */
|
||||||
|
#define OPUS_FRAMESIZE_40_MS 5005 /**< Use 40 ms frames */
|
||||||
|
#define OPUS_FRAMESIZE_60_MS 5006 /**< Use 60 ms frames */
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
|
|
||||||
@ -430,14 +454,6 @@ extern "C" {
|
|||||||
* @hideinitializer */
|
* @hideinitializer */
|
||||||
#define OPUS_GET_APPLICATION(x) OPUS_GET_APPLICATION_REQUEST, __opus_check_int_ptr(x)
|
#define OPUS_GET_APPLICATION(x) OPUS_GET_APPLICATION_REQUEST, __opus_check_int_ptr(x)
|
||||||
|
|
||||||
/** Gets the sampling rate the encoder or decoder was initialized with.
|
|
||||||
* This simply returns the <code>Fs</code> value passed to opus_encoder_init()
|
|
||||||
* or opus_decoder_init().
|
|
||||||
* @param[out] x <tt>opus_int32 *</tt>: Sampling rate of encoder or decoder.
|
|
||||||
* @hideinitializer
|
|
||||||
*/
|
|
||||||
#define OPUS_GET_SAMPLE_RATE(x) OPUS_GET_SAMPLE_RATE_REQUEST, __opus_check_int_ptr(x)
|
|
||||||
|
|
||||||
/** Gets the total samples of delay added by the entire codec.
|
/** Gets the total samples of delay added by the entire codec.
|
||||||
* This can be queried by the encoder and then the provided number of samples can be
|
* This can be queried by the encoder and then the provided number of samples can be
|
||||||
* skipped on from the start of the decoder's output to provide time aligned input
|
* skipped on from the start of the decoder's output to provide time aligned input
|
||||||
@ -521,10 +537,52 @@ extern "C" {
|
|||||||
* @hideinitializer */
|
* @hideinitializer */
|
||||||
#define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ptr(x)
|
#define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ptr(x)
|
||||||
|
|
||||||
/** Gets the duration (in samples) of the last packet successfully decoded or concealed.
|
/** Configures the encoder's use of variable duration frames.
|
||||||
* @param[out] x <tt>opus_int32 *</tt>: Number of samples (at current sampling rate).
|
* When variable duration is enabled, the encoder is free to use a shorter frame
|
||||||
|
* size than the one requested in the opus_encode*() call.
|
||||||
|
* It is then the user's responsibility
|
||||||
|
* to verify how much audio was encoded by checking the ToC byte of the encoded
|
||||||
|
* packet. The part of the audio that was not encoded needs to be resent to the
|
||||||
|
* encoder for the next call. Do not use this option unless you <b>really</b>
|
||||||
|
* know what you are doing.
|
||||||
|
* @see OPUS_GET_EXPERT_VARIABLE_DURATION
|
||||||
|
* @param[in] x <tt>opus_int32</tt>: Allowed values:
|
||||||
|
* <dl>
|
||||||
|
* <dt>OPUS_FRAMESIZE_ARG</dt><dd>Select frame size from the argument (default).</dd>
|
||||||
|
* <dt>OPUS_FRAMESIZE_2_5_MS</dt><dd>Use 2.5 ms frames.</dd>
|
||||||
|
* <dt>OPUS_FRAMESIZE_5_MS</dt><dd>Use 2.5 ms frames.</dd>
|
||||||
|
* <dt>OPUS_FRAMESIZE_10_MS</dt><dd>Use 10 ms frames.</dd>
|
||||||
|
* <dt>OPUS_FRAMESIZE_20_MS</dt><dd>Use 20 ms frames.</dd>
|
||||||
|
* <dt>OPUS_FRAMESIZE_40_MS</dt><dd>Use 40 ms frames.</dd>
|
||||||
|
* <dt>OPUS_FRAMESIZE_60_MS</dt><dd>Use 60 ms frames.</dd>
|
||||||
|
* <dt>OPUS_FRAMESIZE_VARIABLE</dt><dd>Optimize the frame size dynamically.</dd>
|
||||||
|
* </dl>
|
||||||
* @hideinitializer */
|
* @hideinitializer */
|
||||||
#define OPUS_GET_LAST_PACKET_DURATION(x) OPUS_GET_LAST_PACKET_DURATION_REQUEST, __opus_check_int_ptr(x)
|
#define OPUS_SET_EXPERT_FRAME_DURATION(x) OPUS_SET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int(x)
|
||||||
|
/** Gets the encoder's configured use of variable duration frames.
|
||||||
|
* @see OPUS_SET_EXPERT_VARIABLE_DURATION
|
||||||
|
* @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
|
||||||
|
* <dl>
|
||||||
|
* <dt>OPUS_FRAMESIZE_ARG</dt><dd>Select frame size from the argument (default).</dd>
|
||||||
|
* <dt>OPUS_FRAMESIZE_2_5_MS</dt><dd>Use 2.5 ms frames.</dd>
|
||||||
|
* <dt>OPUS_FRAMESIZE_5_MS</dt><dd>Use 2.5 ms frames.</dd>
|
||||||
|
* <dt>OPUS_FRAMESIZE_10_MS</dt><dd>Use 10 ms frames.</dd>
|
||||||
|
* <dt>OPUS_FRAMESIZE_20_MS</dt><dd>Use 20 ms frames.</dd>
|
||||||
|
* <dt>OPUS_FRAMESIZE_40_MS</dt><dd>Use 40 ms frames.</dd>
|
||||||
|
* <dt>OPUS_FRAMESIZE_60_MS</dt><dd>Use 60 ms frames.</dd>
|
||||||
|
* <dt>OPUS_FRAMESIZE_VARIABLE</dt><dd>Optimize the frame size dynamically.</dd>
|
||||||
|
* </dl>
|
||||||
|
* @hideinitializer */
|
||||||
|
#define OPUS_GET_EXPERT_FRAME_DURATION(x) OPUS_GET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int_ptr(x)
|
||||||
|
|
||||||
|
/** If set to 1, disables almost all use of prediction, making frames almost
|
||||||
|
completely independent. This reduces quality. (default : 0)
|
||||||
|
* @hideinitializer */
|
||||||
|
#define OPUS_SET_PREDICTION_DISABLED(x) OPUS_SET_PREDICTION_DISABLED_REQUEST, __opus_check_int(x)
|
||||||
|
/** Gets the encoder's configured prediction status.
|
||||||
|
* @hideinitializer */
|
||||||
|
#define OPUS_GET_PREDICTION_DISABLED(x) OPUS_GET_PREDICTION_DISABLED_REQUEST, __opus_check_int_ptr(x)
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
/** @defgroup opus_genericctls Generic CTLs
|
/** @defgroup opus_genericctls Generic CTLs
|
||||||
@ -578,18 +636,6 @@ extern "C" {
|
|||||||
* @hideinitializer */
|
* @hideinitializer */
|
||||||
#define OPUS_GET_FINAL_RANGE(x) OPUS_GET_FINAL_RANGE_REQUEST, __opus_check_uint_ptr(x)
|
#define OPUS_GET_FINAL_RANGE(x) OPUS_GET_FINAL_RANGE_REQUEST, __opus_check_uint_ptr(x)
|
||||||
|
|
||||||
/** Gets the pitch of the last decoded frame, if available.
|
|
||||||
* This can be used for any post-processing algorithm requiring the use of pitch,
|
|
||||||
* e.g. time stretching/shortening. If the last frame was not voiced, or if the
|
|
||||||
* pitch was not coded in the frame, then zero is returned.
|
|
||||||
*
|
|
||||||
* This CTL is only implemented for decoder instances.
|
|
||||||
*
|
|
||||||
* @param[out] x <tt>opus_int32 *</tt>: pitch period at 48 kHz (or 0 if not available)
|
|
||||||
*
|
|
||||||
* @hideinitializer */
|
|
||||||
#define OPUS_GET_PITCH(x) OPUS_GET_PITCH_REQUEST, __opus_check_int_ptr(x)
|
|
||||||
|
|
||||||
/** Gets the encoder's configured bandpass or the decoder's last bandpass.
|
/** Gets the encoder's configured bandpass or the decoder's last bandpass.
|
||||||
* @see OPUS_SET_BANDWIDTH
|
* @see OPUS_SET_BANDWIDTH
|
||||||
* @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
|
* @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
|
||||||
@ -604,6 +650,14 @@ extern "C" {
|
|||||||
* @hideinitializer */
|
* @hideinitializer */
|
||||||
#define OPUS_GET_BANDWIDTH(x) OPUS_GET_BANDWIDTH_REQUEST, __opus_check_int_ptr(x)
|
#define OPUS_GET_BANDWIDTH(x) OPUS_GET_BANDWIDTH_REQUEST, __opus_check_int_ptr(x)
|
||||||
|
|
||||||
|
/** Gets the sampling rate the encoder or decoder was initialized with.
|
||||||
|
* This simply returns the <code>Fs</code> value passed to opus_encoder_init()
|
||||||
|
* or opus_decoder_init().
|
||||||
|
* @param[out] x <tt>opus_int32 *</tt>: Sampling rate of encoder or decoder.
|
||||||
|
* @hideinitializer
|
||||||
|
*/
|
||||||
|
#define OPUS_GET_SAMPLE_RATE(x) OPUS_GET_SAMPLE_RATE_REQUEST, __opus_check_int_ptr(x)
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
/** @defgroup opus_decoderctls Decoder related CTLs
|
/** @defgroup opus_decoderctls Decoder related CTLs
|
||||||
@ -628,6 +682,23 @@ extern "C" {
|
|||||||
* @hideinitializer */
|
* @hideinitializer */
|
||||||
#define OPUS_GET_GAIN(x) OPUS_GET_GAIN_REQUEST, __opus_check_int_ptr(x)
|
#define OPUS_GET_GAIN(x) OPUS_GET_GAIN_REQUEST, __opus_check_int_ptr(x)
|
||||||
|
|
||||||
|
/** Gets the duration (in samples) of the last packet successfully decoded or concealed.
|
||||||
|
* @param[out] x <tt>opus_int32 *</tt>: Number of samples (at current sampling rate).
|
||||||
|
* @hideinitializer */
|
||||||
|
#define OPUS_GET_LAST_PACKET_DURATION(x) OPUS_GET_LAST_PACKET_DURATION_REQUEST, __opus_check_int_ptr(x)
|
||||||
|
|
||||||
|
/** Gets the pitch of the last decoded frame, if available.
|
||||||
|
* This can be used for any post-processing algorithm requiring the use of pitch,
|
||||||
|
* e.g. time stretching/shortening. If the last frame was not voiced, or if the
|
||||||
|
* pitch was not coded in the frame, then zero is returned.
|
||||||
|
*
|
||||||
|
* This CTL is only implemented for decoder instances.
|
||||||
|
*
|
||||||
|
* @param[out] x <tt>opus_int32 *</tt>: pitch period at 48 kHz (or 0 if not available)
|
||||||
|
*
|
||||||
|
* @hideinitializer */
|
||||||
|
#define OPUS_GET_PITCH(x) OPUS_GET_PITCH_REQUEST, __opus_check_int_ptr(x)
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
/** @defgroup opus_libinfo Opus library information functions
|
/** @defgroup opus_libinfo Opus library information functions
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user