#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 |
Definition in file ac3enc_fixed.c.
#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; \
}
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; \ }
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 | ( | 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.
.32767.
Definition at line 34 of file ac3enc_fixed.c.
Referenced by fft_init(), and mdct_init().
static void apply_window | ( | DSPContext * | dsp, | |
int16_t * | output, | |||
const int16_t * | input, | |||
const int16_t * | window, | |||
int | n | |||
) | [static] |
static void fft | ( | AC3MDCTContext * | mdct, | |
IComplex * | z, | |||
int | ln | |||
) | [static] |
Calculate a 2^n point complex FFT on 2^ln points.
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.
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.
tab | input array | |
n | number of values in the array |
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.
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.
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] |
static av_cold int mdct_init | ( | AVCodecContext * | avctx, | |
AC3MDCTContext * | mdct, | |||
int | nbits | |||
) | [static] |
Initialize MDCT tables.
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.
Definition at line 304 of file ac3enc_fixed.c.
static void scale_coefficients | ( | AC3EncodeContext * | s | ) | [static] |
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.