FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
opus.h File Reference
#include <stdint.h>
#include "libavutil/audio_fifo.h"
#include "libavutil/float_dsp.h"
#include "libavutil/frame.h"
#include "libswresample/swresample.h"
#include "avcodec.h"
#include "opus_rc.h"

Go to the source code of this file.

Data Structures

struct  OpusPacket
 
struct  OpusStreamContext
 
struct  ChannelMap
 
struct  OpusContext
 

Macros

#define MAX_FRAME_SIZE   1275
 
#define MAX_FRAMES   48
 
#define MAX_PACKET_DUR   5760
 
#define CELT_SHORT_BLOCKSIZE   120
 
#define CELT_OVERLAP   CELT_SHORT_BLOCKSIZE
 
#define CELT_MAX_LOG_BLOCKS   3
 
#define CELT_MAX_FRAME_SIZE   (CELT_SHORT_BLOCKSIZE * (1 << CELT_MAX_LOG_BLOCKS))
 
#define CELT_MAX_BANDS   21
 
#define SILK_HISTORY   322
 
#define SILK_MAX_LPC   16
 
#define ROUND_MULL(a, b, s)   (((MUL64(a, b) >> ((s) - 1)) + 1) >> 1)
 
#define ROUND_MUL16(a, b)   ((MUL16(a, b) + 16384) >> 15)
 
#define OPUS_TS_HEADER   0x7FE0
 
#define OPUS_TS_MASK   0xFFE0
 

Enumerations

enum  OpusMode { OPUS_MODE_SILK, OPUS_MODE_HYBRID, OPUS_MODE_CELT, OPUS_MODE_NB }
 
enum  OpusBandwidth {
  OPUS_BANDWIDTH_NARROWBAND, OPUS_BANDWIDTH_MEDIUMBAND, OPUS_BANDWIDTH_WIDEBAND, OPUS_BANDWIDTH_SUPERWIDEBAND,
  OPUS_BANDWIDTH_FULLBAND, OPUS_BANDWITH_NB
}
 

Functions

int ff_opus_parse_packet (OpusPacket *pkt, const uint8_t *buf, int buf_size, int self_delimited)
 Parse Opus packet info from raw packet data. More...
 
int ff_opus_parse_extradata (AVCodecContext *avctx, OpusContext *s)
 
int ff_silk_init (AVCodecContext *avctx, SilkContext **ps, int output_channels)
 
void ff_silk_free (SilkContext **ps)
 
void ff_silk_flush (SilkContext *s)
 
int ff_silk_decode_superframe (SilkContext *s, OpusRangeCoder *rc, float *output[2], enum OpusBandwidth bandwidth, int coded_channels, int duration_ms)
 Decode the LP layer of one Opus frame (which may correspond to several SILK frames). More...
 
void ff_celt_quant_bands (CeltFrame *f, OpusRangeCoder *rc)
 

Variables

static const uint8_t opus_default_extradata [30]
 

Macro Definition Documentation

#define MAX_FRAME_SIZE   1275

Definition at line 37 of file opus.h.

#define MAX_FRAMES   48

Definition at line 38 of file opus.h.

#define MAX_PACKET_DUR   5760

Definition at line 39 of file opus.h.

Referenced by ff_opus_parse_packet().

#define CELT_SHORT_BLOCKSIZE   120

Definition at line 41 of file opus.h.

Referenced by ff_celt_decode_frame().

#define CELT_OVERLAP   CELT_SHORT_BLOCKSIZE
#define CELT_MAX_LOG_BLOCKS   3

Definition at line 43 of file opus.h.

Referenced by ff_celt_decode_frame().

#define CELT_MAX_FRAME_SIZE   (CELT_SHORT_BLOCKSIZE * (1 << CELT_MAX_LOG_BLOCKS))

Definition at line 44 of file opus.h.

#define CELT_MAX_BANDS   21
#define SILK_HISTORY   322

Definition at line 47 of file opus.h.

Referenced by ff_silk_decode_superframe(), silk_decode_frame(), and silk_unmix_ms().

#define SILK_MAX_LPC   16

Definition at line 48 of file opus.h.

#define ROUND_MULL (   a,
  b,
  s 
)    (((MUL64(a, b) >> ((s) - 1)) + 1) >> 1)

Definition at line 50 of file opus.h.

Referenced by silk_is_lpc_stable(), silk_lsf2lpc(), and silk_lsp2poly().

#define ROUND_MUL16 (   a,
  b 
)    ((MUL16(a, b) + 16384) >> 15)

Definition at line 51 of file opus.h.

Referenced by celt_cos(), celt_log2tan(), and quant_band_template().

#define OPUS_TS_HEADER   0x7FE0

Definition at line 53 of file opus.h.

Referenced by opus_find_frame_end().

#define OPUS_TS_MASK   0xFFE0

Definition at line 54 of file opus.h.

Referenced by opus_find_frame_end().

Enumeration Type Documentation

enum OpusMode
Enumerator
OPUS_MODE_SILK 
OPUS_MODE_HYBRID 
OPUS_MODE_CELT 
OPUS_MODE_NB 

Definition at line 62 of file opus.h.

Enumerator
OPUS_BANDWIDTH_NARROWBAND 
OPUS_BANDWIDTH_MEDIUMBAND 
OPUS_BANDWIDTH_WIDEBAND 
OPUS_BANDWIDTH_SUPERWIDEBAND 
OPUS_BANDWIDTH_FULLBAND 
OPUS_BANDWITH_NB 

Definition at line 70 of file opus.h.

Function Documentation

int ff_opus_parse_packet ( OpusPacket pkt,
const uint8_t buf,
int  buf_size,
int  self_delimited 
)

Parse Opus packet info from raw packet data.

Definition at line 90 of file opus.c.

Referenced by opus_decode_packet(), and opus_find_frame_end().

int ff_opus_parse_extradata ( AVCodecContext avctx,
OpusContext s 
)

Definition at line 291 of file opus.c.

Referenced by opus_decode_init(), and opus_find_frame_end().

int ff_silk_init ( AVCodecContext avctx,
SilkContext **  ps,
int  output_channels 
)

Definition at line 858 of file opus_silk.c.

Referenced by opus_decode_init().

void ff_silk_free ( SilkContext **  ps)

Definition at line 845 of file opus_silk.c.

Referenced by opus_decode_close().

void ff_silk_flush ( SilkContext s)

Definition at line 850 of file opus_silk.c.

Referenced by ff_silk_init(), opus_decode_flush(), and opus_decode_frame().

int ff_silk_decode_superframe ( SilkContext s,
OpusRangeCoder rc,
float *  output[2],
enum OpusBandwidth  bandwidth,
int  coded_channels,
int  duration_ms 
)

Decode the LP layer of one Opus frame (which may correspond to several SILK frames).

Definition at line 781 of file opus_silk.c.

Referenced by opus_decode_frame().

void ff_celt_quant_bands ( CeltFrame f,
OpusRangeCoder rc 
)

Definition at line 443 of file opus.c.

Referenced by celt_encode_frame(), and ff_celt_decode_frame().

Variable Documentation

const uint8_t opus_default_extradata[30]
static
Initial value:
= {
'O', 'p', 'u', 's', 'H', 'e', 'a', 'd',
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}

Definition at line 56 of file opus.h.

Referenced by ff_opus_parse_extradata(), and ff_parse_mpeg2_descriptor().