summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libopus/opus_defines.h
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2013-05-20 22:25:57 +0200
committerNils Wallménius <nils@rockbox.org>2013-08-31 08:30:51 +0200
commit580b307fd791c0997a8831bc800bba87797bfb7e (patch)
tree807846056f06fd944a750ce41217a877910ebd59 /lib/rbcodec/codecs/libopus/opus_defines.h
parent74761b70acd96cecc0d35450dd56a98ad9ee7d3d (diff)
downloadrockbox-580b307fd791c0997a8831bc800bba87797bfb7e.tar.gz
rockbox-580b307fd791c0997a8831bc800bba87797bfb7e.zip
Sync opus codec to upstream git
Sync opus codec to upstream commit 02fed471a4568852d6618e041c4f2af0d7730ee2 (August 30 2013) This brings in a lot of optimizations but also makes the diff between our codec and the upstream much smaller as most of our optimizations have been upstreamed or supeceded. Speedups across the board for CELT mode files: 64kbps 128kbps H300 9.82MHz 15.48MHz c200 4.86MHz 9.63MHz fuze v1 10.32MHz 15.92MHz For the silk mode test file (16kbps) arm targets get a speedup of about 2MHz while the H300 is 7.8MHz slower, likely because it's now using the pseudostack more rather than the real stack which is in iram. Patches to get around that are upcomming. Change-Id: Ifecf963e461c51ac42e09dac1e91bc4bc3b12fa3
Diffstat (limited to 'lib/rbcodec/codecs/libopus/opus_defines.h')
-rw-r--r--lib/rbcodec/codecs/libopus/opus_defines.h103
1 files changed, 82 insertions, 21 deletions
diff --git a/lib/rbcodec/codecs/libopus/opus_defines.h b/lib/rbcodec/codecs/libopus/opus_defines.h
index 830d225f14..3474e84c43 100644
--- a/lib/rbcodec/codecs/libopus/opus_defines.h
+++ b/lib/rbcodec/codecs/libopus/opus_defines.h
@@ -63,16 +63,18 @@ extern "C" {
63/** @cond OPUS_INTERNAL_DOC */ 63/** @cond OPUS_INTERNAL_DOC */
64/**Export control for opus functions */ 64/**Export control for opus functions */
65 65
66#if defined(__GNUC__) && defined(OPUS_BUILD) 66#ifndef OPUS_EXPORT
67# define OPUS_EXPORT __attribute__ ((visibility ("default"))) 67# if defined(WIN32)
68#elif defined(WIN32) && !defined(__MINGW32__) 68# ifdef OPUS_BUILD
69# ifdef OPUS_BUILD
70# define OPUS_EXPORT __declspec(dllexport) 69# define OPUS_EXPORT __declspec(dllexport)
71# else 70# else
72# define OPUS_EXPORT 71# define OPUS_EXPORT
72# endif
73# elif defined(__GNUC__) && defined(OPUS_BUILD)
74# define OPUS_EXPORT __attribute__ ((visibility ("default")))
75# else
76# define OPUS_EXPORT
73# endif 77# endif
74#else
75# define OPUS_EXPORT
76#endif 78#endif
77 79
78# if !defined(OPUS_GNUC_PREREQ) 80# if !defined(OPUS_GNUC_PREREQ)
@@ -143,14 +145,20 @@ extern "C" {
143#define OPUS_GET_FINAL_RANGE_REQUEST 4031 145#define OPUS_GET_FINAL_RANGE_REQUEST 4031
144#define OPUS_GET_PITCH_REQUEST 4033 146#define OPUS_GET_PITCH_REQUEST 4033
145#define OPUS_SET_GAIN_REQUEST 4034 147#define OPUS_SET_GAIN_REQUEST 4034
146#define OPUS_GET_GAIN_REQUEST 4045 148#define OPUS_GET_GAIN_REQUEST 4045 /* Should have been 4035 */
147#define OPUS_SET_LSB_DEPTH_REQUEST 4036 149#define OPUS_SET_LSB_DEPTH_REQUEST 4036
148#define OPUS_GET_LSB_DEPTH_REQUEST 4037 150#define OPUS_GET_LSB_DEPTH_REQUEST 4037
151#define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039
152#define OPUS_SET_EXPERT_FRAME_DURATION_REQUEST 4040
153#define OPUS_GET_EXPERT_FRAME_DURATION_REQUEST 4041
154
155/* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */
149 156
150/* Macros to trigger compilation errors when the wrong types are provided to a CTL */ 157/* Macros to trigger compilation errors when the wrong types are provided to a CTL */
151#define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x)) 158#define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x))
152#define __opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr))) 159#define __opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr)))
153#define __opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr))) 160#define __opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr)))
161#define __opus_check_val16_ptr(ptr) ((ptr) + ((ptr) - (opus_val16*)(ptr)))
154/** @endcond */ 162/** @endcond */
155 163
156/** @defgroup opus_ctlvalues Pre-defined values for CTL interface 164/** @defgroup opus_ctlvalues Pre-defined values for CTL interface
@@ -179,6 +187,15 @@ extern "C" {
179#define OPUS_BANDWIDTH_SUPERWIDEBAND 1104 /**<12 kHz bandpass @hideinitializer*/ 187#define OPUS_BANDWIDTH_SUPERWIDEBAND 1104 /**<12 kHz bandpass @hideinitializer*/
180#define OPUS_BANDWIDTH_FULLBAND 1105 /**<20 kHz bandpass @hideinitializer*/ 188#define OPUS_BANDWIDTH_FULLBAND 1105 /**<20 kHz bandpass @hideinitializer*/
181 189
190#define OPUS_FRAMESIZE_ARG 5000 /**< Select frame size from the argument (default) */
191#define OPUS_FRAMESIZE_2_5_MS 5001 /**< Use 2.5 ms frames */
192#define OPUS_FRAMESIZE_5_MS 5002 /**< Use 5 ms frames */
193#define OPUS_FRAMESIZE_10_MS 5003 /**< Use 10 ms frames */
194#define OPUS_FRAMESIZE_20_MS 5004 /**< Use 20 ms frames */
195#define OPUS_FRAMESIZE_40_MS 5005 /**< Use 40 ms frames */
196#define OPUS_FRAMESIZE_60_MS 5006 /**< Use 60 ms frames */
197#define OPUS_FRAMESIZE_VARIABLE 5010 /**< Optimize the frame size dynamically */
198
182/**@}*/ 199/**@}*/
183 200
184 201
@@ -501,6 +518,63 @@ extern "C" {
501 * </dl> 518 * </dl>
502 * @hideinitializer */ 519 * @hideinitializer */
503#define OPUS_GET_DTX(x) OPUS_GET_DTX_REQUEST, __opus_check_int_ptr(x) 520#define OPUS_GET_DTX(x) OPUS_GET_DTX_REQUEST, __opus_check_int_ptr(x)
521/** Configures the depth of signal being encoded.
522 * This is a hint which helps the encoder identify silence and near-silence.
523 * @see OPUS_GET_LSB_DEPTH
524 * @param[in] x <tt>opus_int32</tt>: Input precision in bits, between 8 and 24
525 * (default: 24).
526 * @hideinitializer */
527#define OPUS_SET_LSB_DEPTH(x) OPUS_SET_LSB_DEPTH_REQUEST, __opus_check_int(x)
528/** Gets the encoder's configured signal depth.
529 * @see OPUS_SET_LSB_DEPTH
530 * @param[out] x <tt>opus_int32 *</tt>: Input precision in bits, between 8 and
531 * 24 (default: 24).
532 * @hideinitializer */
533#define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ptr(x)
534
535/** Gets the duration (in samples) of the last packet successfully decoded or concealed.
536 * @param[out] x <tt>opus_int32 *</tt>: Number of samples (at current sampling rate).
537 * @hideinitializer */
538#define OPUS_GET_LAST_PACKET_DURATION(x) OPUS_GET_LAST_PACKET_DURATION_REQUEST, __opus_check_int_ptr(x)
539
540/** Configures the encoder's use of variable duration frames.
541 * When variable duration is enabled, the encoder is free to use a shorter frame
542 * size than the one requested in the opus_encode*() call.
543 * It is then the user's responsibility
544 * to verify how much audio was encoded by checking the ToC byte of the encoded
545 * packet. The part of the audio that was not encoded needs to be resent to the
546 * encoder for the next call. Do not use this option unless you <b>really</b>
547 * know what you are doing.
548 * @see OPUS_GET_EXPERT_VARIABLE_DURATION
549 * @param[in] x <tt>opus_int32</tt>: Allowed values:
550 * <dl>
551 * <dt>OPUS_FRAMESIZE_ARG</dt><dd>Select frame size from the argument (default).</dd>
552 * <dt>OPUS_FRAMESIZE_2_5_MS</dt><dd>Use 2.5 ms frames.</dd>
553 * <dt>OPUS_FRAMESIZE_5_MS</dt><dd>Use 2.5 ms frames.</dd>
554 * <dt>OPUS_FRAMESIZE_10_MS</dt><dd>Use 10 ms frames.</dd>
555 * <dt>OPUS_FRAMESIZE_20_MS</dt><dd>Use 20 ms frames.</dd>
556 * <dt>OPUS_FRAMESIZE_40_MS</dt><dd>Use 40 ms frames.</dd>
557 * <dt>OPUS_FRAMESIZE_60_MS</dt><dd>Use 60 ms frames.</dd>
558 * <dt>OPUS_FRAMESIZE_VARIABLE</dt><dd>Optimize the frame size dynamically.</dd>
559 * </dl>
560 * @hideinitializer */
561#define OPUS_SET_EXPERT_FRAME_DURATION(x) OPUS_SET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int(x)
562/** Gets the encoder's configured use of variable duration frames.
563 * @see OPUS_SET_EXPERT_VARIABLE_DURATION
564 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
565 * <dl>
566 * <dt>OPUS_FRAMESIZE_ARG</dt><dd>Select frame size from the argument (default).</dd>
567 * <dt>OPUS_FRAMESIZE_2_5_MS</dt><dd>Use 2.5 ms frames.</dd>
568 * <dt>OPUS_FRAMESIZE_5_MS</dt><dd>Use 2.5 ms frames.</dd>
569 * <dt>OPUS_FRAMESIZE_10_MS</dt><dd>Use 10 ms frames.</dd>
570 * <dt>OPUS_FRAMESIZE_20_MS</dt><dd>Use 20 ms frames.</dd>
571 * <dt>OPUS_FRAMESIZE_40_MS</dt><dd>Use 40 ms frames.</dd>
572 * <dt>OPUS_FRAMESIZE_60_MS</dt><dd>Use 60 ms frames.</dd>
573 * <dt>OPUS_FRAMESIZE_VARIABLE</dt><dd>Optimize the frame size dynamically.</dd>
574 * </dl>
575 * @hideinitializer */
576#define OPUS_GET_EXPERT_FRAME_DURATION(x) OPUS_GET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int_ptr(x)
577
504/**@}*/ 578/**@}*/
505 579
506/** @defgroup opus_genericctls Generic CTLs 580/** @defgroup opus_genericctls Generic CTLs
@@ -580,19 +654,6 @@ extern "C" {
580 * @hideinitializer */ 654 * @hideinitializer */
581#define OPUS_GET_BANDWIDTH(x) OPUS_GET_BANDWIDTH_REQUEST, __opus_check_int_ptr(x) 655#define OPUS_GET_BANDWIDTH(x) OPUS_GET_BANDWIDTH_REQUEST, __opus_check_int_ptr(x)
582 656
583/** Configures the depth of signal being encoded.
584 * This is a hint which helps the encoder identify silence and near-silence.
585 * @see OPUS_GET_LSB_DEPTH
586 * @param[in] x <tt>opus_int32</tt>: Input precision in bits, between 8 and 24
587 * (default: 24).
588 * @hideinitializer */
589#define OPUS_SET_LSB_DEPTH(x) OPUS_SET_LSB_DEPTH_REQUEST, __opus_check_int(x)
590/** Gets the encoder's configured signal depth.
591 * @see OPUS_SET_LSB_DEPTH
592 * @param[out] x <tt>opus_int32 *</tt>: Input precision in bits, between 8 and
593 * 24 (default: 24).
594 * @hideinitializer */
595#define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ptr(x)
596/**@}*/ 657/**@}*/
597 658
598/** @defgroup opus_decoderctls Decoder related CTLs 659/** @defgroup opus_decoderctls Decoder related CTLs