libavcodec/dca.c File Reference

#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include "libavutil/intmath.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "dsputil.h"
#include "fft.h"
#include "get_bits.h"
#include "put_bits.h"
#include "dcadata.h"
#include "dcahuff.h"
#include "dca.h"
#include "synth_filter.h"
#include "dcadsp.h"

Go to the source code of this file.

Data Structures

struct  BitAlloc
 Bit allocation. More...
struct  DCAContext

Defines

#define DCA_PRIM_CHANNELS_MAX   (5)
#define DCA_SUBBANDS   (32)
#define DCA_ABITS_MAX   (32)
#define DCA_SUBSUBFAMES_MAX   (4)
#define DCA_LFE_MAX   (3)
#define DCA_DOLBY   101
#define DCA_CHANNEL_BITS   6
#define DCA_CHANNEL_MASK   0x3F
#define DCA_LFE   0x80
#define HEADER_SIZE   14
#define DCA_MAX_FRAME_SIZE   16384
#define MIX_REAR1(samples, si1, rs, coef)
#define MIX_REAR2(samples, si1, si2, rs, coef)
#define MIX_FRONT3(samples, coef)
#define DOWNMIX_TO_STEREO(op1, op2)

Enumerations

enum  DCAMode {
  DCA_MONO = 0, DCA_CHANNEL, DCA_STEREO, DCA_STEREO_SUMDIFF,
  DCA_STEREO_TOTAL, DCA_3F, DCA_2F1R, DCA_3F1R,
  DCA_2F2R, DCA_3F2R, DCA_4F2R
}

Functions

static av_always_inline int get_bitalloc (GetBitContext *gb, BitAlloc *ba, int idx)
static av_cold void dca_init_vlcs (void)
static void get_array (GetBitContext *gb, int *dst, int len, int bits)
static int dca_parse_frame_header (DCAContext *s)
static int get_scale (GetBitContext *gb, int level, int value)
static int dca_subframe_header (DCAContext *s)
static void qmf_32_subbands (DCAContext *s, int chans, float samples_in[32][8], float *samples_out, float scale, float bias)
static void lfe_interpolation_fir (DCAContext *s, int decimation_select, int num_deci_sample, float *samples_in, float *samples_out, float scale, float bias)
static void dca_downmix (float *samples, int srcfmt, int downmix_coef[DCA_PRIM_CHANNELS_MAX][2])
static int decode_blockcode (int code, int levels, int *values)
static int dca_subsubframe (DCAContext *s)
static int dca_subframe_footer (DCAContext *s)
static int dca_decode_block (DCAContext *s)
 Decode a dca frame block.
static int dca_convert_bitstream (const uint8_t *src, int src_size, uint8_t *dst, int max_size)
 Convert bitstream to one representation based on sync marker.
static int dca_decode_frame (AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
 Main frame decoding function FIXME add arguments.
static av_cold int dca_decode_init (AVCodecContext *avctx)
 DCA initialization.
static av_cold int dca_decode_end (AVCodecContext *avctx)

Variables

static const int64_t dca_core_channel_layout []
static const int8_t dca_lfe_index []
static const int8_t dca_channel_reorder_lfe [][8]
static const int8_t dca_channel_reorder_nolfe [][8]
static BitAlloc dca_bitalloc_index
 indexes for samples VLC select
static BitAlloc dca_tmode
 transition mode VLCs
static BitAlloc dca_scalefactor
 scalefactor VLCs
static BitAlloc dca_smpl_bitalloc [11]
 samples VLCs
static const uint16_t dca_vlc_offs []
static const uint8_t abits_sizes [7] = { 7, 10, 12, 13, 15, 17, 19 }
static const uint8_t abits_levels [7] = { 3, 5, 7, 9, 13, 17, 25 }
AVCodec dca_decoder


Define Documentation

#define DCA_ABITS_MAX   (32)

Definition at line 46 of file dca.c.

#define DCA_CHANNEL_BITS   6

Definition at line 138 of file dca.c.

#define DCA_CHANNEL_MASK   0x3F

Definition at line 139 of file dca.c.

Referenced by dca_subframe_header(), and dca_subsubframe().

#define DCA_DOLBY   101

Definition at line 136 of file dca.c.

#define DCA_LFE   0x80

Definition at line 141 of file dca.c.

Referenced by dca_parse_frame_header(), and dca_subsubframe().

#define DCA_LFE_MAX   (3)

Definition at line 48 of file dca.c.

#define DCA_MAX_FRAME_SIZE   16384

Definition at line 145 of file dca.c.

Referenced by dca_decode_frame().

#define DCA_PRIM_CHANNELS_MAX   (5)

Definition at line 44 of file dca.c.

Referenced by dca_parse_frame_header(), and dca_subsubframe().

#define DCA_SUBBANDS   (32)

Definition at line 45 of file dca.c.

Referenced by dca_parse_frame_header(), and dca_subsubframe().

#define DCA_SUBSUBFAMES_MAX   (4)

Definition at line 47 of file dca.c.

#define DOWNMIX_TO_STEREO ( op1,
op2   ) 

Value:

for(i = 0; i < 256; i++){ \
        op1 \
        op2 \
    }

Definition at line 837 of file dca.c.

Referenced by dca_downmix().

#define HEADER_SIZE   14

#define MIX_FRONT3 ( samples,
coef   ) 

Value:

t = samples[i]; \
    samples[i]     = t * coef[0][0] + samples[i+256] * coef[1][0] + samples[i+512] * coef[2][0]; \
    samples[i+256] = t * coef[0][1] + samples[i+256] * coef[1][1] + samples[i+512] * coef[2][1];

Definition at line 832 of file dca.c.

Referenced by dca_downmix().

#define MIX_REAR1 ( samples,
si1,
rs,
coef   ) 

Value:

samples[i]     += samples[si1] * coef[rs][0]; \
     samples[i+256] += samples[si1] * coef[rs][1];

Definition at line 824 of file dca.c.

Referenced by dca_downmix().

#define MIX_REAR2 ( samples,
si1,
si2,
rs,
coef   ) 

Value:

samples[i]     += samples[si1] * coef[rs][0] + samples[si2] * coef[rs+1][0]; \
     samples[i+256] += samples[si1] * coef[rs][1] + samples[si2] * coef[rs+1][1];

Definition at line 828 of file dca.c.

Referenced by dca_downmix().


Enumeration Type Documentation

enum DCAMode

Enumerator:
DCA_MONO 
DCA_CHANNEL 
DCA_STEREO 
DCA_STEREO_SUMDIFF 
DCA_STEREO_TOTAL 
DCA_3F 
DCA_2F1R 
DCA_3F1R 
DCA_2F2R 
DCA_3F2R 
DCA_4F2R 

Definition at line 50 of file dca.c.


Function Documentation

static int dca_convert_bitstream ( const uint8_t *  src,
int  src_size,
uint8_t *  dst,
int  max_size 
) [static]

Convert bitstream to one representation based on sync marker.

Definition at line 1157 of file dca.c.

Referenced by dca_decode_frame().

static int dca_decode_block ( DCAContext s  )  [static]

Decode a dca frame block.

Parameters:
s pointer to the DCAContext

Definition at line 1110 of file dca.c.

Referenced by dca_decode_frame().

static av_cold int dca_decode_end ( AVCodecContext avctx  )  [static]

Definition at line 1318 of file dca.c.

static int dca_decode_frame ( AVCodecContext avctx,
void *  data,
int *  data_size,
AVPacket avpkt 
) [static]

Main frame decoding function FIXME add arguments.

Definition at line 1199 of file dca.c.

static av_cold int dca_decode_init ( AVCodecContext avctx  )  [static]

DCA initialization.

Parameters:
avctx pointer to the AVCodecContext

Definition at line 1283 of file dca.c.

static void dca_downmix ( float *  samples,
int  srcfmt,
int  downmix_coef[DCA_PRIM_CHANNELS_MAX][2] 
) [static]

Definition at line 843 of file dca.c.

Referenced by dca_subsubframe().

static av_cold void dca_init_vlcs ( void   )  [static]

Definition at line 268 of file dca.c.

Referenced by dca_decode_init().

static int dca_parse_frame_header ( DCAContext s  )  [static]

Definition at line 327 of file dca.c.

Referenced by dca_decode_frame().

static int dca_subframe_footer ( DCAContext s  )  [static]

Definition at line 1075 of file dca.c.

Referenced by dca_decode_block().

static int dca_subframe_header ( DCAContext s  )  [static]

Definition at line 504 of file dca.c.

Referenced by dca_decode_block().

static int dca_subsubframe ( DCAContext s  )  [static]

Definition at line 910 of file dca.c.

Referenced by dca_decode_block().

static int decode_blockcode ( int  code,
int  levels,
int *  values 
) [static]

Definition at line 888 of file dca.c.

Referenced by dca_subsubframe().

static void get_array ( GetBitContext gb,
int *  dst,
int  len,
int  bits 
) [inline, static]

Definition at line 321 of file dca.c.

Referenced by dca_parse_frame_header().

static av_always_inline int get_bitalloc ( GetBitContext gb,
BitAlloc ba,
int  idx 
) [static]

Definition at line 160 of file dca.c.

Referenced by dca_subframe_header(), dca_subsubframe(), and get_scale().

static int get_scale ( GetBitContext gb,
int  level,
int  value 
) [inline, static]

Definition at line 494 of file dca.c.

Referenced by dca_subframe_header().

static void lfe_interpolation_fir ( DCAContext s,
int  decimation_select,
int  num_deci_sample,
float *  samples_in,
float *  samples_out,
float  scale,
float  bias 
) [static]

Definition at line 789 of file dca.c.

Referenced by dca_subsubframe().

static void qmf_32_subbands ( DCAContext s,
int  chans,
float  samples_in[32][8],
float *  samples_out,
float  scale,
float  bias 
) [static]

Definition at line 752 of file dca.c.

Referenced by dca_subsubframe().


Variable Documentation

const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 } [static]

Definition at line 908 of file dca.c.

Referenced by dca_subsubframe().

const uint8_t abits_sizes[7] = { 7, 10, 12, 13, 15, 17, 19 } [static]

Definition at line 907 of file dca.c.

Referenced by dca_subsubframe().

indexes for samples VLC select

Definition at line 155 of file dca.c.

const int8_t dca_channel_reorder_lfe[][8] [static]

Initial value:

 {
    { 0, -1, -1, -1, -1, -1, -1, -1},
    { 0,  1, -1, -1, -1, -1, -1, -1},
    { 0,  1, -1, -1, -1, -1, -1, -1},
    { 0,  1, -1, -1, -1, -1, -1, -1},
    { 0,  1, -1, -1, -1, -1, -1, -1},
    { 2,  0,  1, -1, -1, -1, -1, -1},
    { 0,  1,  3, -1, -1, -1, -1, -1},
    { 2,  0,  1,  4, -1, -1, -1, -1},
    { 0,  1,  3,  4, -1, -1, -1, -1},
    { 2,  0,  1,  4,  5, -1, -1, -1},
    { 3,  4,  0,  1,  5,  6, -1, -1},
    { 2,  0,  1,  4,  5,  6, -1, -1},
    { 0,  6,  4,  5,  2,  3, -1, -1},
    { 4,  2,  5,  0,  1,  6,  7, -1},
    { 5,  6,  0,  1,  7,  3,  8,  4},
    { 4,  2,  5,  0,  1,  6,  8,  7},
}

Definition at line 97 of file dca.c.

Referenced by dca_decode_frame().

const int8_t dca_channel_reorder_nolfe[][8] [static]

Initial value:

 {
    { 0, -1, -1, -1, -1, -1, -1, -1},
    { 0,  1, -1, -1, -1, -1, -1, -1},
    { 0,  1, -1, -1, -1, -1, -1, -1},
    { 0,  1, -1, -1, -1, -1, -1, -1},
    { 0,  1, -1, -1, -1, -1, -1, -1},
    { 2,  0,  1, -1, -1, -1, -1, -1},
    { 0,  1,  2, -1, -1, -1, -1, -1},
    { 2,  0,  1,  3, -1, -1, -1, -1},
    { 0,  1,  2,  3, -1, -1, -1, -1},
    { 2,  0,  1,  3,  4, -1, -1, -1},
    { 2,  3,  0,  1,  4,  5, -1, -1},
    { 2,  0,  1,  3,  4,  5, -1, -1},
    { 0,  5,  3,  4,  1,  2, -1, -1},
    { 3,  2,  4,  0,  1,  5,  6, -1},
    { 4,  5,  0,  1,  6,  2,  7,  3},
    { 3,  2,  4,  0,  1,  5,  7,  6},
}

Definition at line 116 of file dca.c.

Referenced by dca_decode_frame().

const int64_t dca_core_channel_layout[] [static]

Initial value:

 {
    .name = "dca",
    .type = AVMEDIA_TYPE_AUDIO,
    .id = CODEC_ID_DTS,
    .priv_data_size = sizeof(DCAContext),
    .init = dca_decode_init,
    .decode = dca_decode_frame,
    .close = dca_decode_end,
    .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
}

Definition at line 1325 of file dca.c.

const int8_t dca_lfe_index[] [static]

Initial value:

 {
    1,2,2,2,2,3,2,3,2,3,2,3,1,3,2,3
}

Definition at line 93 of file dca.c.

Referenced by dca_subsubframe().

scalefactor VLCs

Definition at line 157 of file dca.c.

samples VLCs

Definition at line 158 of file dca.c.

BitAlloc dca_tmode [static]

transition mode VLCs

Definition at line 156 of file dca.c.

const uint16_t dca_vlc_offs[] [static]

Initial value:

 {
        0,   512,   640,   768,  1282,  1794,  2436,  3080,  3770,  4454,  5364,
     5372,  5380,  5388,  5392,  5396,  5412,  5420,  5428,  5460,  5492,  5508,
     5572,  5604,  5668,  5796,  5860,  5892,  6412,  6668,  6796,  7308,  7564,
     7820,  8076,  8620,  9132,  9388,  9910, 10166, 10680, 11196, 11726, 12240,
    12752, 13298, 13810, 14326, 14840, 15500, 16022, 16540, 17158, 17678, 18264,
    18796, 19352, 19926, 20468, 21472, 22398, 23014, 23622,
}

Definition at line 259 of file dca.c.

Referenced by dca_init_vlcs().


Generated on Fri Oct 26 02:36:51 2012 for FFmpeg by  doxygen 1.5.8