FFmpeg
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 "libavutil/mem_internal.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)
 
void ff_celt_bitalloc (CeltFrame *f, OpusRangeCoder *rc, int encode)
 

Variables

static const uint8_t opus_default_extradata [30]
 

Macro Definition Documentation

◆ MAX_FRAME_SIZE

#define MAX_FRAME_SIZE   1275

Definition at line 38 of file opus.h.

◆ MAX_FRAMES

#define MAX_FRAMES   48

Definition at line 39 of file opus.h.

◆ MAX_PACKET_DUR

#define MAX_PACKET_DUR   5760

Definition at line 40 of file opus.h.

◆ CELT_SHORT_BLOCKSIZE

#define CELT_SHORT_BLOCKSIZE   120

Definition at line 42 of file opus.h.

◆ CELT_OVERLAP

#define CELT_OVERLAP   CELT_SHORT_BLOCKSIZE

Definition at line 43 of file opus.h.

◆ CELT_MAX_LOG_BLOCKS

#define CELT_MAX_LOG_BLOCKS   3

Definition at line 44 of file opus.h.

◆ CELT_MAX_FRAME_SIZE

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

Definition at line 45 of file opus.h.

◆ CELT_MAX_BANDS

#define CELT_MAX_BANDS   21

Definition at line 46 of file opus.h.

◆ SILK_HISTORY

#define SILK_HISTORY   322

Definition at line 48 of file opus.h.

◆ SILK_MAX_LPC

#define SILK_MAX_LPC   16

Definition at line 49 of file opus.h.

◆ ROUND_MULL

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

Definition at line 51 of file opus.h.

◆ ROUND_MUL16

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

Definition at line 52 of file opus.h.

◆ OPUS_TS_HEADER

#define OPUS_TS_HEADER   0x7FE0

Definition at line 54 of file opus.h.

◆ OPUS_TS_MASK

#define OPUS_TS_MASK   0xFFE0

Definition at line 55 of file opus.h.

Enumeration Type Documentation

◆ OpusMode

enum OpusMode
Enumerator
OPUS_MODE_SILK 
OPUS_MODE_HYBRID 
OPUS_MODE_CELT 
OPUS_MODE_NB 

Definition at line 63 of file opus.h.

◆ OpusBandwidth

Enumerator
OPUS_BANDWIDTH_NARROWBAND 
OPUS_BANDWIDTH_MEDIUMBAND 
OPUS_BANDWIDTH_WIDEBAND 
OPUS_BANDWIDTH_SUPERWIDEBAND 
OPUS_BANDWIDTH_FULLBAND 
OPUS_BANDWITH_NB 

Definition at line 71 of file opus.h.

Function Documentation

◆ ff_opus_parse_packet()

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 92 of file opus.c.

Referenced by opus_decode_packet(), and opus_find_frame_end().

◆ ff_opus_parse_extradata()

int ff_opus_parse_extradata ( AVCodecContext avctx,
OpusContext s 
)

Definition at line 293 of file opus.c.

Referenced by opus_decode_init(), and opus_find_frame_end().

◆ ff_silk_init()

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

Definition at line 875 of file opus_silk.c.

Referenced by opus_decode_init().

◆ ff_silk_free()

void ff_silk_free ( SilkContext **  ps)

Definition at line 862 of file opus_silk.c.

Referenced by opus_decode_close().

◆ ff_silk_flush()

void ff_silk_flush ( SilkContext s)

Definition at line 867 of file opus_silk.c.

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

◆ ff_silk_decode_superframe()

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 786 of file opus_silk.c.

Referenced by opus_decode_frame().

◆ ff_celt_quant_bands()

void ff_celt_quant_bands ( CeltFrame f,
OpusRangeCoder rc 
)

Definition at line 469 of file opus.c.

Referenced by celt_encode_frame(), and ff_celt_decode_frame().

◆ ff_celt_bitalloc()

void ff_celt_bitalloc ( CeltFrame f,
OpusRangeCoder rc,
int  encode 
)

Definition at line 578 of file opus.c.

Referenced by bands_dist(), celt_encode_frame(), and ff_celt_decode_frame().

Variable Documentation

◆ opus_default_extradata

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 57 of file opus.h.

Referenced by ff_opus_parse_extradata(), and ff_parse_mpeg2_descriptor().