FFmpeg
Data Structures | Macros | Functions | Variables
atrac9dec.c File Reference
#include "libavutil/channel_layout.h"
#include "libavutil/thread.h"
#include "codec_internal.h"
#include "decode.h"
#include "get_bits.h"
#include "atrac9tab.h"
#include "libavutil/tx.h"
#include "libavutil/lfg.h"
#include "libavutil/float_dsp.h"
#include "libavutil/mem_internal.h"

Go to the source code of this file.

Data Structures

struct  ATRAC9ChannelData
 
struct  ATRAC9BlockData
 
struct  ATRAC9Context
 

Macros

#define ATRAC9_SF_VLC_BITS   8
 
#define ATRAC9_COEFF_VLC_BITS   9
 

Functions

static int parse_gradient (ATRAC9Context *s, ATRAC9BlockData *b, GetBitContext *gb)
 
static void calc_precision (ATRAC9Context *s, ATRAC9BlockData *b, ATRAC9ChannelData *c)
 
static int parse_band_ext (ATRAC9Context *s, ATRAC9BlockData *b, GetBitContext *gb, int stereo)
 
static int read_scalefactors (ATRAC9Context *s, ATRAC9BlockData *b, ATRAC9ChannelData *c, GetBitContext *gb, int channel_idx, int first_in_pkt)
 
static void calc_codebook_idx (ATRAC9Context *s, ATRAC9BlockData *b, ATRAC9ChannelData *c)
 
static void read_coeffs_coarse (ATRAC9Context *s, ATRAC9BlockData *b, ATRAC9ChannelData *c, GetBitContext *gb)
 
static void read_coeffs_fine (ATRAC9Context *s, ATRAC9BlockData *b, ATRAC9ChannelData *c, GetBitContext *gb)
 
static void dequantize (ATRAC9Context *s, ATRAC9BlockData *b, ATRAC9ChannelData *c)
 
static void apply_intensity_stereo (ATRAC9Context *s, ATRAC9BlockData *b, const int stereo)
 
static void apply_scalefactors (ATRAC9Context *s, ATRAC9BlockData *b, const int stereo)
 
static void fill_with_noise (ATRAC9Context *s, ATRAC9ChannelData *c, int start, int count)
 
static void scale_band_ext_coeffs (ATRAC9ChannelData *c, float sf[6], const int s_unit, const int e_unit)
 
static void apply_band_extension (ATRAC9Context *s, ATRAC9BlockData *b, const int stereo)
 
static int atrac9_decode_block (ATRAC9Context *s, GetBitContext *gb, ATRAC9BlockData *b, AVFrame *frame, int frame_idx, int block_idx)
 
static int atrac9_decode_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
 
static void atrac9_decode_flush (AVCodecContext *avctx)
 
static av_cold int atrac9_decode_close (AVCodecContext *avctx)
 
static const av_cold VLCElematrac9_init_vlc (VLCInitState *state, int nb_bits, int nb_codes, const uint8_t(**tab)[2], int offset)
 
static av_cold void atrac9_init_static (void)
 
static av_cold int atrac9_decode_init (AVCodecContext *avctx)
 

Variables

static const VLCElemsf_vlc [2][8]
 
static const VLCElemcoeff_vlc [2][8][4]
 
const FFCodec ff_atrac9_decoder
 

Macro Definition Documentation

◆ ATRAC9_SF_VLC_BITS

#define ATRAC9_SF_VLC_BITS   8

Definition at line 34 of file atrac9dec.c.

◆ ATRAC9_COEFF_VLC_BITS

#define ATRAC9_COEFF_VLC_BITS   9

Definition at line 35 of file atrac9dec.c.

Function Documentation

◆ parse_gradient()

static int parse_gradient ( ATRAC9Context s,
ATRAC9BlockData b,
GetBitContext gb 
)
inlinestatic

Definition at line 111 of file atrac9dec.c.

Referenced by atrac9_decode_block().

◆ calc_precision()

static void calc_precision ( ATRAC9Context s,
ATRAC9BlockData b,
ATRAC9ChannelData c 
)
inlinestatic

Definition at line 155 of file atrac9dec.c.

Referenced by atrac9_decode_block().

◆ parse_band_ext()

static int parse_band_ext ( ATRAC9Context s,
ATRAC9BlockData b,
GetBitContext gb,
int  stereo 
)
inlinestatic

Definition at line 206 of file atrac9dec.c.

Referenced by atrac9_decode_block().

◆ read_scalefactors()

static int read_scalefactors ( ATRAC9Context s,
ATRAC9BlockData b,
ATRAC9ChannelData c,
GetBitContext gb,
int  channel_idx,
int  first_in_pkt 
)
inlinestatic

Definition at line 261 of file atrac9dec.c.

Referenced by atrac9_decode_block().

◆ calc_codebook_idx()

static void calc_codebook_idx ( ATRAC9Context s,
ATRAC9BlockData b,
ATRAC9ChannelData c 
)
inlinestatic

Definition at line 362 of file atrac9dec.c.

Referenced by atrac9_decode_block().

◆ read_coeffs_coarse()

static void read_coeffs_coarse ( ATRAC9Context s,
ATRAC9BlockData b,
ATRAC9ChannelData c,
GetBitContext gb 
)
inlinestatic

Definition at line 406 of file atrac9dec.c.

Referenced by atrac9_decode_block().

◆ read_coeffs_fine()

static void read_coeffs_fine ( ATRAC9Context s,
ATRAC9BlockData b,
ATRAC9ChannelData c,
GetBitContext gb 
)
inlinestatic

Definition at line 442 of file atrac9dec.c.

Referenced by atrac9_decode_block().

◆ dequantize()

static void dequantize ( ATRAC9Context s,
ATRAC9BlockData b,
ATRAC9ChannelData c 
)
inlinestatic

Definition at line 460 of file atrac9dec.c.

Referenced by atrac9_decode_block().

◆ apply_intensity_stereo()

static void apply_intensity_stereo ( ATRAC9Context s,
ATRAC9BlockData b,
const int  stereo 
)
inlinestatic

Definition at line 480 of file atrac9dec.c.

Referenced by atrac9_decode_block().

◆ apply_scalefactors()

static void apply_scalefactors ( ATRAC9Context s,
ATRAC9BlockData b,
const int  stereo 
)
inlinestatic

Definition at line 501 of file atrac9dec.c.

Referenced by atrac9_decode_block().

◆ fill_with_noise()

static void fill_with_noise ( ATRAC9Context s,
ATRAC9ChannelData c,
int  start,
int  count 
)
inlinestatic

Definition at line 517 of file atrac9dec.c.

Referenced by apply_band_extension().

◆ scale_band_ext_coeffs()

static void scale_band_ext_coeffs ( ATRAC9ChannelData c,
float  sf[6],
const int  s_unit,
const int  e_unit 
)
inlinestatic

Definition at line 533 of file atrac9dec.c.

Referenced by apply_band_extension().

◆ apply_band_extension()

static void apply_band_extension ( ATRAC9Context s,
ATRAC9BlockData b,
const int  stereo 
)
inlinestatic

Definition at line 544 of file atrac9dec.c.

Referenced by atrac9_decode_block().

◆ atrac9_decode_block()

static int atrac9_decode_block ( ATRAC9Context s,
GetBitContext gb,
ATRAC9BlockData b,
AVFrame frame,
int  frame_idx,
int  block_idx 
)
static

Definition at line 646 of file atrac9dec.c.

Referenced by atrac9_decode_frame().

◆ atrac9_decode_frame()

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

Definition at line 791 of file atrac9dec.c.

◆ atrac9_decode_flush()

static void atrac9_decode_flush ( AVCodecContext avctx)
static

Definition at line 822 of file atrac9dec.c.

◆ atrac9_decode_close()

static av_cold int atrac9_decode_close ( AVCodecContext avctx)
static

Definition at line 836 of file atrac9dec.c.

◆ atrac9_init_vlc()

static const av_cold VLCElem* atrac9_init_vlc ( VLCInitState state,
int  nb_bits,
int  nb_codes,
const uint8_t(**)  tab[2],
int  offset 
)
static

Definition at line 846 of file atrac9dec.c.

Referenced by atrac9_init_static().

◆ atrac9_init_static()

static av_cold void atrac9_init_static ( void  )
static

Definition at line 858 of file atrac9dec.c.

Referenced by atrac9_decode_init().

◆ atrac9_decode_init()

static av_cold int atrac9_decode_init ( AVCodecContext avctx)
static

Definition at line 898 of file atrac9dec.c.

Variable Documentation

◆ sf_vlc

const VLCElem* sf_vlc[2][8]
static

Definition at line 108 of file atrac9dec.c.

Referenced by atrac9_init_static(), and read_scalefactors().

◆ coeff_vlc

const VLCElem* coeff_vlc[2][8][4]
static

Definition at line 109 of file atrac9dec.c.

Referenced by atrac9_init_static(), read_coeffs_coarse(), and unpack_dct_coeffs().

◆ ff_atrac9_decoder

const FFCodec ff_atrac9_decoder
Initial value:
= {
.p.name = "atrac9",
CODEC_LONG_NAME("ATRAC9 (Adaptive TRansform Acoustic Coding 9)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.priv_data_size = sizeof(ATRAC9Context),
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.capabilities =
AV_CODEC_CAP_SUBFRAMES |
}

Definition at line 997 of file atrac9dec.c.

atrac9_decode_close
static av_cold int atrac9_decode_close(AVCodecContext *avctx)
Definition: atrac9dec.c:836
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:42
ATRAC9Context
Definition: atrac9dec.c:86
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:287
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AV_CODEC_ID_ATRAC9
@ AV_CODEC_ID_ATRAC9
Definition: codec_id.h:528
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
atrac9_decode_init
static av_cold int atrac9_decode_init(AVCodecContext *avctx)
Definition: atrac9dec.c:898
AV_CODEC_CAP_CHANNEL_CONF
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: codec.h:106
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
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
atrac9_decode_flush
static void atrac9_decode_flush(AVCodecContext *avctx)
Definition: atrac9dec.c:822
atrac9_decode_frame
static int atrac9_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Definition: atrac9dec.c:791