Applies soft-clipping to the int decoder API.
9 notice, this list of conditions and the following disclaimer.
13 documentation and/or other materials provided with the distribution.
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46 * The Opus codec is designed for interactive speech and audio transmission over the Internet.
48 * Skype's SILK codec and Xiph.Org's CELT codec.
78 * @brief This page describes the process and functions used to encode Opus.
91 * state @b must @b not be re-initialized for each frame.
106 * future versions of this code may change the size, so no assuptions should be made about it.
127 * See @ref opus_encoderctls and @ref opus_genericctls for a complete list of parameters that can be set or queried. Most parameters can be set or changed at any time during a stream.
139 * <li>max_packet is the maximum number of bytes that can be written in the packet (4000 bytes is recommended).
143 * opus_encode() and opus_encode_float() return the number of bytes actually written to the packet.
145 * is 1 byte, then the packet does not need to be transmitted (DTX).
159 /** Opus encoder state.
160 * This contains the complete state of an Opus encoder.
161 * It is position independent and can be freely copied.
166 /** Gets the size of an <code>OpusEncoder</code> structure.
167 * @param[in] channels <tt>int</tt>: Number of channels.
168 * This must be 1 or 2.
169 * @returns The size in bytes.
176 /** Allocates and initializes an encoder state.
184 * even at high bitrates the output may sound different from the input.
189 * than 15 ms of coding delay.
192 * disables the speech-optimized mode in exchange for slightly reduced delay.
194 * because it changes the codec delay.
196 * This is useful when the caller knows that the speech-optimized modes will not be needed (use with caution).
199 * 24000, or 48000.
206 * and let the encoder optimize the encoding.
216 * The memory pointed to by st must be at least the size returned by opus_encoder_get_size().
217 * This is intended for applications which use their own allocator instead of malloc.
219 * To reset a previously initialized state, use the #OPUS_RESET_STATE CTL.
223 * 24000, or 48000.
235 /** Encodes an Opus frame.
241 * the encoder's sampling rate.
248 * or hybrid modes.
249 * @param [out] data <tt>unsigned char*</tt>: Output payload.
251 * least \a max_data_bytes.
259 * control the bitrate.
261 * negative error code (see @ref opus_errorcodes) on failure.
271 /** Encodes an Opus frame from floating point input.
273 * @param [in] pcm <tt>float*</tt>: Input in float format (interleaved if 2 channels), with a normal range of +/-1.0.
277 * extended dynamic range.
282 * the encoder's sampling rate.
289 * or hybrid modes.
290 * @param [out] data <tt>unsigned char*</tt>: Output payload.
292 * least \a max_data_bytes.
300 * control the bitrate.
302 * negative error code (see @ref opus_errorcodes) on failure.
312 /** Frees an <code>OpusEncoder</code> allocated by opus_encoder_create().
313 * @param[in] st <tt>OpusEncoder*</tt>: State to be freed.
317 /** Perform a CTL function on an Opus encoder.
320 * by a convenience macro.
321 * @param st <tt>OpusEncoder*</tt>: Encoder state.
334 * @brief This page describes the process and functions used to decode Opus.
360 * future versions of this code may change the size, so no assuptions should be made about it.
376 * opus_decode() and opus_decode_float() return the number of samples (per channel) decoded from the packet.
378 * buffer is too small to hold the decoded audio.
384 * the decoder with a null pointer and zero length for the missing packet.
394 /** Opus decoder state.
395 * This contains the complete state of an Opus decoder.
396 * It is position independent and can be freely copied.
401 /** Gets the size of an <code>OpusDecoder</code> structure.
402 * @param [in] channels <tt>int</tt>: Number of channels.
403 * This must be 1 or 2.
404 * @returns The size in bytes.
408 /** Allocates and initializes a decoder state.
409 * @param [in] Fs <tt>opus_int32</tt>: Sample rate to decode at (Hz).
411 * 24000, or 48000.
421 * interleaved stereo pcm buffers, at the caller's request.
429 /** Initializes a previously allocated decoder state.
430 * The state must be at least the size returned by opus_decoder_get_size().
432 * To reset a previously initialized state, use the #OPUS_RESET_STATE CTL.
433 * @param [in] st <tt>OpusDecoder*</tt>: Decoder state.
434 * @param [in] Fs <tt>opus_int32</tt>: Sampling rate to decode to (Hz).
436 * 24000, or 48000.
446 /** Decode an Opus packet.
452 * @param [in] frame_size Number of samples per channel of available space in \a pcm.
457 * FEC cases, frame_size <b>must</b> be a multiple of 2.5 ms.
459 * decoded. If no such data is available, the frame is decoded as if it were lost.
471 /** Decode an Opus packet with floating point output.
477 * @param [in] frame_size Number of samples per channel of available space in \a pcm.
482 * FEC cases, frame_size <b>must</b> be a multiple of 2.5 ms.
484 * decoded. If no such data is available the frame is decoded as if it were lost.
496 /** Perform a CTL function on an Opus decoder.
499 * by a convenience macro.
500 * @param st <tt>OpusDecoder*</tt>: Decoder state.
509 /** Frees an <code>OpusDecoder</code> allocated by opus_decoder_create().
510 * @param[in] st <tt>OpusDecoder*</tt>: State to be freed.
514 /** Parse an opus packet into one or more frames.
516 * not need to use this function.
518 * the input packet.
536 /** Gets the bandwidth of an Opus packet.
547 /** Gets the number of samples per frame from an Opus packet.
548 * @param [in] data <tt>char*</tt>: Opus packet.
551 * @param [in] Fs <tt>opus_int32</tt>: Sampling rate in Hz.
553 * inaccurate results will be returned.
554 * @returns Number of samples per frame.
558 /** Gets the number of channels from an Opus packet.
565 /** Gets the number of frames in an Opus packet.
574 /** Gets the number of samples of an Opus packet.
577 * @param [in] Fs <tt>opus_int32</tt>: Sampling rate in Hz.
579 * inaccurate results will be returned.
586 /** Gets the number of samples of an Opus packet.
619 * packet is no more than 120 ms.
622 * the degenerate case where they consist of data from a single stream.
637 * input packets via opus_repacketizer_init().
698 * // submitting it.
705 * // reference to data[nb_packets] should be valid.
733 * // Output the final, partial packet.
753 /** Gets the size of an <code>OpusRepacketizer</code> structure.
754 * @returns The size in bytes.
758 /** (Re)initializes a previously allocated repacketizer state.
759 * The state must be at least the size returned by opus_repacketizer_get_size().
765 * configuration (coding mode, audio bandwidth, frame size, or channel count).
773 * @returns A pointer to the same repacketizer state that was passed in.
784 * @param[in] rp <tt>OpusRepacketizer*</tt>: State to be freed.
788 /** Add a packet to the current repacketizer state.
790 * for repacketization since the last call to opus_repacketizer_init().
792 * size, and channel count.
795 * byte of any previously submitted packet.
797 * 120 ms, the maximum duration of a single packet, after adding this packet.
800 * packets using opus_repacketizer_out() or opus_repacketizer_out_range().
815 * add the packet.
816 * @param[in] data <tt>const unsigned char*</tt>: The packet data.
822 * @param len <tt>opus_int32</tt>: The number of bytes in the packet data.
823 * @returns An error code indicating whether or not the operation succeeded.
833 * than 120 ms.
839 * state via opus_repacketizer_cat().
841 * construct the new packet.
843 * repacketizer state to include in the output.
848 * store the output packet.
860 * sufficient, and possibly much smaller.
867 * complete output packet.
873 * call to opus_repacketizer_init() or opus_repacketizer_create().
875 * opus_repacketizer_out_range() or opus_repacketizer_out().
879 * to the repacketizer state.
884 * state via opus_repacketizer_cat().
886 * in a single packet.
893 * construct the new packet.
895 * store the output packet.
906 * sufficient, and possibly much smaller.
910 * complete output packet.