FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
opusdec.c File Reference

Opus decoder. More...

#include <stdint.h>
#include "libavutil/attributes.h"
#include "libavutil/audio_fifo.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "libswresample/swresample.h"
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"
#include "mathops.h"
#include "opus.h"

Go to the source code of this file.

Functions

static int get_silk_samplerate (int config)
 
static int opus_rc_init (OpusRangeCoder *rc, const uint8_t *data, int size)
 Range decoder. More...
 
static void opus_raw_init (OpusRangeCoder *rc, const uint8_t *rightend, unsigned int bytes)
 
static void opus_fade (float *out, const float *in1, const float *in2, const float *window, int len)
 
static int opus_flush_resample (OpusStreamContext *s, int nb_samples)
 
static int opus_init_resample (OpusStreamContext *s)
 
static int opus_decode_redundancy (OpusStreamContext *s, const uint8_t *data, int size)
 
static int opus_decode_frame (OpusStreamContext *s, const uint8_t *data, int size)
 
static int opus_decode_subpacket (OpusStreamContext *s, const uint8_t *buf, int buf_size, int nb_samples)
 
static int opus_decode_packet (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
 
static av_cold void opus_decode_flush (AVCodecContext *ctx)
 
static av_cold int opus_decode_close (AVCodecContext *avctx)
 
static av_cold int opus_decode_init (AVCodecContext *avctx)
 

Variables

static const uint16_t silk_frame_duration_ms [16]
 
static const int silk_resample_delay []
 
static const uint8_t celt_band_end [] = { 13, 17, 17, 19, 21 }
 
AVCodec ff_opus_decoder
 

Detailed Description

Opus decoder.

Author
Andrew D'Addesio, Anton Khirnov

Codec homepage: http://opus-codec.org/ Specification: http://tools.ietf.org/html/rfc6716 Ogg Opus specification: https://tools.ietf.org/html/draft-ietf-codec-oggopus-03

Ogg-contained .opus files can be produced with opus-tools: http://git.xiph.org/?p=opus-tools.git

Definition in file opusdec.c.

Function Documentation

static int get_silk_samplerate ( int  config)
static

Definition at line 67 of file opusdec.c.

Referenced by opus_decode_packet().

static int opus_rc_init ( OpusRangeCoder rc,
const uint8_t data,
int  size 
)
static

Range decoder.

Definition at line 79 of file opusdec.c.

Referenced by opus_decode_frame(), and opus_decode_redundancy().

static void opus_raw_init ( OpusRangeCoder rc,
const uint8_t rightend,
unsigned int  bytes 
)
static

Definition at line 93 of file opusdec.c.

Referenced by opus_decode_frame(), and opus_decode_redundancy().

static void opus_fade ( float *  out,
const float *  in1,
const float *  in2,
const float *  window,
int  len 
)
static

Definition at line 102 of file opusdec.c.

Referenced by opus_decode_frame(), and opus_flush_resample().

static int opus_flush_resample ( OpusStreamContext s,
int  nb_samples 
)
static

Definition at line 111 of file opusdec.c.

Referenced by opus_decode_subpacket().

static int opus_init_resample ( OpusStreamContext s)
static

Definition at line 154 of file opusdec.c.

Referenced by opus_decode_frame().

static int opus_decode_redundancy ( OpusStreamContext s,
const uint8_t data,
int  size 
)
static

Definition at line 179 of file opusdec.c.

Referenced by opus_decode_frame().

static int opus_decode_frame ( OpusStreamContext s,
const uint8_t data,
int  size 
)
static

Definition at line 206 of file opusdec.c.

Referenced by opus_decode_subpacket().

static int opus_decode_subpacket ( OpusStreamContext s,
const uint8_t buf,
int  buf_size,
int  nb_samples 
)
static

Definition at line 365 of file opusdec.c.

Referenced by opus_decode_packet().

static int opus_decode_packet ( AVCodecContext avctx,
void data,
int *  got_frame_ptr,
AVPacket avpkt 
)
static

Definition at line 442 of file opusdec.c.

static av_cold void opus_decode_flush ( AVCodecContext ctx)
static

Definition at line 554 of file opusdec.c.

static av_cold int opus_decode_close ( AVCodecContext avctx)
static

Definition at line 574 of file opusdec.c.

Referenced by opus_decode_init().

static av_cold int opus_decode_init ( AVCodecContext avctx)
static

Definition at line 601 of file opusdec.c.

Variable Documentation

const uint16_t silk_frame_duration_ms[16]
static
Initial value:
= {
10, 20, 40, 60,
10, 20, 40, 60,
10, 20, 40, 60,
10, 20,
10, 20,
}

Definition at line 51 of file opusdec.c.

Referenced by opus_decode_frame().

const int silk_resample_delay[]
static
Initial value:
= {
4, 8, 11, 11, 11
}

Definition at line 61 of file opusdec.c.

Referenced by opus_init_resample().

const uint8_t celt_band_end[] = { 13, 17, 17, 19, 21 }
static

Definition at line 65 of file opusdec.c.

Referenced by opus_decode_frame(), and opus_decode_redundancy().

AVCodec ff_opus_decoder
Initial value:
= {
.name = "opus",
.long_name = NULL_IF_CONFIG_SMALL("Opus"),
.priv_data_size = sizeof(OpusContext),
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY,
}
static av_cold int opus_decode_close(AVCodecContext *avctx)
Definition: opusdec.c:574
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:789
static av_cold int opus_decode_init(AVCodecContext *avctx)
Definition: opusdec.c:601
#define CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: avcodec.h:824
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:175
static void flush(AVCodecContext *avctx)
Definition: aacdec.c:514
static int opus_decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: opusdec.c:442
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
Definition: ccaption_dec.c:522
static av_cold void opus_decode_flush(AVCodecContext *ctx)
Definition: opusdec.c:554

Definition at line 676 of file opusdec.c.