tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

opus_projection.h (32998B)


      1 /* Copyright (c) 2017 Google Inc.
      2   Written by Andrew Allen */
      3 /*
      4   Redistribution and use in source and binary forms, with or without
      5   modification, are permitted provided that the following conditions
      6   are met:
      7 
      8   - Redistributions of source code must retain the above copyright
      9   notice, this list of conditions and the following disclaimer.
     10 
     11   - Redistributions in binary form must reproduce the above copyright
     12   notice, this list of conditions and the following disclaimer in the
     13   documentation and/or other materials provided with the distribution.
     14 
     15   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     16   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     17   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     18   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
     19   OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     20   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     21   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     22   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     23   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     24   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     25   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26 */
     27 
     28 /**
     29 * @file opus_projection.h
     30 * @brief Opus projection reference API
     31 */
     32 
     33 #ifndef OPUS_PROJECTION_H
     34 #define OPUS_PROJECTION_H
     35 
     36 #include "opus_multistream.h"
     37 
     38 #ifdef __cplusplus
     39 extern "C" {
     40 #endif
     41 
     42 /** @cond OPUS_INTERNAL_DOC */
     43 
     44 /** These are the actual encoder and decoder CTL ID numbers.
     45  * They should not be used directly by applications.c
     46  * In general, SETs should be even and GETs should be odd.*/
     47 /**@{*/
     48 #define OPUS_PROJECTION_GET_DEMIXING_MATRIX_GAIN_REQUEST    6001
     49 #define OPUS_PROJECTION_GET_DEMIXING_MATRIX_SIZE_REQUEST    6003
     50 #define OPUS_PROJECTION_GET_DEMIXING_MATRIX_REQUEST         6005
     51 /**@}*/
     52 
     53 
     54 /** @endcond */
     55 
     56 /** @defgroup opus_projection_ctls Projection specific encoder and decoder CTLs
     57  *
     58  * These are convenience macros that are specific to the
     59  * opus_projection_encoder_ctl() and opus_projection_decoder_ctl()
     60  * interface.
     61  * The CTLs from @ref opus_genericctls, @ref opus_encoderctls,
     62  * @ref opus_decoderctls, and @ref opus_multistream_ctls may be applied to a
     63  * projection encoder or decoder as well.
     64  */
     65 /**@{*/
     66 
     67 /** Gets the gain (in dB. S7.8-format) of the demixing matrix from the encoder.
     68  * @param[out] x <tt>opus_int32 *</tt>: Returns the gain (in dB. S7.8-format)
     69  *                                      of the demixing matrix.
     70  * @hideinitializer
     71  */
     72 #define OPUS_PROJECTION_GET_DEMIXING_MATRIX_GAIN(x) OPUS_PROJECTION_GET_DEMIXING_MATRIX_GAIN_REQUEST, opus_check_int_ptr(x)
     73 
     74 
     75 /** Gets the size in bytes of the demixing matrix from the encoder.
     76  * @param[out] x <tt>opus_int32 *</tt>: Returns the size in bytes of the
     77  *                                      demixing matrix.
     78  * @hideinitializer
     79  */
     80 #define OPUS_PROJECTION_GET_DEMIXING_MATRIX_SIZE(x) OPUS_PROJECTION_GET_DEMIXING_MATRIX_SIZE_REQUEST, opus_check_int_ptr(x)
     81 
     82 
     83 /** Copies the demixing matrix to the supplied pointer location.
     84  * @param[out] x <tt>unsigned char *</tt>: Returns the demixing matrix to the
     85  *                                         supplied pointer location.
     86  * @param y <tt>opus_int32</tt>: The size in bytes of the reserved memory at the
     87  *                              pointer location.
     88  * @hideinitializer
     89  */
     90 #define OPUS_PROJECTION_GET_DEMIXING_MATRIX(x,y) OPUS_PROJECTION_GET_DEMIXING_MATRIX_REQUEST, x, opus_check_int(y)
     91 
     92 
     93 /**@}*/
     94 
     95 /** Opus projection encoder state.
     96 * This contains the complete state of a projection Opus encoder.
     97 * It is position independent and can be freely copied.
     98 * @see opus_projection_ambisonics_encoder_create
     99 */
    100 typedef struct OpusProjectionEncoder OpusProjectionEncoder;
    101 
    102 
    103 /** Opus projection decoder state.
    104  * This contains the complete state of a projection Opus decoder.
    105  * It is position independent and can be freely copied.
    106  * @see opus_projection_decoder_create
    107  * @see opus_projection_decoder_init
    108  */
    109 typedef struct OpusProjectionDecoder OpusProjectionDecoder;
    110 
    111 
    112 /**\name Projection encoder functions */
    113 /**@{*/
    114 
    115 /** Gets the size of an OpusProjectionEncoder structure.
    116  * @param channels <tt>int</tt>: The total number of input channels to encode.
    117  *                               This must be no more than 255.
    118  * @param mapping_family <tt>int</tt>: The mapping family to use for selecting
    119  *                                     the appropriate projection.
    120  * @returns The size in bytes on success, or a negative error code
    121  *          (see @ref opus_errorcodes) on error.
    122  */
    123 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_projection_ambisonics_encoder_get_size(
    124    int channels,
    125    int mapping_family
    126 );
    127 
    128 
    129 /** Allocates and initializes a projection encoder state.
    130  * Call opus_projection_encoder_destroy() to release
    131  * this object when finished.
    132  * @param Fs <tt>opus_int32</tt>: Sampling rate of the input signal (in Hz).
    133  *                                This must be one of 8000, 12000, 16000,
    134  *                                24000, or 48000.
    135  * @param channels <tt>int</tt>: Number of channels in the input signal.
    136  *                               This must be at most 255.
    137  *                               It may be greater than the number of
    138  *                               coded channels (<code>streams +
    139  *                               coupled_streams</code>).
    140  * @param mapping_family <tt>int</tt>: The mapping family to use for selecting
    141  *                                     the appropriate projection.
    142  * @param[out] streams <tt>int *</tt>: The total number of streams that will
    143  *                                     be encoded from the input.
    144  * @param[out] coupled_streams <tt>int *</tt>: Number of coupled (2 channel)
    145  *                                 streams that will be encoded from the input.
    146  * @param application <tt>int</tt>: The target encoder application.
    147  *                                  This must be one of the following:
    148  * <dl>
    149  * <dt>#OPUS_APPLICATION_VOIP</dt>
    150  * <dd>Process signal for improved speech intelligibility.</dd>
    151  * <dt>#OPUS_APPLICATION_AUDIO</dt>
    152  * <dd>Favor faithfulness to the original input.</dd>
    153  * <dt>#OPUS_APPLICATION_RESTRICTED_LOWDELAY</dt>
    154  * <dd>Configure the minimum possible coding delay by disabling certain modes
    155  * of operation.</dd>
    156  * </dl>
    157  * @param[out] error <tt>int *</tt>: Returns #OPUS_OK on success, or an error
    158  *                                   code (see @ref opus_errorcodes) on
    159  *                                   failure.
    160  */
    161 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusProjectionEncoder *opus_projection_ambisonics_encoder_create(
    162    opus_int32 Fs,
    163    int channels,
    164    int mapping_family,
    165    int *streams,
    166    int *coupled_streams,
    167    int application,
    168    int *error
    169 ) OPUS_ARG_NONNULL(4) OPUS_ARG_NONNULL(5);
    170 
    171 
    172 /** Initialize a previously allocated projection encoder state.
    173  * The memory pointed to by \a st must be at least the size returned by
    174  * opus_projection_ambisonics_encoder_get_size().
    175  * This is intended for applications which use their own allocator instead of
    176  * malloc.
    177  * To reset a previously initialized state, use the #OPUS_RESET_STATE CTL.
    178  * @see opus_projection_ambisonics_encoder_create
    179  * @see opus_projection_ambisonics_encoder_get_size
    180  * @param st <tt>OpusProjectionEncoder*</tt>: Projection encoder state to initialize.
    181  * @param Fs <tt>opus_int32</tt>: Sampling rate of the input signal (in Hz).
    182  *                                This must be one of 8000, 12000, 16000,
    183  *                                24000, or 48000.
    184  * @param channels <tt>int</tt>: Number of channels in the input signal.
    185  *                               This must be at most 255.
    186  *                               It may be greater than the number of
    187  *                               coded channels (<code>streams +
    188  *                               coupled_streams</code>).
    189  * @param streams <tt>int</tt>: The total number of streams to encode from the
    190  *                              input.
    191  *                              This must be no more than the number of channels.
    192  * @param coupled_streams <tt>int</tt>: Number of coupled (2 channel) streams
    193  *                                      to encode.
    194  *                                      This must be no larger than the total
    195  *                                      number of streams.
    196  *                                      Additionally, The total number of
    197  *                                      encoded channels (<code>streams +
    198  *                                      coupled_streams</code>) must be no
    199  *                                      more than the number of input channels.
    200  * @param application <tt>int</tt>: The target encoder application.
    201  *                                  This must be one of the following:
    202  * <dl>
    203  * <dt>#OPUS_APPLICATION_VOIP</dt>
    204  * <dd>Process signal for improved speech intelligibility.</dd>
    205  * <dt>#OPUS_APPLICATION_AUDIO</dt>
    206  * <dd>Favor faithfulness to the original input.</dd>
    207  * <dt>#OPUS_APPLICATION_RESTRICTED_LOWDELAY</dt>
    208  * <dd>Configure the minimum possible coding delay by disabling certain modes
    209  * of operation.</dd>
    210  * </dl>
    211  * @returns #OPUS_OK on success, or an error code (see @ref opus_errorcodes)
    212  *          on failure.
    213  */
    214 OPUS_EXPORT int opus_projection_ambisonics_encoder_init(
    215    OpusProjectionEncoder *st,
    216    opus_int32 Fs,
    217    int channels,
    218    int mapping_family,
    219    int *streams,
    220    int *coupled_streams,
    221    int application
    222 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(5) OPUS_ARG_NONNULL(6);
    223 
    224 
    225 /** Encodes a projection Opus frame.
    226  * @param st <tt>OpusProjectionEncoder*</tt>: Projection encoder state.
    227  * @param[in] pcm <tt>const opus_int16*</tt>: The input signal as interleaved
    228  *                                            samples.
    229  *                                            This must contain
    230  *                                            <code>frame_size*channels</code>
    231  *                                            samples.
    232  * @param frame_size <tt>int</tt>: Number of samples per channel in the input
    233  *                                 signal.
    234  *                                 This must be an Opus frame size for the
    235  *                                 encoder's sampling rate.
    236  *                                 For example, at 48 kHz the permitted values
    237  *                                 are 120, 240, 480, 960, 1920, and 2880.
    238  *                                 Passing in a duration of less than 10 ms
    239  *                                 (480 samples at 48 kHz) will prevent the
    240  *                                 encoder from using the LPC or hybrid modes.
    241  * @param[out] data <tt>unsigned char*</tt>: Output payload.
    242  *                                           This must contain storage for at
    243  *                                           least \a max_data_bytes.
    244  * @param [in] max_data_bytes <tt>opus_int32</tt>: Size of the allocated
    245  *                                                 memory for the output
    246  *                                                 payload. This may be
    247  *                                                 used to impose an upper limit on
    248  *                                                 the instant bitrate, but should
    249  *                                                 not be used as the only bitrate
    250  *                                                 control. Use #OPUS_SET_BITRATE to
    251  *                                                 control the bitrate.
    252  * @returns The length of the encoded packet (in bytes) on success or a
    253  *          negative error code (see @ref opus_errorcodes) on failure.
    254  */
    255 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_encode(
    256    OpusProjectionEncoder *st,
    257    const opus_int16 *pcm,
    258    int frame_size,
    259    unsigned char *data,
    260    opus_int32 max_data_bytes
    261 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
    262 
    263 /** Encodes a projection Opus frame.
    264  * @param st <tt>OpusProjectionEncoder*</tt>: Projection encoder state.
    265  * @param[in] pcm <tt>const opus_int32*</tt>: The input signal as interleaved
    266  *                                            samples representing (or slightly exceeding) 24-bit values.
    267  *                                            This must contain
    268  *                                            <code>frame_size*channels</code>
    269  *                                            samples.
    270  * @param frame_size <tt>int</tt>: Number of samples per channel in the input
    271  *                                 signal.
    272  *                                 This must be an Opus frame size for the
    273  *                                 encoder's sampling rate.
    274  *                                 For example, at 48 kHz the permitted values
    275  *                                 are 120, 240, 480, 960, 1920, and 2880.
    276  *                                 Passing in a duration of less than 10 ms
    277  *                                 (480 samples at 48 kHz) will prevent the
    278  *                                 encoder from using the LPC or hybrid modes.
    279  * @param[out] data <tt>unsigned char*</tt>: Output payload.
    280  *                                           This must contain storage for at
    281  *                                           least \a max_data_bytes.
    282  * @param [in] max_data_bytes <tt>opus_int32</tt>: Size of the allocated
    283  *                                                 memory for the output
    284  *                                                 payload. This may be
    285  *                                                 used to impose an upper limit on
    286  *                                                 the instant bitrate, but should
    287  *                                                 not be used as the only bitrate
    288  *                                                 control. Use #OPUS_SET_BITRATE to
    289  *                                                 control the bitrate.
    290  * @returns The length of the encoded packet (in bytes) on success or a
    291  *          negative error code (see @ref opus_errorcodes) on failure.
    292  */
    293 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_encode24(
    294    OpusProjectionEncoder *st,
    295    const opus_int32 *pcm,
    296    int frame_size,
    297    unsigned char *data,
    298    opus_int32 max_data_bytes
    299 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
    300 
    301 
    302 /** Encodes a projection Opus frame from floating point input.
    303  * @param st <tt>OpusProjectionEncoder*</tt>: Projection encoder state.
    304  * @param[in] pcm <tt>const float*</tt>: The input signal as interleaved
    305  *                                       samples with a normal range of
    306  *                                       +/-1.0.
    307  *                                       Samples with a range beyond +/-1.0
    308  *                                       are supported but will be clipped by
    309  *                                       decoders using the integer API and
    310  *                                       should only be used if it is known
    311  *                                       that the far end supports extended
    312  *                                       dynamic range.
    313  *                                       This must contain
    314  *                                       <code>frame_size*channels</code>
    315  *                                       samples.
    316  * @param frame_size <tt>int</tt>: Number of samples per channel in the input
    317  *                                 signal.
    318  *                                 This must be an Opus frame size for the
    319  *                                 encoder's sampling rate.
    320  *                                 For example, at 48 kHz the permitted values
    321  *                                 are 120, 240, 480, 960, 1920, and 2880.
    322  *                                 Passing in a duration of less than 10 ms
    323  *                                 (480 samples at 48 kHz) will prevent the
    324  *                                 encoder from using the LPC or hybrid modes.
    325  * @param[out] data <tt>unsigned char*</tt>: Output payload.
    326  *                                           This must contain storage for at
    327  *                                           least \a max_data_bytes.
    328  * @param [in] max_data_bytes <tt>opus_int32</tt>: Size of the allocated
    329  *                                                 memory for the output
    330  *                                                 payload. This may be
    331  *                                                 used to impose an upper limit on
    332  *                                                 the instant bitrate, but should
    333  *                                                 not be used as the only bitrate
    334  *                                                 control. Use #OPUS_SET_BITRATE to
    335  *                                                 control the bitrate.
    336  * @returns The length of the encoded packet (in bytes) on success or a
    337  *          negative error code (see @ref opus_errorcodes) on failure.
    338  */
    339 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_encode_float(
    340    OpusProjectionEncoder *st,
    341    const float *pcm,
    342    int frame_size,
    343    unsigned char *data,
    344    opus_int32 max_data_bytes
    345 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
    346 
    347 
    348 /** Frees an <code>OpusProjectionEncoder</code> allocated by
    349  * opus_projection_ambisonics_encoder_create().
    350  * @param st <tt>OpusProjectionEncoder*</tt>: Projection encoder state to be freed.
    351  */
    352 OPUS_EXPORT void opus_projection_encoder_destroy(OpusProjectionEncoder *st);
    353 
    354 
    355 /** Perform a CTL function on a projection Opus encoder.
    356  *
    357  * Generally the request and subsequent arguments are generated by a
    358  * convenience macro.
    359  * @param st <tt>OpusProjectionEncoder*</tt>: Projection encoder state.
    360  * @param request This and all remaining parameters should be replaced by one
    361  *                of the convenience macros in @ref opus_genericctls,
    362  *                @ref opus_encoderctls, @ref opus_multistream_ctls, or
    363  *                @ref opus_projection_ctls
    364  * @see opus_genericctls
    365  * @see opus_encoderctls
    366  * @see opus_multistream_ctls
    367  * @see opus_projection_ctls
    368  */
    369 OPUS_EXPORT int opus_projection_encoder_ctl(OpusProjectionEncoder *st, int request, ...) OPUS_ARG_NONNULL(1);
    370 
    371 
    372 /**@}*/
    373 
    374 /**\name Projection decoder functions */
    375 /**@{*/
    376 
    377 /** Gets the size of an <code>OpusProjectionDecoder</code> structure.
    378  * @param channels <tt>int</tt>: The total number of output channels.
    379  *                               This must be no more than 255.
    380  * @param streams <tt>int</tt>: The total number of streams coded in the
    381  *                              input.
    382  *                              This must be no more than 255.
    383  * @param coupled_streams <tt>int</tt>: Number streams to decode as coupled
    384  *                                      (2 channel) streams.
    385  *                                      This must be no larger than the total
    386  *                                      number of streams.
    387  *                                      Additionally, The total number of
    388  *                                      coded channels (<code>streams +
    389  *                                      coupled_streams</code>) must be no
    390  *                                      more than 255.
    391  * @returns The size in bytes on success, or a negative error code
    392  *          (see @ref opus_errorcodes) on error.
    393  */
    394 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_projection_decoder_get_size(
    395    int channels,
    396    int streams,
    397    int coupled_streams
    398 );
    399 
    400 
    401 /** Allocates and initializes a projection decoder state.
    402  * Call opus_projection_decoder_destroy() to release
    403  * this object when finished.
    404  * @param Fs <tt>opus_int32</tt>: Sampling rate to decode at (in Hz).
    405  *                                This must be one of 8000, 12000, 16000,
    406  *                                24000, or 48000.
    407  * @param channels <tt>int</tt>: Number of channels to output.
    408  *                               This must be at most 255.
    409  *                               It may be different from the number of coded
    410  *                               channels (<code>streams +
    411  *                               coupled_streams</code>).
    412  * @param streams <tt>int</tt>: The total number of streams coded in the
    413  *                              input.
    414  *                              This must be no more than 255.
    415  * @param coupled_streams <tt>int</tt>: Number of streams to decode as coupled
    416  *                                      (2 channel) streams.
    417  *                                      This must be no larger than the total
    418  *                                      number of streams.
    419  *                                      Additionally, The total number of
    420  *                                      coded channels (<code>streams +
    421  *                                      coupled_streams</code>) must be no
    422  *                                      more than 255.
    423  * @param[in] demixing_matrix <tt>const unsigned char[demixing_matrix_size]</tt>: Demixing matrix
    424  *                         that mapping from coded channels to output channels,
    425  *                         as described in @ref opus_projection and
    426  *                         @ref opus_projection_ctls.
    427  * @param demixing_matrix_size <tt>opus_int32</tt>: The size in bytes of the
    428  *                                                  demixing matrix, as
    429  *                                                  described in @ref
    430  *                                                  opus_projection_ctls.
    431  * @param[out] error <tt>int *</tt>: Returns #OPUS_OK on success, or an error
    432  *                                   code (see @ref opus_errorcodes) on
    433  *                                   failure.
    434  */
    435 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusProjectionDecoder *opus_projection_decoder_create(
    436    opus_int32 Fs,
    437    int channels,
    438    int streams,
    439    int coupled_streams,
    440    unsigned char *demixing_matrix,
    441    opus_int32 demixing_matrix_size,
    442    int *error
    443 ) OPUS_ARG_NONNULL(5);
    444 
    445 
    446 /** Initialize a previously allocated projection decoder state object.
    447  * The memory pointed to by \a st must be at least the size returned by
    448  * opus_projection_decoder_get_size().
    449  * This is intended for applications which use their own allocator instead of
    450  * malloc.
    451  * To reset a previously initialized state, use the #OPUS_RESET_STATE CTL.
    452  * @see opus_projection_decoder_create
    453  * @see opus_projection_deocder_get_size
    454  * @param st <tt>OpusProjectionDecoder*</tt>: Projection encoder state to initialize.
    455  * @param Fs <tt>opus_int32</tt>: Sampling rate to decode at (in Hz).
    456  *                                This must be one of 8000, 12000, 16000,
    457  *                                24000, or 48000.
    458  * @param channels <tt>int</tt>: Number of channels to output.
    459  *                               This must be at most 255.
    460  *                               It may be different from the number of coded
    461  *                               channels (<code>streams +
    462  *                               coupled_streams</code>).
    463  * @param streams <tt>int</tt>: The total number of streams coded in the
    464  *                              input.
    465  *                              This must be no more than 255.
    466  * @param coupled_streams <tt>int</tt>: Number of streams to decode as coupled
    467  *                                      (2 channel) streams.
    468  *                                      This must be no larger than the total
    469  *                                      number of streams.
    470  *                                      Additionally, The total number of
    471  *                                      coded channels (<code>streams +
    472  *                                      coupled_streams</code>) must be no
    473  *                                      more than 255.
    474  * @param[in] demixing_matrix <tt>const unsigned char[demixing_matrix_size]</tt>: Demixing matrix
    475  *                         that mapping from coded channels to output channels,
    476  *                         as described in @ref opus_projection and
    477  *                         @ref opus_projection_ctls.
    478  * @param demixing_matrix_size <tt>opus_int32</tt>: The size in bytes of the
    479  *                                                  demixing matrix, as
    480  *                                                  described in @ref
    481  *                                                  opus_projection_ctls.
    482  * @returns #OPUS_OK on success, or an error code (see @ref opus_errorcodes)
    483  *          on failure.
    484  */
    485 OPUS_EXPORT int opus_projection_decoder_init(
    486    OpusProjectionDecoder *st,
    487    opus_int32 Fs,
    488    int channels,
    489    int streams,
    490    int coupled_streams,
    491    unsigned char *demixing_matrix,
    492    opus_int32 demixing_matrix_size
    493 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
    494 
    495 
    496 /** Decode a projection Opus packet.
    497  * @param st <tt>OpusProjectionDecoder*</tt>: Projection decoder state.
    498  * @param[in] data <tt>const unsigned char*</tt>: Input payload.
    499  *                                                Use a <code>NULL</code>
    500  *                                                pointer to indicate packet
    501  *                                                loss.
    502  * @param len <tt>opus_int32</tt>: Number of bytes in payload.
    503  * @param[out] pcm <tt>opus_int16*</tt>: Output signal, with interleaved
    504  *                                       samples.
    505  *                                       This must contain room for
    506  *                                       <code>frame_size*channels</code>
    507  *                                       samples.
    508  * @param frame_size <tt>int</tt>: The number of samples per channel of
    509  *                                 available space in \a pcm.
    510  *                                 If this is less than the maximum packet duration
    511  *                                 (120 ms; 5760 for 48kHz), this function will not be capable
    512  *                                 of decoding some packets. In the case of PLC (data==NULL)
    513  *                                 or FEC (decode_fec=1), then frame_size needs to be exactly
    514  *                                 the duration of audio that is missing, otherwise the
    515  *                                 decoder will not be in the optimal state to decode the
    516  *                                 next incoming packet. For the PLC and FEC cases, frame_size
    517  *                                 <b>must</b> be a multiple of 2.5 ms.
    518  * @param decode_fec <tt>int</tt>: Flag (0 or 1) to request that any in-band
    519  *                                 forward error correction data be decoded.
    520  *                                 If no such data is available, the frame is
    521  *                                 decoded as if it were lost.
    522  * @returns Number of samples decoded on success or a negative error code
    523  *          (see @ref opus_errorcodes) on failure.
    524  */
    525 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_decode(
    526    OpusProjectionDecoder *st,
    527    const unsigned char *data,
    528    opus_int32 len,
    529    opus_int16 *pcm,
    530    int frame_size,
    531    int decode_fec
    532 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
    533 
    534 /** Decode a projection Opus packet.
    535  * @param st <tt>OpusProjectionDecoder*</tt>: Projection decoder state.
    536  * @param[in] data <tt>const unsigned char*</tt>: Input payload.
    537  *                                                Use a <code>NULL</code>
    538  *                                                pointer to indicate packet
    539  *                                                loss.
    540  * @param len <tt>opus_int32</tt>: Number of bytes in payload.
    541  * @param[out] pcm <tt>opus_int32*</tt>: Output signal, with interleaved
    542  *                                       samples representing (or slightly exceeding) 24-bit values.
    543  *                                       This must contain room for
    544  *                                       <code>frame_size*channels</code>
    545  *                                       samples.
    546  * @param frame_size <tt>int</tt>: The number of samples per channel of
    547  *                                 available space in \a pcm.
    548  *                                 If this is less than the maximum packet duration
    549  *                                 (120 ms; 5760 for 48kHz), this function will not be capable
    550  *                                 of decoding some packets. In the case of PLC (data==NULL)
    551  *                                 or FEC (decode_fec=1), then frame_size needs to be exactly
    552  *                                 the duration of audio that is missing, otherwise the
    553  *                                 decoder will not be in the optimal state to decode the
    554  *                                 next incoming packet. For the PLC and FEC cases, frame_size
    555  *                                 <b>must</b> be a multiple of 2.5 ms.
    556  * @param decode_fec <tt>int</tt>: Flag (0 or 1) to request that any in-band
    557  *                                 forward error correction data be decoded.
    558  *                                 If no such data is available, the frame is
    559  *                                 decoded as if it were lost.
    560  * @returns Number of samples decoded on success or a negative error code
    561  *          (see @ref opus_errorcodes) on failure.
    562  */
    563 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_decode24(
    564    OpusProjectionDecoder *st,
    565    const unsigned char *data,
    566    opus_int32 len,
    567    opus_int32 *pcm,
    568    int frame_size,
    569    int decode_fec
    570 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
    571 
    572 /** Decode a projection Opus packet with floating point output.
    573  * @param st <tt>OpusProjectionDecoder*</tt>: Projection decoder state.
    574  * @param[in] data <tt>const unsigned char*</tt>: Input payload.
    575  *                                                Use a <code>NULL</code>
    576  *                                                pointer to indicate packet
    577  *                                                loss.
    578  * @param len <tt>opus_int32</tt>: Number of bytes in payload.
    579  * @param[out] pcm <tt>opus_int16*</tt>: Output signal, with interleaved
    580  *                                       samples.
    581  *                                       This must contain room for
    582  *                                       <code>frame_size*channels</code>
    583  *                                       samples.
    584  * @param frame_size <tt>int</tt>: The number of samples per channel of
    585  *                                 available space in \a pcm.
    586  *                                 If this is less than the maximum packet duration
    587  *                                 (120 ms; 5760 for 48kHz), this function will not be capable
    588  *                                 of decoding some packets. In the case of PLC (data==NULL)
    589  *                                 or FEC (decode_fec=1), then frame_size needs to be exactly
    590  *                                 the duration of audio that is missing, otherwise the
    591  *                                 decoder will not be in the optimal state to decode the
    592  *                                 next incoming packet. For the PLC and FEC cases, frame_size
    593  *                                 <b>must</b> be a multiple of 2.5 ms.
    594  * @param decode_fec <tt>int</tt>: Flag (0 or 1) to request that any in-band
    595  *                                 forward error correction data be decoded.
    596  *                                 If no such data is available, the frame is
    597  *                                 decoded as if it were lost.
    598  * @returns Number of samples decoded on success or a negative error code
    599  *          (see @ref opus_errorcodes) on failure.
    600  */
    601 OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_decode_float(
    602    OpusProjectionDecoder *st,
    603    const unsigned char *data,
    604    opus_int32 len,
    605    float *pcm,
    606    int frame_size,
    607    int decode_fec
    608 ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
    609 
    610 
    611 /** Perform a CTL function on a projection Opus decoder.
    612  *
    613  * Generally the request and subsequent arguments are generated by a
    614  * convenience macro.
    615  * @param st <tt>OpusProjectionDecoder*</tt>: Projection decoder state.
    616  * @param request This and all remaining parameters should be replaced by one
    617  *                of the convenience macros in @ref opus_genericctls,
    618  *                @ref opus_decoderctls, @ref opus_multistream_ctls, or
    619  *                @ref opus_projection_ctls.
    620  * @see opus_genericctls
    621  * @see opus_decoderctls
    622  * @see opus_multistream_ctls
    623  * @see opus_projection_ctls
    624  */
    625 OPUS_EXPORT int opus_projection_decoder_ctl(OpusProjectionDecoder *st, int request, ...) OPUS_ARG_NONNULL(1);
    626 
    627 
    628 /** Frees an <code>OpusProjectionDecoder</code> allocated by
    629  * opus_projection_decoder_create().
    630  * @param st <tt>OpusProjectionDecoder</tt>: Projection decoder state to be freed.
    631  */
    632 OPUS_EXPORT void opus_projection_decoder_destroy(OpusProjectionDecoder *st);
    633 
    634 
    635 /**@}*/
    636 
    637 /**@}*/
    638 
    639 #ifdef __cplusplus
    640 }
    641 #endif
    642 
    643 #endif /* OPUS_PROJECTION_H */