FFmpeg
Data Structures | Macros | Functions | Variables
atrac9dec.c File Reference
#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]
 
AVCodec ff_atrac9_decoder
 

Macro Definition Documentation

◆ ATRAC9_SF_VLC_BITS

#define ATRAC9_SF_VLC_BITS   8

Definition at line 32 of file atrac9dec.c.

◆ ATRAC9_COEFF_VLC_BITS

#define ATRAC9_COEFF_VLC_BITS   9

Definition at line 33 of file atrac9dec.c.

Function Documentation

◆ parse_gradient()

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

Definition at line 108 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 152 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 203 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 258 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 359 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 403 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 439 of file atrac9dec.c.

Referenced by atrac9_decode_block().

◆ dequantize()

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

Definition at line 457 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 477 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 498 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 514 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 530 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 541 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 643 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 788 of file atrac9dec.c.

◆ atrac9_decode_flush()

static void atrac9_decode_flush ( AVCodecContext avctx)
static

Definition at line 818 of file atrac9dec.c.

◆ atrac9_decode_close()

static av_cold int atrac9_decode_close ( AVCodecContext avctx)
static

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

Referenced by atrac9_init_static().

◆ atrac9_init_static()

static av_cold void atrac9_init_static ( void  )
static

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

Variable Documentation

◆ sf_vlc

VLC sf_vlc[2][8]
static

Definition at line 105 of file atrac9dec.c.

Referenced by atrac9_init_static(), and read_scalefactors().

◆ coeff_vlc

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

Definition at line 106 of file atrac9dec.c.

Referenced by atrac9_init_static(), and read_coeffs_coarse().

◆ ff_atrac9_decoder

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 989 of file atrac9dec.c.

atrac9_decode_close
static av_cold int atrac9_decode_close(AVCodecContext *avctx)
Definition: atrac9dec.c:832
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:41
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
ATRAC9Context
Definition: atrac9dec.c:84
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:513
flush
static void flush(AVCodecContext *avctx)
Definition: aacdec_template.c:592
atrac9_decode_init
static av_cold int atrac9_decode_init(AVCodecContext *avctx)
Definition: atrac9dec.c:896
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:104
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:788
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:49
atrac9_decode_flush
static void atrac9_decode_flush(AVCodecContext *avctx)
Definition: atrac9dec.c:818
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:95