libavcodec/dcaenc.c File Reference

#include "libavutil/common.h"
#include "libavutil/avassert.h"
#include "libavutil/audioconvert.h"
#include "avcodec.h"
#include "get_bits.h"
#include "put_bits.h"
#include "dcaenc.h"
#include "dcadata.h"

Go to the source code of this file.

Data Structures

struct  DCAContext

Defines

#define MAX_CHANNELS   6
#define DCA_SUBBANDS_32   32
#define DCA_MAX_FRAME_SIZE   16383
#define DCA_HEADER_SIZE   13
#define DCA_SUBBANDS   32
 Subband activity count.
#define QUANTIZER_BITS   16
#define SUBFRAMES   1
#define SUBSUBFRAMES   4
#define PCM_SAMPLES   (SUBFRAMES*SUBSUBFRAMES*8)
#define LFE_BITS   8
#define LFE_INTERPOLATION   64
#define LFE_PRESENT   2
#define LFE_MISSING   0

Functions

static int32_t mul32 (int32_t a, int32_t b)
static void qmf_init (void)
static int32_t band_delta_factor (int band, int sample_num)
static void add_new_samples (DCAContext *c, const int32_t *in, int count, int channel)
static void qmf_decompose (DCAContext *c, int32_t in[32], int32_t out[32], int channel)
static int lfe_downsample (DCAContext *c, int32_t in[LFE_INTERPOLATION])
static void init_lfe_fir (void)
static void put_frame_header (DCAContext *c)
static void put_primary_audio_header (DCAContext *c)
static uint32_t quantize (int32_t sample, int bits)
 8-23 bits quantization
static int find_scale_factor7 (int64_t max_value, int bits)
static void put_sample7 (DCAContext *c, int64_t sample, int bits, int scale_factor)
static void put_subframe (DCAContext *c, int32_t subband_data[8 *SUBSUBFRAMES][MAX_CHANNELS][32], int subframe)
static void put_frame (DCAContext *c, int32_t subband_data[PCM_SAMPLES][MAX_CHANNELS][32], uint8_t *frame)
static int encode_frame (AVCodecContext *avctx, uint8_t *frame, int buf_size, void *data)
static int encode_init (AVCodecContext *avctx)

Variables

static const int8_t dca_lfe_index []
static const int8_t dca_channel_reorder_lfe [][9]
static const int8_t dca_channel_reorder_nolfe [][9]
static int32_t cos_table [128]
static int32_t lfe_fir_64i [512]
AVCodec ff_dca_encoder


Define Documentation

#define DCA_HEADER_SIZE   13

Definition at line 38 of file dcaenc.c.

Referenced by put_frame().

#define DCA_MAX_FRAME_SIZE   16383

Definition at line 37 of file dcaenc.c.

#define DCA_SUBBANDS   32

Subband activity count.

Definition at line 40 of file dcaenc.c.

#define DCA_SUBBANDS_32   32

Definition at line 36 of file dcaenc.c.

Referenced by qmf_decompose().

#define LFE_BITS   8

Definition at line 45 of file dcaenc.c.

Referenced by put_subframe().

#define LFE_INTERPOLATION   64

Definition at line 46 of file dcaenc.c.

Referenced by encode_frame().

#define LFE_MISSING   0

Definition at line 48 of file dcaenc.c.

Referenced by encode_init().

#define LFE_PRESENT   2

Definition at line 47 of file dcaenc.c.

Referenced by encode_init().

#define MAX_CHANNELS   6

Definition at line 35 of file dcaenc.c.

#define PCM_SAMPLES   (SUBFRAMES*SUBSUBFRAMES*8)

Definition at line 44 of file dcaenc.c.

Referenced by encode_frame(), encode_init(), and put_frame_header().

#define QUANTIZER_BITS   16

Definition at line 41 of file dcaenc.c.

Referenced by put_subframe().

#define SUBFRAMES   1

#define SUBSUBFRAMES   4

Definition at line 43 of file dcaenc.c.

Referenced by put_frame(), and put_subframe().


Function Documentation

static void add_new_samples ( DCAContext c,
const int32_t *  in,
int  count,
int  channel 
) [static]

Definition at line 158 of file dcaenc.c.

Referenced by lfe_downsample(), and qmf_decompose().

static int32_t band_delta_factor ( int  band,
int  sample_num 
) [static]

Definition at line 149 of file dcaenc.c.

Referenced by qmf_decompose().

static int encode_frame ( AVCodecContext avctx,
uint8_t *  frame,
int  buf_size,
void *  data 
) [static]

Definition at line 491 of file dcaenc.c.

static int encode_init ( AVCodecContext avctx  )  [static]

Definition at line 526 of file dcaenc.c.

Referenced by mpeg12_class().

static int find_scale_factor7 ( int64_t  max_value,
int  bits 
) [inline, static]

Definition at line 371 of file dcaenc.c.

Referenced by put_subframe().

static void init_lfe_fir ( void   )  [static]

Definition at line 218 of file dcaenc.c.

Referenced by encode_init().

static int lfe_downsample ( DCAContext c,
int32_t  in[LFE_INTERPOLATION] 
) [static]

Definition at line 204 of file dcaenc.c.

Referenced by encode_frame().

static int32_t mul32 ( int32_t  a,
int32_t  b 
) [inline, static]

Definition at line 116 of file dcaenc.c.

Referenced by lfe_downsample(), qmf_decompose(), and qmf_init().

static void put_frame ( DCAContext c,
int32_t  subband_data[PCM_SAMPLES][MAX_CHANNELS][32],
uint8_t *  frame 
) [static]

Definition at line 472 of file dcaenc.c.

Referenced by asf_write_packet(), and encode_frame().

static void put_frame_header ( DCAContext c  )  [static]

Definition at line 230 of file dcaenc.c.

Referenced by put_frame().

static void put_primary_audio_header ( DCAContext c  )  [static]

Definition at line 313 of file dcaenc.c.

Referenced by put_frame().

static void put_sample7 ( DCAContext c,
int64_t  sample,
int  bits,
int  scale_factor 
) [inline, static]

Definition at line 386 of file dcaenc.c.

Referenced by put_subframe().

static void put_subframe ( DCAContext c,
int32_t  subband_data[8 *SUBSUBFRAMES][MAX_CHANNELS][32],
int  subframe 
) [static]

Definition at line 393 of file dcaenc.c.

Referenced by put_frame().

static void qmf_decompose ( DCAContext c,
int32_t  in[32],
int32_t  out[32],
int  channel 
) [static]

Definition at line 174 of file dcaenc.c.

Referenced by encode_frame().

static void qmf_init ( void   )  [static]

Definition at line 125 of file dcaenc.c.

Referenced by encode_init().

static uint32_t quantize ( int32_t  sample,
int  bits 
) [inline, static]

8-23 bits quantization

Parameters:
sample 
bits 

Definition at line 364 of file dcaenc.c.

Referenced by put_sample7(), and ra144_encode_frame().


Variable Documentation

int32_t cos_table[128] [static]

Definition at line 114 of file dcaenc.c.

Referenced by band_delta_factor(), encode_init(), int_cos(), and qmf_init().

const int8_t dca_channel_reorder_lfe[][9] [static]

Initial value:

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

Definition at line 54 of file dcaenc.c.

const int8_t dca_channel_reorder_nolfe[][9] [static]

Initial value:

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

Definition at line 73 of file dcaenc.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 50 of file dcaenc.c.

Initial value:

 {
    .name           = "dca",
    .type           = AVMEDIA_TYPE_AUDIO,
    .id             = CODEC_ID_DTS,
    .priv_data_size = sizeof(DCAContext),
    .init           = encode_init,
    .encode         = encode_frame,
    .capabilities   = CODEC_CAP_EXPERIMENTAL,
    .sample_fmts    = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
    .long_name      = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
}

Definition at line 577 of file dcaenc.c.

int32_t lfe_fir_64i[512] [static]

Definition at line 203 of file dcaenc.c.

Referenced by init_lfe_fir(), and lfe_downsample().


Generated on Fri Oct 26 02:43:47 2012 for FFmpeg by  doxygen 1.5.8