FFmpeg
Data Structures | Macros | Functions | Variables
dstdec.c File Reference
#include "libavutil/intreadwrite.h"
#include "libavutil/mem_internal.h"
#include "libavutil/reverse.h"
#include "codec_internal.h"
#include "decode.h"
#include "get_bits.h"
#include "avcodec.h"
#include "golomb.h"
#include "dsd.h"

Go to the source code of this file.

Data Structures

struct  ArithCoder
 
struct  Table
 
struct  DSTContext
 

Macros

#define DST_MAX_CHANNELS   6
 
#define DST_MAX_ELEMENTS   (2 * DST_MAX_CHANNELS)
 
#define DSD_FS44(sample_rate)   (sample_rate * 8LL / 44100)
 
#define DST_SAMPLES_PER_FRAME(sample_rate)   (588 * DSD_FS44(sample_rate))
 
#define F(x)   filter[(x)][status[(x)]]
 

Functions

static av_cold int decode_init (AVCodecContext *avctx)
 
static int read_map (GetBitContext *gb, Table *t, unsigned int map[DST_MAX_CHANNELS], int channels)
 
static av_always_inline int get_sr_golomb_dst (GetBitContext *gb, unsigned int k)
 
static void read_uncoded_coeff (GetBitContext *gb, int *dst, unsigned int elements, int coeff_bits, int is_signed, int offset)
 
static int read_table (GetBitContext *gb, Table *t, const int8_t code_pred_coeff[3][3], int length_bits, int coeff_bits, int is_signed, int offset)
 
static void ac_init (ArithCoder *ac, GetBitContext *gb)
 
static av_always_inline void ac_get (ArithCoder *ac, GetBitContext *gb, int p, int *e)
 
static uint8_t prob_dst_x_bit (int c)
 
static int build_filter (int16_t table[DST_MAX_ELEMENTS][16][256], const Table *fsets)
 
static int decode_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
 

Variables

static const int8_t fsets_code_pred_coeff [3][3]
 
static const int8_t probs_code_pred_coeff [3][3]
 
const FFCodec ff_dst_decoder
 

Detailed Description

Direct Stream Transfer (DST) decoder ISO/IEC 14496-3 Part 3 Subpart 10: Technical description of lossless coding of oversampled audio

Definition in file dstdec.c.

Macro Definition Documentation

◆ DST_MAX_CHANNELS

#define DST_MAX_CHANNELS   6

Definition at line 38 of file dstdec.c.

◆ DST_MAX_ELEMENTS

#define DST_MAX_ELEMENTS   (2 * DST_MAX_CHANNELS)

Definition at line 39 of file dstdec.c.

◆ DSD_FS44

#define DSD_FS44 (   sample_rate)    (sample_rate * 8LL / 44100)

Definition at line 41 of file dstdec.c.

◆ DST_SAMPLES_PER_FRAME

#define DST_SAMPLES_PER_FRAME (   sample_rate)    (588 * DSD_FS44(sample_rate))

Definition at line 43 of file dstdec.c.

◆ F

#define F (   x)    filter[(x)][status[(x)]]

Function Documentation

◆ decode_init()

static av_cold int decode_init ( AVCodecContext avctx)
static

Definition at line 79 of file dstdec.c.

◆ read_map()

static int read_map ( GetBitContext gb,
Table t,
unsigned int  map[DST_MAX_CHANNELS],
int  channels 
)
static

Definition at line 109 of file dstdec.c.

Referenced by decode_frame().

◆ get_sr_golomb_dst()

static av_always_inline int get_sr_golomb_dst ( GetBitContext gb,
unsigned int  k 
)
static

Definition at line 132 of file dstdec.c.

Referenced by read_table().

◆ read_uncoded_coeff()

static void read_uncoded_coeff ( GetBitContext gb,
int dst,
unsigned int  elements,
int  coeff_bits,
int  is_signed,
int  offset 
)
static

Definition at line 140 of file dstdec.c.

Referenced by read_table().

◆ read_table()

static int read_table ( GetBitContext gb,
Table t,
const int8_t  code_pred_coeff[3][3],
int  length_bits,
int  coeff_bits,
int  is_signed,
int  offset 
)
static

Definition at line 150 of file dstdec.c.

Referenced by decode_frame().

◆ ac_init()

static void ac_init ( ArithCoder ac,
GetBitContext gb 
)
static

Definition at line 186 of file dstdec.c.

Referenced by decode_frame().

◆ ac_get()

static av_always_inline void ac_get ( ArithCoder ac,
GetBitContext gb,
int  p,
int e 
)
static

Definition at line 192 of file dstdec.c.

Referenced by decode_frame().

◆ prob_dst_x_bit()

static uint8_t prob_dst_x_bit ( int  c)
static

Definition at line 213 of file dstdec.c.

Referenced by decode_frame().

◆ build_filter()

static int build_filter ( int16_t  table[DST_MAX_ELEMENTS][16][256],
const Table fsets 
)
static

Definition at line 218 of file dstdec.c.

Referenced by decode_frame().

◆ decode_frame()

static int decode_frame ( AVCodecContext avctx,
AVFrame frame,
int got_frame_ptr,
AVPacket avpkt 
)
static

Definition at line 242 of file dstdec.c.

Variable Documentation

◆ fsets_code_pred_coeff

const int8_t fsets_code_pred_coeff[3][3]
static
Initial value:
= {
{ -8 },
{ -16, 8 },
{ -9, -5, 6 },
}

Definition at line 45 of file dstdec.c.

Referenced by decode_frame().

◆ probs_code_pred_coeff

const int8_t probs_code_pred_coeff[3][3]
static
Initial value:
= {
{ -8 },
{ -16, 8 },
{ -24, 24, -8 },
}

Definition at line 51 of file dstdec.c.

Referenced by decode_frame().

◆ ff_dst_decoder

const FFCodec ff_dst_decoder
Initial value:
= {
.p.name = "dst",
CODEC_LONG_NAME("DST (Digital Stream Transfer)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_DST,
.priv_data_size = sizeof(DSTContext),
.p.capabilities = AV_CODEC_CAP_DR1,
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT,
}

Definition at line 386 of file dstdec.c.

decode_frame
static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Definition: dstdec.c:242
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:306
decode_init
static av_cold int decode_init(AVCodecContext *avctx)
Definition: dstdec.c:79
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts_bsf.c:365
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
AV_CODEC_ID_DST
@ AV_CODEC_ID_DST
Definition: codec_id.h:519
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
DSTContext
Definition: dstdec.c:68
AV_SAMPLE_FMT_FLT
@ AV_SAMPLE_FMT_FLT
float
Definition: samplefmt.h:60