media/libopus/silk/API.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libopus/silk/API.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,133 @@
     1.4 +/***********************************************************************
     1.5 +Copyright (c) 2006-2011, Skype Limited. All rights reserved.
     1.6 +Redistribution and use in source and binary forms, with or without
     1.7 +modification, are permitted provided that the following conditions
     1.8 +are met:
     1.9 +- Redistributions of source code must retain the above copyright notice,
    1.10 +this list of conditions and the following disclaimer.
    1.11 +- Redistributions in binary form must reproduce the above copyright
    1.12 +notice, this list of conditions and the following disclaimer in the
    1.13 +documentation and/or other materials provided with the distribution.
    1.14 +- Neither the name of Internet Society, IETF or IETF Trust, nor the
    1.15 +names of specific contributors, may be used to endorse or promote
    1.16 +products derived from this software without specific prior written
    1.17 +permission.
    1.18 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    1.19 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.20 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.21 +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
    1.22 +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    1.23 +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    1.24 +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    1.25 +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    1.26 +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    1.27 +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    1.28 +POSSIBILITY OF SUCH DAMAGE.
    1.29 +***********************************************************************/
    1.30 +
    1.31 +#ifndef SILK_API_H
    1.32 +#define SILK_API_H
    1.33 +
    1.34 +#include "control.h"
    1.35 +#include "typedef.h"
    1.36 +#include "errors.h"
    1.37 +#include "entenc.h"
    1.38 +#include "entdec.h"
    1.39 +
    1.40 +#ifdef __cplusplus
    1.41 +extern "C"
    1.42 +{
    1.43 +#endif
    1.44 +
    1.45 +#define SILK_MAX_FRAMES_PER_PACKET  3
    1.46 +
    1.47 +/* Struct for TOC (Table of Contents) */
    1.48 +typedef struct {
    1.49 +    opus_int    VADFlag;                                /* Voice activity for packet                            */
    1.50 +    opus_int    VADFlags[ SILK_MAX_FRAMES_PER_PACKET ]; /* Voice activity for each frame in packet              */
    1.51 +    opus_int    inbandFECFlag;                          /* Flag indicating if packet contains in-band FEC       */
    1.52 +} silk_TOC_struct;
    1.53 +
    1.54 +/****************************************/
    1.55 +/* Encoder functions                    */
    1.56 +/****************************************/
    1.57 +
    1.58 +/***********************************************/
    1.59 +/* Get size in bytes of the Silk encoder state */
    1.60 +/***********************************************/
    1.61 +opus_int silk_Get_Encoder_Size(                         /* O    Returns error code                              */
    1.62 +    opus_int                        *encSizeBytes       /* O    Number of bytes in SILK encoder state           */
    1.63 +);
    1.64 +
    1.65 +/*************************/
    1.66 +/* Init or reset encoder */
    1.67 +/*************************/
    1.68 +opus_int silk_InitEncoder(                              /* O    Returns error code                              */
    1.69 +    void                            *encState,          /* I/O  State                                           */
    1.70 +    int                              arch,              /* I    Run-time architecture                           */
    1.71 +    silk_EncControlStruct           *encStatus          /* O    Encoder Status                                  */
    1.72 +);
    1.73 +
    1.74 +/**************************/
    1.75 +/* Encode frame with Silk */
    1.76 +/**************************/
    1.77 +/* Note: if prefillFlag is set, the input must contain 10 ms of audio, irrespective of what                     */
    1.78 +/* encControl->payloadSize_ms is set to                                                                         */
    1.79 +opus_int silk_Encode(                                   /* O    Returns error code                              */
    1.80 +    void                            *encState,          /* I/O  State                                           */
    1.81 +    silk_EncControlStruct           *encControl,        /* I    Control status                                  */
    1.82 +    const opus_int16                *samplesIn,         /* I    Speech sample input vector                      */
    1.83 +    opus_int                        nSamplesIn,         /* I    Number of samples in input vector               */
    1.84 +    ec_enc                          *psRangeEnc,        /* I/O  Compressor data structure                       */
    1.85 +    opus_int32                      *nBytesOut,         /* I/O  Number of bytes in payload (input: Max bytes)   */
    1.86 +    const opus_int                  prefillFlag         /* I    Flag to indicate prefilling buffers no coding   */
    1.87 +);
    1.88 +
    1.89 +/****************************************/
    1.90 +/* Decoder functions                    */
    1.91 +/****************************************/
    1.92 +
    1.93 +/***********************************************/
    1.94 +/* Get size in bytes of the Silk decoder state */
    1.95 +/***********************************************/
    1.96 +opus_int silk_Get_Decoder_Size(                         /* O    Returns error code                              */
    1.97 +    opus_int                        *decSizeBytes       /* O    Number of bytes in SILK decoder state           */
    1.98 +);
    1.99 +
   1.100 +/*************************/
   1.101 +/* Init or Reset decoder */
   1.102 +/*************************/
   1.103 +opus_int silk_InitDecoder(                              /* O    Returns error code                              */
   1.104 +    void                            *decState           /* I/O  State                                           */
   1.105 +);
   1.106 +
   1.107 +/******************/
   1.108 +/* Decode a frame */
   1.109 +/******************/
   1.110 +opus_int silk_Decode(                                   /* O    Returns error code                              */
   1.111 +    void*                           decState,           /* I/O  State                                           */
   1.112 +    silk_DecControlStruct*          decControl,         /* I/O  Control Structure                               */
   1.113 +    opus_int                        lostFlag,           /* I    0: no loss, 1 loss, 2 decode fec                */
   1.114 +    opus_int                        newPacketFlag,      /* I    Indicates first decoder call for this packet    */
   1.115 +    ec_dec                          *psRangeDec,        /* I/O  Compressor data structure                       */
   1.116 +    opus_int16                      *samplesOut,        /* O    Decoded output speech vector                    */
   1.117 +    opus_int32                      *nSamplesOut        /* O    Number of samples decoded                       */
   1.118 +);
   1.119 +
   1.120 +#if 0
   1.121 +/**************************************/
   1.122 +/* Get table of contents for a packet */
   1.123 +/**************************************/
   1.124 +opus_int silk_get_TOC(
   1.125 +    const opus_uint8                *payload,           /* I    Payload data                                */
   1.126 +    const opus_int                  nBytesIn,           /* I    Number of input bytes                       */
   1.127 +    const opus_int                  nFramesPerPayload,  /* I    Number of SILK frames per payload           */
   1.128 +    silk_TOC_struct                 *Silk_TOC           /* O    Type of content                             */
   1.129 +);
   1.130 +#endif
   1.131 +
   1.132 +#ifdef __cplusplus
   1.133 +}
   1.134 +#endif
   1.135 +
   1.136 +#endif

mercurial