FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
dca_core.c File Reference
#include "dcadec.h"
#include "dcadata.h"
#include "dcahuff.h"
#include "dcamath.h"
#include "dca_syncwords.h"

Go to the source code of this file.

Data Structures

struct  DCAVLC
 

Macros

#define DCA_INIT_VLC(vlc, a, b, c, d)
 

Enumerations

enum  HeaderType { HEADER_CORE, HEADER_XCH, HEADER_XXCH }
 
enum  AudioMode {
  AMODE_MONO, AMODE_MONO_DUAL, AMODE_STEREO, AMODE_STEREO_SUMDIFF,
  AMODE_STEREO_TOTAL, AMODE_3F, AMODE_2F1R, AMODE_3F1R,
  AMODE_2F2R, AMODE_3F2R, AMODE_COUNT
}
 
enum  ExtAudioType { EXT_AUDIO_XCH = 0, EXT_AUDIO_X96 = 2, EXT_AUDIO_XXCH = 6 }
 
enum  LFEFlag { LFE_FLAG_NONE, LFE_FLAG_128, LFE_FLAG_64, LFE_FLAG_INVALID }
 

Functions

static av_cold void dca_init_vlcs (void)
 
static int dca_get_vlc (GetBitContext *s, DCAVLC *v, int i)
 
static void get_array (GetBitContext *s, int32_t *array, int size, int n)
 
static int parse_frame_header (DCACoreDecoder *s)
 
static int parse_coding_header (DCACoreDecoder *s, enum HeaderType header, int xch_base)
 
static int parse_scale (DCACoreDecoder *s, int *scale_index, int sel)
 
static int parse_joint_scale (DCACoreDecoder *s, int sel)
 
static int parse_subframe_header (DCACoreDecoder *s, int sf, enum HeaderType header, int xch_base)
 
static int decode_blockcodes (int code1, int code2, int levels, int32_t *audio)
 
static int parse_block_codes (DCACoreDecoder *s, int32_t *audio, int abits)
 
static int parse_huffman_codes (DCACoreDecoder *s, int32_t *audio, int abits, int sel)
 
static int extract_audio (DCACoreDecoder *s, int32_t *audio, int abits, int ch)
 
static void dequantize (int32_t *output, const int32_t *input, int32_t step_size, int32_t scale, int residual)
 
static void inverse_adpcm (int32_t **subband_samples, const int16_t *vq_index, const int8_t *prediction_mode, int sb_start, int sb_end, int ofs, int len)
 
static int parse_subframe_audio (DCACoreDecoder *s, int sf, enum HeaderType header, int xch_base, int *sub_pos, int *lfe_pos)
 
static void erase_adpcm_history (DCACoreDecoder *s)
 
static int alloc_sample_buffer (DCACoreDecoder *s)
 
static int parse_frame_data (DCACoreDecoder *s, enum HeaderType header, int xch_base)
 
static int parse_xch_frame (DCACoreDecoder *s)
 
static int parse_xxch_frame (DCACoreDecoder *s)
 
static int parse_xbr_subframe (DCACoreDecoder *s, int xbr_base_ch, int xbr_nchannels, int *xbr_nsubbands, int xbr_transition_mode, int sf, int *sub_pos)
 
static int parse_xbr_frame (DCACoreDecoder *s)
 
static int rand_x96 (DCACoreDecoder *s)
 
static int parse_x96_subframe_audio (DCACoreDecoder *s, int sf, int xch_base, int *sub_pos)
 
static void erase_x96_adpcm_history (DCACoreDecoder *s)
 
static int alloc_x96_sample_buffer (DCACoreDecoder *s)
 
static int parse_x96_subframe_header (DCACoreDecoder *s, int xch_base)
 
static int parse_x96_coding_header (DCACoreDecoder *s, int exss, int xch_base)
 
static int parse_x96_frame_data (DCACoreDecoder *s, int exss, int xch_base)
 
static int parse_x96_frame (DCACoreDecoder *s)
 
static int parse_x96_frame_exss (DCACoreDecoder *s)
 
static int parse_aux_data (DCACoreDecoder *s)
 
static int parse_optional_info (DCACoreDecoder *s)
 
int ff_dca_core_parse (DCACoreDecoder *s, uint8_t *data, int size)
 
int ff_dca_core_parse_exss (DCACoreDecoder *s, uint8_t *data, DCAExssAsset *asset)
 
static int map_prm_ch_to_spkr (DCACoreDecoder *s, int ch)
 
static void erase_dsp_history (DCACoreDecoder *s)
 
static void set_filter_mode (DCACoreDecoder *s, int mode)
 
int ff_dca_core_filter_fixed (DCACoreDecoder *s, int x96_synth)
 
static int filter_frame_fixed (DCACoreDecoder *s, AVFrame *frame)
 
static int filter_frame_float (DCACoreDecoder *s, AVFrame *frame)
 
int ff_dca_core_filter_frame (DCACoreDecoder *s, AVFrame *frame)
 
av_cold void ff_dca_core_flush (DCACoreDecoder *s)
 
av_cold int ff_dca_core_init (DCACoreDecoder *s)
 
av_cold void ff_dca_core_close (DCACoreDecoder *s)
 

Variables

static const int8_t prm_ch_to_spkr_map [AMODE_COUNT][5]
 
static const uint8_t audio_mode_ch_mask [AMODE_COUNT]
 
static const uint8_t block_code_nbits [7]
 
static const uint8_t quant_index_sel_nbits [DCA_CODE_BOOKS]
 
static const uint8_t quant_index_group_size [DCA_CODE_BOOKS]
 
static DCAVLC vlc_bit_allocation
 
static DCAVLC vlc_transition_mode
 
static DCAVLC vlc_scale_factor
 
static DCAVLC vlc_quant_index [DCA_CODE_BOOKS]
 

Macro Definition Documentation

#define DCA_INIT_VLC (   vlc,
  a,
  b,
  c,
 
)
Value:
do { \
vlc.table = &dca_table[ff_dca_vlc_offs[k]]; \
vlc.table_allocated = ff_dca_vlc_offs[k + 1] - ff_dca_vlc_offs[k]; \
init_vlc(&vlc, a, b, c, 1, 1, d, 2, 2, INIT_VLC_USE_NEW_STATIC); \
} while (0)
const char * b
Definition: vf_curves.c:109
const uint16_t ff_dca_vlc_offs[63]
Definition: dcadata.c:8775
#define INIT_VLC_USE_NEW_STATIC
Definition: get_bits.h:482
#define init_vlc(vlc, nb_bits, nb_codes,bits, bits_wrap, bits_size,codes, codes_wrap, codes_size,flags)
Definition: get_bits.h:465
static double c[64]

Referenced by dca_init_vlcs().

Enumeration Type Documentation

enum HeaderType
Enumerator
HEADER_CORE 
HEADER_XCH 
HEADER_XXCH 

Definition at line 31 of file dca_core.c.

enum AudioMode
Enumerator
AMODE_MONO 
AMODE_MONO_DUAL 
AMODE_STEREO 
AMODE_STEREO_SUMDIFF 
AMODE_STEREO_TOTAL 
AMODE_3F 
AMODE_2F1R 
AMODE_3F1R 
AMODE_2F2R 
AMODE_3F2R 
AMODE_COUNT 

Definition at line 37 of file dca_core.c.

Enumerator
EXT_AUDIO_XCH 
EXT_AUDIO_X96 
EXT_AUDIO_XXCH 

Definition at line 52 of file dca_core.c.

enum LFEFlag
Enumerator
LFE_FLAG_NONE 
LFE_FLAG_128 
LFE_FLAG_64 
LFE_FLAG_INVALID 

Definition at line 58 of file dca_core.c.

Function Documentation

static av_cold void dca_init_vlcs ( void  )
static

Definition at line 114 of file dca_core.c.

Referenced by ff_dca_core_init().

static int dca_get_vlc ( GetBitContext s,
DCAVLC v,
int  i 
)
static
static void get_array ( GetBitContext s,
int32_t array,
int  size,
int  n 
)
static

Definition at line 164 of file dca_core.c.

Referenced by extract_audio(), parse_subframe_audio(), and parse_xbr_subframe().

static int parse_frame_header ( DCACoreDecoder s)
static

Definition at line 173 of file dca_core.c.

Referenced by ff_dca_core_parse().

static int parse_coding_header ( DCACoreDecoder s,
enum HeaderType  header,
int  xch_base 
)
static

Definition at line 288 of file dca_core.c.

Referenced by parse_frame_data().

static int parse_scale ( DCACoreDecoder s,
int *  scale_index,
int  sel 
)
inlinestatic

Definition at line 485 of file dca_core.c.

Referenced by parse_subframe_header(), and parse_x96_subframe_header().

static int parse_joint_scale ( DCACoreDecoder s,
int  sel 
)
inlinestatic

Definition at line 514 of file dca_core.c.

Referenced by parse_subframe_header(), and parse_x96_subframe_header().

static int parse_subframe_header ( DCACoreDecoder s,
int  sf,
enum HeaderType  header,
int  xch_base 
)
static

Definition at line 537 of file dca_core.c.

Referenced by parse_frame_data().

static int decode_blockcodes ( int  code1,
int  code2,
int  levels,
int32_t audio 
)
inlinestatic

Definition at line 664 of file dca_core.c.

Referenced by parse_block_codes().

static int parse_block_codes ( DCACoreDecoder s,
int32_t audio,
int  abits 
)
inlinestatic

Definition at line 684 of file dca_core.c.

Referenced by extract_audio(), and parse_xbr_subframe().

static int parse_huffman_codes ( DCACoreDecoder s,
int32_t audio,
int  abits,
int  sel 
)
inlinestatic

Definition at line 700 of file dca_core.c.

Referenced by extract_audio().

static int extract_audio ( DCACoreDecoder s,
int32_t audio,
int  abits,
int  ch 
)
inlinestatic

Definition at line 711 of file dca_core.c.

Referenced by parse_subframe_audio(), and parse_x96_subframe_audio().

static void dequantize ( int32_t output,
const int32_t input,
int32_t  step_size,
int32_t  scale,
int  residual 
)
inlinestatic

Definition at line 738 of file dca_core.c.

Referenced by parse_subframe_audio(), parse_x96_subframe_audio(), and parse_xbr_subframe().

static void inverse_adpcm ( int32_t **  subband_samples,
const int16_t *  vq_index,
const int8_t *  prediction_mode,
int  sb_start,
int  sb_end,
int  ofs,
int  len 
)
inlinestatic

Definition at line 761 of file dca_core.c.

Referenced by parse_subframe_audio(), and parse_x96_subframe_audio().

static int parse_subframe_audio ( DCACoreDecoder s,
int  sf,
enum HeaderType  header,
int  xch_base,
int *  sub_pos,
int *  lfe_pos 
)
static

Definition at line 784 of file dca_core.c.

Referenced by parse_frame_data().

static void erase_adpcm_history ( DCACoreDecoder s)
static

Definition at line 921 of file dca_core.c.

Referenced by alloc_sample_buffer(), and ff_dca_core_flush().

static int alloc_sample_buffer ( DCACoreDecoder s)
static

Definition at line 934 of file dca_core.c.

Referenced by ff_dca_core_parse().

static int parse_frame_data ( DCACoreDecoder s,
enum HeaderType  header,
int  xch_base 
)
static

Definition at line 962 of file dca_core.c.

Referenced by ff_dca_core_parse(), parse_xch_frame(), and parse_xxch_frame().

static int parse_xch_frame ( DCACoreDecoder s)
static

Definition at line 1000 of file dca_core.c.

Referenced by ff_dca_core_parse_exss().

static int parse_xxch_frame ( DCACoreDecoder s)
static

Definition at line 1021 of file dca_core.c.

Referenced by ff_dca_core_parse_exss().

static int parse_xbr_subframe ( DCACoreDecoder s,
int  xbr_base_ch,
int  xbr_nchannels,
int *  xbr_nsubbands,
int  xbr_transition_mode,
int  sf,
int *  sub_pos 
)
static

Definition at line 1099 of file dca_core.c.

Referenced by parse_xbr_frame().

static int parse_xbr_frame ( DCACoreDecoder s)
static

Definition at line 1234 of file dca_core.c.

Referenced by ff_dca_core_parse_exss().

static int rand_x96 ( DCACoreDecoder s)
static

Definition at line 1318 of file dca_core.c.

Referenced by parse_x96_subframe_audio().

static int parse_x96_subframe_audio ( DCACoreDecoder s,
int  sf,
int  xch_base,
int *  sub_pos 
)
static

Definition at line 1324 of file dca_core.c.

Referenced by parse_x96_frame_data().

static void erase_x96_adpcm_history ( DCACoreDecoder s)
static

Definition at line 1432 of file dca_core.c.

Referenced by alloc_x96_sample_buffer(), and ff_dca_core_flush().

static int alloc_x96_sample_buffer ( DCACoreDecoder s)
static

Definition at line 1445 of file dca_core.c.

Referenced by parse_x96_frame(), and parse_x96_frame_exss().

static int parse_x96_subframe_header ( DCACoreDecoder s,
int  xch_base 
)
static

Definition at line 1471 of file dca_core.c.

Referenced by parse_x96_frame_data().

static int parse_x96_coding_header ( DCACoreDecoder s,
int  exss,
int  xch_base 
)
static

Definition at line 1555 of file dca_core.c.

Referenced by parse_x96_frame_data().

static int parse_x96_frame_data ( DCACoreDecoder s,
int  exss,
int  xch_base 
)
static

Definition at line 1643 of file dca_core.c.

Referenced by parse_x96_frame(), and parse_x96_frame_exss().

static int parse_x96_frame ( DCACoreDecoder s)
static

Definition at line 1678 of file dca_core.c.

Referenced by ff_dca_core_parse_exss().

static int parse_x96_frame_exss ( DCACoreDecoder s)
static

Definition at line 1707 of file dca_core.c.

Referenced by ff_dca_core_parse_exss().

static int parse_aux_data ( DCACoreDecoder s)
static

Definition at line 1783 of file dca_core.c.

Referenced by parse_optional_info().

static int parse_optional_info ( DCACoreDecoder s)
static

Definition at line 1852 of file dca_core.c.

Referenced by ff_dca_core_parse().

int ff_dca_core_parse ( DCACoreDecoder s,
uint8_t data,
int  size 
)

Definition at line 1960 of file dca_core.c.

Referenced by dcadec_decode_frame().

int ff_dca_core_parse_exss ( DCACoreDecoder s,
uint8_t data,
DCAExssAsset asset 
)

Definition at line 1995 of file dca_core.c.

Referenced by dcadec_decode_frame().

static int map_prm_ch_to_spkr ( DCACoreDecoder s,
int  ch 
)
static

Definition at line 2071 of file dca_core.c.

Referenced by ff_dca_core_filter_fixed(), filter_frame_fixed(), and filter_frame_float().

static void erase_dsp_history ( DCACoreDecoder s)
static

Definition at line 2107 of file dca_core.c.

Referenced by ff_dca_core_flush(), and set_filter_mode().

static void set_filter_mode ( DCACoreDecoder s,
int  mode 
)
static

Definition at line 2114 of file dca_core.c.

Referenced by ff_dca_core_filter_fixed(), and filter_frame_float().

int ff_dca_core_filter_fixed ( DCACoreDecoder s,
int  x96_synth 
)

Definition at line 2122 of file dca_core.c.

Referenced by dcadec_decode_frame(), and filter_frame_fixed().

static int filter_frame_fixed ( DCACoreDecoder s,
AVFrame frame 
)
static

Definition at line 2226 of file dca_core.c.

Referenced by ff_dca_core_filter_frame().

static int filter_frame_float ( DCACoreDecoder s,
AVFrame frame 
)
static

Definition at line 2323 of file dca_core.c.

Referenced by ff_dca_core_filter_frame().

int ff_dca_core_filter_frame ( DCACoreDecoder s,
AVFrame frame 
)

Definition at line 2508 of file dca_core.c.

Referenced by dcadec_decode_frame().

av_cold void ff_dca_core_flush ( DCACoreDecoder s)

Definition at line 2562 of file dca_core.c.

Referenced by dcadec_flush().

av_cold int ff_dca_core_init ( DCACoreDecoder s)

Definition at line 2575 of file dca_core.c.

Referenced by dcadec_init().

av_cold void ff_dca_core_close ( DCACoreDecoder s)

Definition at line 2595 of file dca_core.c.

Referenced by dcadec_close().

Variable Documentation

const int8_t prm_ch_to_spkr_map[AMODE_COUNT][5]
static
const uint8_t audio_mode_ch_mask[AMODE_COUNT]
static
Initial value:
= {
}
#define DCA_SPEAKER_LAYOUT_3_0
Definition: dca.h:81
#define DCA_SPEAKER_LAYOUT_3_1
Definition: dca.h:83
#define DCA_SPEAKER_LAYOUT_STEREO
Definition: dca.h:79
#define DCA_SPEAKER_LAYOUT_2_1
Definition: dca.h:82
#define DCA_SPEAKER_LAYOUT_2_2
Definition: dca.h:84
#define DCA_SPEAKER_LAYOUT_5POINT0
Definition: dca.h:85
#define DCA_SPEAKER_LAYOUT_MONO
Definition: dca.h:78

Definition at line 78 of file dca_core.c.

Referenced by ff_dca_core_parse_exss(), and parse_coding_header().

const uint8_t block_code_nbits[7]
static
Initial value:
= {
7, 10, 12, 13, 15, 17, 19
}

Definition at line 91 of file dca_core.c.

Referenced by parse_block_codes().

const uint8_t quant_index_sel_nbits[DCA_CODE_BOOKS]
static
Initial value:
= {
1, 2, 2, 2, 2, 3, 3, 3, 3, 3
}

Definition at line 95 of file dca_core.c.

Referenced by parse_coding_header(), and parse_x96_coding_header().

const uint8_t quant_index_group_size[DCA_CODE_BOOKS]
static
Initial value:
= {
1, 3, 3, 3, 3, 7, 7, 7, 7, 7
}

Definition at line 99 of file dca_core.c.

Referenced by dca_init_vlcs(), extract_audio(), and parse_coding_header().

DCAVLC vlc_bit_allocation
static

Definition at line 109 of file dca_core.c.

DCAVLC vlc_transition_mode
static

Definition at line 110 of file dca_core.c.

DCAVLC vlc_scale_factor
static

Definition at line 111 of file dca_core.c.

DCAVLC vlc_quant_index[DCA_CODE_BOOKS]
static

Definition at line 112 of file dca_core.c.