libavcodec/ac3enc_fixed.c File Reference

fixed-point AC-3 encoder. More...

#include "ac3enc.c"

Go to the source code of this file.

Defines

#define FIX15(a)   av_clip(SCALE_FLOAT(a, 15), -32767, 32767)
 Scale a float value by 2^15, convert to an integer, and clip to range -32767.
#define BF(pre, pim, qre, qim, pre1, pim1, qre1, qim1)
 Butterfly op.
#define CMUL(pre, pim, are, aim, bre, bim)
 Complex multiply.

Functions

static av_cold void mdct_end (AC3MDCTContext *mdct)
 Finalize MDCT and free allocated memory.
static av_cold int fft_init (AVCodecContext *avctx, AC3MDCTContext *mdct, int ln)
 Initialize FFT tables.
static av_cold int mdct_init (AVCodecContext *avctx, AC3MDCTContext *mdct, int nbits)
 Initialize MDCT tables.
static void fft (AC3MDCTContext *mdct, IComplex *z, int ln)
 Calculate a 2^n point complex FFT on 2^ln points.
static void mdct512 (AC3MDCTContext *mdct, int32_t *out, int16_t *in)
 Calculate a 512-point MDCT.
static void apply_window (DSPContext *dsp, int16_t *output, const int16_t *input, const int16_t *window, int n)
 Apply KBD window to input samples prior to MDCT.
static int log2_tab (AC3EncodeContext *s, int16_t *src, int len)
 Calculate the log2() of the maximum absolute value in an array.
static void lshift_tab (int16_t *tab, int n, unsigned int lshift)
 Left-shift each value in an array by a specified amount.
static int normalize_samples (AC3EncodeContext *s)
 Normalize the input samples to use the maximum available precision.
static void scale_coefficients (AC3EncodeContext *s)
 Scale MDCT coefficients from float to fixed-point.

Variables

AVCodec ff_ac3_fixed_encoder


Detailed Description

fixed-point AC-3 encoder.

Definition in file ac3enc_fixed.c.


Define Documentation

#define BF ( pre,
pim,
qre,
qim,
pre1,
pim1,
qre1,
qim1   ) 

Value:

{                                                       \
  int ax, ay, bx, by;                                   \
  bx  = pre1;                                           \
  by  = pim1;                                           \
  ax  = qre1;                                           \
  ay  = qim1;                                           \
  pre = (bx + ax) >> 1;                                 \
  pim = (by + ay) >> 1;                                 \
  qre = (bx - ax) >> 1;                                 \
  qim = (by - ay) >> 1;                                 \
}
Butterfly op.

Definition at line 119 of file ac3enc_fixed.c.

Referenced by dct32(), ff_simple_idct248_put(), fft(), fft4(), and fft8().

#define CMUL ( pre,
pim,
are,
aim,
bre,
bim   ) 

Value:

{                                                       \
   pre = (MUL16(are, bre) - MUL16(aim, bim)) >> 15;     \
   pim = (MUL16(are, bim) + MUL16(bre, aim)) >> 15;     \
}
Complex multiply.

Definition at line 134 of file ac3enc_fixed.c.

Referenced by ff_imdct_half_3dn2(), ff_imdct_half_c(), ff_mdct_calc_c(), fft(), and mdct512().

#define FIX15 (  )     av_clip(SCALE_FLOAT(a, 15), -32767, 32767)

Scale a float value by 2^15, convert to an integer, and clip to range -32767.

.32767.

Definition at line 34 of file ac3enc_fixed.c.

Referenced by fft_init(), and mdct_init().


Function Documentation

static void apply_window ( DSPContext dsp,
int16_t *  output,
const int16_t *  input,
const int16_t *  window,
int  n 
) [static]

Apply KBD window to input samples prior to MDCT.

Definition at line 254 of file ac3enc_fixed.c.

static void fft ( AC3MDCTContext mdct,
IComplex z,
int  ln 
) [static]

Calculate a 2^n point complex FFT on 2^ln points.

Parameters:
z complex input/output samples
ln log2(FFT size)

Definition at line 146 of file ac3enc_fixed.c.

Referenced by mdct512().

static av_cold int fft_init ( AVCodecContext avctx,
AC3MDCTContext mdct,
int  ln 
) [static]

Initialize FFT tables.

Parameters:
ln log2(FFT size)

Definition at line 56 of file ac3enc_fixed.c.

Referenced by mdct_init().

static int log2_tab ( AC3EncodeContext s,
int16_t *  src,
int  len 
) [static]

Calculate the log2() of the maximum absolute value in an array.

Parameters:
tab input array
n number of values in the array
Returns:
log2(max(abs(tab[])))

Definition at line 273 of file ac3enc_fixed.c.

Referenced by normalize_samples().

static void lshift_tab ( int16_t *  tab,
int  n,
unsigned int  lshift 
) [static]

Left-shift each value in an array by a specified amount.

Parameters:
tab input array
n number of values in the array
lshift left shift amount

Definition at line 286 of file ac3enc_fixed.c.

Referenced by normalize_samples().

static void mdct512 ( AC3MDCTContext mdct,
int32_t *  out,
int16_t *  in 
) [static]

Calculate a 512-point MDCT.

Parameters:
out 256 output frequency coefficients
in 512 windowed input audio samples

Definition at line 218 of file ac3enc_fixed.c.

static av_cold void mdct_end ( AC3MDCTContext mdct  )  [static]

Finalize MDCT and free allocated memory.

Definition at line 40 of file ac3enc_fixed.c.

static av_cold int mdct_init ( AVCodecContext avctx,
AC3MDCTContext mdct,
int  nbits 
) [static]

Initialize MDCT tables.

Parameters:
nbits log2(MDCT size)

Definition at line 84 of file ac3enc_fixed.c.

static int normalize_samples ( AC3EncodeContext s  )  [static]

Normalize the input samples to use the maximum available precision.

This assumes signed 16-bit input samples. Exponents are reduced by 9 to match the 24-bit internal precision for MDCT coefficients.

Returns:
exponent shift

Definition at line 304 of file ac3enc_fixed.c.

static void scale_coefficients ( AC3EncodeContext s  )  [static]

Scale MDCT coefficients from float to fixed-point.

Definition at line 315 of file ac3enc_fixed.c.


Variable Documentation

Initial value:

 {
    "ac3_fixed",
    AVMEDIA_TYPE_AUDIO,
    CODEC_ID_AC3,
    sizeof(AC3EncodeContext),
    ac3_encode_init,
    ac3_encode_frame,
    ac3_encode_close,
    NULL,
    .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
    .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
    .channel_layouts = ac3_channel_layouts,
}

Definition at line 418 of file ac3enc_fixed.c.


Generated on Mon May 2 19:50:14 2011 for FFmpeg by  doxygen 1.5.6