diff --git a/jni/nv_opus_dec/libopus/arm64-v8a/libopus.a b/jni/nv_opus_dec/libopus/arm64-v8a/libopus.a index e2c1a406..d2e77407 100644 Binary files a/jni/nv_opus_dec/libopus/arm64-v8a/libopus.a and b/jni/nv_opus_dec/libopus/arm64-v8a/libopus.a differ diff --git a/jni/nv_opus_dec/libopus/armeabi-v7a/libopus.a b/jni/nv_opus_dec/libopus/armeabi-v7a/libopus.a index 731f807f..14aefa43 100644 Binary files a/jni/nv_opus_dec/libopus/armeabi-v7a/libopus.a and b/jni/nv_opus_dec/libopus/armeabi-v7a/libopus.a differ diff --git a/jni/nv_opus_dec/libopus/build_android.sh b/jni/nv_opus_dec/libopus/build_android.sh index 2adeae7b..bc8ec5c4 100755 --- a/jni/nv_opus_dec/libopus/build_android.sh +++ b/jni/nv_opus_dec/libopus/build_android.sh @@ -14,7 +14,8 @@ export PATH=$PATH:$TOOLCHAIN_PATH/bin --build=x86_64-unknown-linux-gnu \ --host=$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 -j$PARALLEL_JOBS mkdir android/$CPU @@ -28,6 +29,7 @@ SYSROOT_CPU=mips TOOLCHAIN_BIN_PREFIX=mipsel-linux-android TOOLCHAIN_DIR=mipsel-linux-android-4.9 ADDI_CFLAGS="-mips32 -mhard-float -EL -mno-dsp" +ADDI_CONFIGURE_FLAGS="--enable-fixed-point" # fixed point build_one } @@ -38,6 +40,7 @@ SYSROOT_CPU=mips64 TOOLCHAIN_BIN_PREFIX=mips64el-linux-android TOOLCHAIN_DIR=mips64el-linux-android-4.9 ADDI_CFLAGS="-mips64r6" +ADDI_CONFIGURE_FLAGS="--enable-fixed-point" # fixed point build_one } @@ -48,6 +51,7 @@ SYSROOT_CPU=x86 TOOLCHAIN_BIN_PREFIX=i686-linux-android TOOLCHAIN_DIR=x86-4.9 ADDI_CFLAGS="-march=i686 -mtune=atom -mstackrealign -msse -msse2 -msse3 -mssse3 -mfpmath=sse -m32" +ADDI_CONFIGURE_FLAGS="" # floating point for SSE optimizations build_one } @@ -58,6 +62,7 @@ SYSROOT_CPU=x86_64 TOOLCHAIN_BIN_PREFIX=x86_64-linux-android TOOLCHAIN_DIR=x86_64-4.9 ADDI_CFLAGS="-msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -mpopcnt -m64" +ADDI_CONFIGURE_FLAGS="" # floating point for SSE optimizations build_one } @@ -69,10 +74,12 @@ TOOLCHAIN_BIN_PREFIX=arm-linux-androideabi TOOLCHAIN_DIR=arm-linux-androideabi-4.9 ADDI_CFLAGS="-marm -mfpu=vfpv3-d16" ADDI_LDFLAGS="" -ADDI_CONFIGURE_FLAGS="" +ADDI_CONFIGURE_FLAGS="--enable-fixed-point" # fixed point for NEON, EDSP, Media 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 { CPU=aarch64 @@ -81,7 +88,7 @@ TOOLCHAIN_BIN_PREFIX=aarch64-linux-android TOOLCHAIN_DIR=aarch64-linux-android-4.9 ADDI_CFLAGS="" ADDI_LDFLAGS="" -ADDI_CONFIGURE_FLAGS="" +ADDI_CONFIGURE_FLAGS="--enable-fixed-point" build_one } diff --git a/jni/nv_opus_dec/libopus/inc/opus.h b/jni/nv_opus_dec/libopus/inc/opus.h index ce860388..93a53a2f 100644 --- a/jni/nv_opus_dec/libopus/inc/opus.h +++ b/jni/nv_opus_dec/libopus/inc/opus.h @@ -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 */ 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 float*: Input PCM and modified PCM + * @param [in] frame_size int Number of samples per channel to process + * @param [in] channels int: Number of channels + * @param [in,out] softclip_mem float*: 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 @@ -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); +/** Pads a given Opus packet to a larger size (possibly changing the TOC sequence). + * @param[in,out] data const unsigned char*: The buffer containing the + * packet to pad. + * @param len opus_int32: The size of the packet. + * This must be at least 1. + * @param new_len opus_int32: 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 const unsigned char*: The buffer containing the + * packet to strip. + * @param len opus_int32: 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 const unsigned char*: The buffer containing the + * packet to pad. + * @param len opus_int32: The size of the packet. + * This must be at least 1. + * @param new_len opus_int32: The desired size of the packet after padding. + * This must be at least 1. + * @param nb_streams opus_int32: 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 const unsigned char*: The buffer containing the + * packet to strip. + * @param len opus_int32: The size of the packet. + * This must be at least 1. + * @param nb_streams opus_int32: 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 diff --git a/jni/nv_opus_dec/libopus/inc/opus_custom.h b/jni/nv_opus_dec/libopus/inc/opus_custom.h index e7861d6f..41f36bf2 100644 --- a/jni/nv_opus_dec/libopus/inc/opus_custom.h +++ b/jni/nv_opus_dec/libopus/inc/opus_custom.h @@ -42,15 +42,15 @@ extern "C" { #endif #ifdef CUSTOM_MODES -#define OPUS_CUSTOM_EXPORT OPUS_EXPORT -#define OPUS_CUSTOM_EXPORT_STATIC OPUS_EXPORT +# define OPUS_CUSTOM_EXPORT OPUS_EXPORT +# define OPUS_CUSTOM_EXPORT_STATIC OPUS_EXPORT #else -#define OPUS_CUSTOM_EXPORT -#ifdef CELT_C -#define OPUS_CUSTOM_EXPORT_STATIC static inline -#else -#define OPUS_CUSTOM_EXPORT_STATIC -#endif +# define OPUS_CUSTOM_EXPORT +# ifdef OPUS_BUILD +# define OPUS_CUSTOM_EXPORT_STATIC static OPUS_INLINE +# else +# define OPUS_CUSTOM_EXPORT_STATIC +# endif #endif /** @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); + +#if !defined(OPUS_BUILD) || defined(CELT_ENCODER_C) + /* Encoder */ /** Gets the size of an OpusCustomEncoder structure. * @param [in] mode OpusCustomMode *: Mode configuration @@ -137,6 +140,28 @@ OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_si int channels ) 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 OpusCustomEncoder*: Encoder state + * @param [in] mode OpusCustomMode *: Contains all the information about the characteristics of + * the stream (must be the same characteristics as used for the + * decoder) + * @param [in] channels int: 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 * state (can't be shared across simultaneous streams). * @param [in] mode OpusCustomMode*: 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 ) 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 OpusCustomEncoder*: Encoder state - * @param [in] mode OpusCustomMode *: Contains all the information about the characteristics of - * the stream (must be the same characteristics as used for the - * decoder) - * @param [in] channels int: 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. * @param[in] st OpusCustomEncoder*: 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); + +#if !defined(OPUS_BUILD) || defined(CELT_DECODER_C) /* Decoder */ /** 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 ) 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 OpusCustomMode: Contains all the information about the characteristics of the - * stream (must be the same characteristics as used for the encoder) - * @param [in] channels int: Number of channels - * @param [out] error int*: 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 * 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. @@ -273,6 +269,23 @@ OPUS_CUSTOM_EXPORT_STATIC int opus_custom_decoder_init( int channels ) 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 OpusCustomMode: Contains all the information about the characteristics of the + * stream (must be the same characteristics as used for the encoder) + * @param [in] channels int: Number of channels + * @param [out] error int*: 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. * @param[in] st OpusCustomDecoder*: State to be freed. */ diff --git a/jni/nv_opus_dec/libopus/inc/opus_defines.h b/jni/nv_opus_dec/libopus/inc/opus_defines.h index 9fa3ccb5..32b7c976 100644 --- a/jni/nv_opus_dec/libopus/inc/opus_defines.h +++ b/jni/nv_opus_dec/libopus/inc/opus_defines.h @@ -46,7 +46,7 @@ extern "C" { #define OPUS_OK 0 /** One or more invalid/out of range arguments @hideinitializer*/ #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 /** An internal error was detected @hideinitializer*/ #define OPUS_INTERNAL_ERROR -3 @@ -98,6 +98,18 @@ extern "C" { # define OPUS_RESTRICT restrict #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 * NONNULL is not used in OPUS_BUILD to avoid the compiler optimizing out * some paranoid null checks. */ @@ -148,8 +160,11 @@ extern "C" { #define OPUS_GET_GAIN_REQUEST 4045 /* Should have been 4035 */ #define OPUS_SET_LSB_DEPTH_REQUEST 4036 #define OPUS_GET_LSB_DEPTH_REQUEST 4037 - #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 */ @@ -157,6 +172,7 @@ extern "C" { #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_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr))) +#define __opus_check_val16_ptr(ptr) ((ptr) + ((ptr) - (opus_val16*)(ptr))) /** @endcond */ /** @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_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 */ #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 Fs value passed to opus_encoder_init() - * or opus_decoder_init(). - * @param[out] x opus_int32 *: 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. * 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 @@ -521,10 +537,52 @@ extern "C" { * @hideinitializer */ #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. - * @param[out] x opus_int32 *: Number of samples (at current sampling rate). +/** Configures the encoder's use of variable duration frames. + * 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 really + * know what you are doing. + * @see OPUS_GET_EXPERT_VARIABLE_DURATION + * @param[in] x opus_int32: Allowed values: + *
+ *
OPUS_FRAMESIZE_ARG
Select frame size from the argument (default).
+ *
OPUS_FRAMESIZE_2_5_MS
Use 2.5 ms frames.
+ *
OPUS_FRAMESIZE_5_MS
Use 2.5 ms frames.
+ *
OPUS_FRAMESIZE_10_MS
Use 10 ms frames.
+ *
OPUS_FRAMESIZE_20_MS
Use 20 ms frames.
+ *
OPUS_FRAMESIZE_40_MS
Use 40 ms frames.
+ *
OPUS_FRAMESIZE_60_MS
Use 60 ms frames.
+ *
OPUS_FRAMESIZE_VARIABLE
Optimize the frame size dynamically.
+ *
* @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 opus_int32 *: Returns one of the following values: + *
+ *
OPUS_FRAMESIZE_ARG
Select frame size from the argument (default).
+ *
OPUS_FRAMESIZE_2_5_MS
Use 2.5 ms frames.
+ *
OPUS_FRAMESIZE_5_MS
Use 2.5 ms frames.
+ *
OPUS_FRAMESIZE_10_MS
Use 10 ms frames.
+ *
OPUS_FRAMESIZE_20_MS
Use 20 ms frames.
+ *
OPUS_FRAMESIZE_40_MS
Use 40 ms frames.
+ *
OPUS_FRAMESIZE_60_MS
Use 60 ms frames.
+ *
OPUS_FRAMESIZE_VARIABLE
Optimize the frame size dynamically.
+ *
+ * @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 @@ -578,18 +636,6 @@ extern "C" { * @hideinitializer */ #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 opus_int32 *: 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. * @see OPUS_SET_BANDWIDTH * @param[out] x opus_int32 *: Returns one of the following values: @@ -604,6 +650,14 @@ extern "C" { * @hideinitializer */ #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 Fs value passed to opus_encoder_init() + * or opus_decoder_init(). + * @param[out] x opus_int32 *: 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 @@ -628,6 +682,23 @@ extern "C" { * @hideinitializer */ #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 opus_int32 *: 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 opus_int32 *: 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 diff --git a/jni/nv_opus_dec/libopus/mips/libopus.a b/jni/nv_opus_dec/libopus/mips/libopus.a index 9156171b..688dee75 100644 Binary files a/jni/nv_opus_dec/libopus/mips/libopus.a and b/jni/nv_opus_dec/libopus/mips/libopus.a differ diff --git a/jni/nv_opus_dec/libopus/mips64/libopus.a b/jni/nv_opus_dec/libopus/mips64/libopus.a index ccdef43b..0b5aa793 100644 Binary files a/jni/nv_opus_dec/libopus/mips64/libopus.a and b/jni/nv_opus_dec/libopus/mips64/libopus.a differ diff --git a/jni/nv_opus_dec/libopus/x86/libopus.a b/jni/nv_opus_dec/libopus/x86/libopus.a index a6b53c4d..29aa9f48 100644 Binary files a/jni/nv_opus_dec/libopus/x86/libopus.a and b/jni/nv_opus_dec/libopus/x86/libopus.a differ diff --git a/jni/nv_opus_dec/libopus/x86_64/libopus.a b/jni/nv_opus_dec/libopus/x86_64/libopus.a index 2cf1798c..572a6f11 100644 Binary files a/jni/nv_opus_dec/libopus/x86_64/libopus.a and b/jni/nv_opus_dec/libopus/x86_64/libopus.a differ diff --git a/libs/arm64-v8a/libnv_opus_dec.so b/libs/arm64-v8a/libnv_opus_dec.so index b6809a97..1d01bae3 100755 Binary files a/libs/arm64-v8a/libnv_opus_dec.so and b/libs/arm64-v8a/libnv_opus_dec.so differ diff --git a/libs/armeabi-v7a/libnv_opus_dec.so b/libs/armeabi-v7a/libnv_opus_dec.so index 7c3284f6..6b425830 100755 Binary files a/libs/armeabi-v7a/libnv_opus_dec.so and b/libs/armeabi-v7a/libnv_opus_dec.so differ diff --git a/libs/mips/libnv_opus_dec.so b/libs/mips/libnv_opus_dec.so index eeb6e26a..b1efef8b 100755 Binary files a/libs/mips/libnv_opus_dec.so and b/libs/mips/libnv_opus_dec.so differ diff --git a/libs/x86/libnv_opus_dec.so b/libs/x86/libnv_opus_dec.so index 8e3dfa8b..8700474f 100755 Binary files a/libs/x86/libnv_opus_dec.so and b/libs/x86/libnv_opus_dec.so differ diff --git a/libs/x86_64/libnv_opus_dec.so b/libs/x86_64/libnv_opus_dec.so index b54768ae..eaf35286 100755 Binary files a/libs/x86_64/libnv_opus_dec.so and b/libs/x86_64/libnv_opus_dec.so differ