FFmpeg
Data Structures | Macros | Functions | Variables
atrac9dec.c File Reference
#include "libavutil/channel_layout.h"
#include "libavutil/thread.h"
#include "internal.h"
#include "get_bits.h"
#include "fft.h"
#include "atrac9tab.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, void *data, int *got_frame_ptr, AVPacket *avpkt)
 
static void atrac9_decode_flush (AVCodecContext *avctx)
 
static av_cold int atrac9_decode_close (AVCodecContext *avctx)
 
static av_cold void atrac9_init_vlc (VLC *vlc, int nb_bits, int nb_codes, const uint8_t(**tab)[2], unsigned *buf_offset, int offset)
 
static av_cold void atrac9_init_static (void)
 
static av_cold int atrac9_decode_init (AVCodecContext *avctx)
 

Variables

static VLC sf_vlc [2][8]
 
static VLC coeff_vlc [2][8][4]
 
const AVCodec ff_atrac9_decoder
 

Macro Definition Documentation

◆ ATRAC9_SF_VLC_BITS

#define ATRAC9_SF_VLC_BITS   8

Definition at line 33 of file atrac9dec.c.

◆ ATRAC9_COEFF_VLC_BITS

#define ATRAC9_COEFF_VLC_BITS   9

Definition at line 34 of file atrac9dec.c.

Function Documentation

◆ parse_gradient()

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

Definition at line 109 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 153 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 204 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 259 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 360 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 404 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 440 of file atrac9dec.c.

Referenced by atrac9_decode_block().

◆ dequantize()

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

Definition at line 458 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 478 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 499 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 515 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 531 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 542 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 644 of file atrac9dec.c.

Referenced by atrac9_decode_frame().

◆ atrac9_decode_frame()

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

Definition at line 789 of file atrac9dec.c.

◆ atrac9_decode_flush()

static void atrac9_decode_flush ( AVCodecContext avctx)
static

Definition at line 819 of file atrac9dec.c.

◆ atrac9_decode_close()

static av_cold int atrac9_decode_close ( AVCodecContext avctx)
static

Definition at line 833 of file atrac9dec.c.

◆ atrac9_init_vlc()

static av_cold void atrac9_init_vlc ( VLC vlc,
int  nb_bits,
int  nb_codes,
const uint8_t(**)  tab[2],
unsigned *  buf_offset,
int  offset 
)
static

Definition at line 843 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 897 of file atrac9dec.c.

Variable Documentation

◆ sf_vlc

VLC sf_vlc[2][8]
static

Definition at line 106 of file atrac9dec.c.

Referenced by atrac9_init_static(), and read_scalefactors().

◆ coeff_vlc

VLC coeff_vlc[2][8][4]
static

Definition at line 107 of file atrac9dec.c.

Referenced by atrac9_init_static(), and read_coeffs_coarse().

◆ ff_atrac9_decoder

const AVCodec ff_atrac9_decoder
Initial value:
= {
.name = "atrac9",
.long_name = NULL_IF_CONFIG_SMALL("ATRAC9 (Adaptive TRansform Acoustic Coding 9)"),
.priv_data_size = sizeof(ATRAC9Context),
}

Definition at line 990 of file atrac9dec.c.

atrac9_decode_close
static av_cold int atrac9_decode_close(AVCodecContext *avctx)
Definition: atrac9dec.c:833
FF_CODEC_CAP_INIT_THREADSAFE
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:42
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
ATRAC9Context
Definition: atrac9dec.c:85
decode
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AV_CODEC_ID_ATRAC9
@ AV_CODEC_ID_ATRAC9
Definition: codec_id.h:510
flush
static void flush(AVCodecContext *avctx)
Definition: aacdec_template.c:593
atrac9_decode_init
static av_cold int atrac9_decode_init(AVCodecContext *avctx)
Definition: atrac9dec.c:897
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:109
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
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
atrac9_decode_frame
static int atrac9_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: atrac9dec.c:789
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: internal.h:50
atrac9_decode_flush
static void atrac9_decode_flush(AVCodecContext *avctx)
Definition: atrac9dec.c:819
AV_CODEC_CAP_SUBFRAMES
#define AV_CODEC_CAP_SUBFRAMES
Codec can output multiple frames per AVPacket Normally demuxers return one frame at a time,...
Definition: codec.h:100