#include "libavutil/crc.h"
#include "avcodec.h"
#include "bitstream.h"
#include "ac3.h"
Go to the source code of this file.
Data Structures | |
| struct | AC3EncodeContext | 
| struct | IComplex | 
Defines | |
| #define | MDCT_NBITS 9 | 
| #define | N (1 << MDCT_NBITS) | 
| #define | EXP_DIFF_THRESHOLD 1000 | 
| #define | BF(pre, pim, qre, qim, pre1, pim1, qre1, qim1) | 
| #define | MUL16(a, b) ((a) * (b)) | 
| #define | CMUL(pre, pim, are, aim, bre, bim) | 
| #define | SNR_INC1 4 | 
| #define | CRC16_POLY ((1 << 0) | (1 << 2) | (1 << 15) | (1 << 16)) | 
Functions | |
| static int16_t | fix15 (float a) | 
| static av_cold void | fft_init (int ln) | 
| static void | fft (IComplex *z, int ln) | 
| static void | mdct512 (int32_t *out, int16_t *in) | 
| static int | calc_exp_diff (uint8_t *exp1, uint8_t *exp2, int n) | 
| static void | compute_exp_strategy (uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS], uint8_t exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], int ch, int is_lfe) | 
| static void | exponent_min (uint8_t exp[N/2], uint8_t exp1[N/2], int n) | 
| static int | encode_exp (uint8_t encoded_exp[N/2], uint8_t exp[N/2], int nb_exps, int exp_strategy) | 
| static int | compute_mantissa_size (AC3EncodeContext *s, uint8_t *m, int nb_coefs) | 
| static void | bit_alloc_masking (AC3EncodeContext *s, uint8_t encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS], int16_t psd[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], int16_t mask[NB_BLOCKS][AC3_MAX_CHANNELS][50]) | 
| static int | bit_alloc (AC3EncodeContext *s, int16_t mask[NB_BLOCKS][AC3_MAX_CHANNELS][50], int16_t psd[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], uint8_t bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], int frame_bits, int coarse_snr_offset, int fine_snr_offset) | 
| static int | compute_bit_allocation (AC3EncodeContext *s, uint8_t bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], uint8_t encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS], int frame_bits) | 
| static av_cold int | AC3_encode_init (AVCodecContext *avctx) | 
| static void | output_frame_header (AC3EncodeContext *s, unsigned char *frame) | 
| static int | sym_quant (int c, int e, int levels) | 
| static int | asym_quant (int c, int e, int qbits) | 
| static void | output_audio_block (AC3EncodeContext *s, uint8_t exp_strategy[AC3_MAX_CHANNELS], uint8_t encoded_exp[AC3_MAX_CHANNELS][N/2], uint8_t bap[AC3_MAX_CHANNELS][N/2], int32_t mdct_coefs[AC3_MAX_CHANNELS][N/2], int8_t global_exp[AC3_MAX_CHANNELS], int block_num) | 
| static unsigned int | mul_poly (unsigned int a, unsigned int b, unsigned int poly) | 
| static unsigned int | pow_poly (unsigned int a, unsigned int n, unsigned int poly) | 
| static int | log2_tab (int16_t *tab, int n) | 
| static void | lshift_tab (int16_t *tab, int n, int lshift) | 
| static int | output_frame_end (AC3EncodeContext *s) | 
| static int | AC3_encode_frame (AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data) | 
| static av_cold int | AC3_encode_close (AVCodecContext *avctx) | 
Variables | |
| static int16_t | costab [64] | 
| static int16_t | sintab [64] | 
| static int16_t | xcos1 [128] | 
| static int16_t | xsin1 [128] | 
| AVCodec | ac3_encoder | 
Definition in file ac3enc.c.
| #define BF | ( | pre, | |||
| pim, | |||||
| qre, | |||||
| qim, | |||||
| pre1, | |||||
| pim1, | |||||
| qre1, | |||||
| qim1 | ) | 
| #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 121 of file ac3enc.c.
Referenced by ff_imdct_half_3dn2(), ff_imdct_half_c(), ff_imdct_half_sse(), ff_mdct_calc(), fft(), and mdct512().
| #define CRC16_POLY ((1 << 0) | (1 << 2) | (1 << 15) | (1 << 16)) | 
| #define EXP_DIFF_THRESHOLD 1000 | 
| #define MDCT_NBITS 9 | 
| #define MUL16 | ( | a, | |||
| b | ) | ((a) * (b)) | 
Definition at line 119 of file ac3enc.c.
Referenced by AC3_encode_frame(), idctRowCondDC(), idctSparseCol(), idctSparseColAdd(), and idctSparseColPut().
| #define N (1 << MDCT_NBITS) | 
Definition at line 71 of file ac3enc.c.
Referenced by AC3_encode_frame(), AC3_encode_init(), bit_alloc_masking(), compute_bit_allocation(), compute_exp_strategy(), encode_exp(), mdct512(), and output_audio_block().
| #define SNR_INC1 4 | 
| static av_cold int AC3_encode_close | ( | AVCodecContext * | avctx | ) |  [static] | 
        
| static int AC3_encode_frame | ( | AVCodecContext * | avctx, | |
| unsigned char * | frame, | |||
| int | buf_size, | |||
| void * | data | |||
| ) |  [static] | 
        
| static av_cold int AC3_encode_init | ( | AVCodecContext * | avctx | ) |  [static] | 
        
| static int asym_quant | ( | int | c, | |
| int | e, | |||
| int | qbits | |||
| ) |  [inline, static] | 
        
| static int bit_alloc | ( | AC3EncodeContext * | s, | |
| int16_t | mask[NB_BLOCKS][AC3_MAX_CHANNELS][50], | |||
| int16_t | psd[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], | |||
| uint8_t | bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], | |||
| int | frame_bits, | |||
| int | coarse_snr_offset, | |||
| int | fine_snr_offset | |||
| ) |  [static] | 
        
Definition at line 447 of file ac3enc.c.
Referenced by compute_bit_allocation(), encode_frame(), mp_decode_layer2(), and MPA_encode_frame().
| static void bit_alloc_masking | ( | AC3EncodeContext * | s, | |
| uint8_t | encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], | |||
| uint8_t | exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS], | |||
| int16_t | psd[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], | |||
| int16_t | mask[NB_BLOCKS][AC3_MAX_CHANNELS][50] | |||
| ) |  [static] | 
        
| static int calc_exp_diff | ( | uint8_t * | exp1, | |
| uint8_t * | exp2, | |||
| int | n | |||
| ) |  [static] | 
        
| static int compute_bit_allocation | ( | AC3EncodeContext * | s, | |
| uint8_t | bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], | |||
| uint8_t | encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], | |||
| uint8_t | exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS], | |||
| int | frame_bits | |||
| ) |  [static] | 
        
| static void compute_exp_strategy | ( | uint8_t | exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS], | |
| uint8_t | exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], | |||
| int | ch, | |||
| int | is_lfe | |||
| ) |  [static] | 
        
| static int compute_mantissa_size | ( | AC3EncodeContext * | s, | |
| uint8_t * | m, | |||
| int | nb_coefs | |||
| ) |  [static] | 
        
| static int encode_exp | ( | uint8_t | encoded_exp[N/2], | |
| uint8_t | exp[N/2], | |||
| int | nb_exps, | |||
| int | exp_strategy | |||
| ) |  [static] | 
        
| static void exponent_min | ( | uint8_t | exp[N/2], | |
| uint8_t | exp1[N/2], | |||
| int | n | |||
| ) |  [static] | 
        
| static void fft | ( | IComplex * | z, | |
| int | ln | |||
| ) |  [static] | 
        
| static av_cold void fft_init | ( | int | ln | ) |  [static] | 
        
| static int16_t fix15 | ( | float | a | ) |  [inline, static] | 
        
| static int log2_tab | ( | int16_t * | tab, | |
| int | n | |||
| ) |  [static] | 
        
| static void lshift_tab | ( | int16_t * | tab, | |
| int | n, | |||
| int | lshift | |||
| ) |  [static] | 
        
| static void mdct512 | ( | int32_t * | out, | |
| int16_t * | in | |||
| ) |  [static] | 
        
| static unsigned int mul_poly | ( | unsigned int | a, | |
| unsigned int | b, | |||
| unsigned int | poly | |||
| ) |  [static] | 
        
| static void output_audio_block | ( | AC3EncodeContext * | s, | |
| uint8_t | exp_strategy[AC3_MAX_CHANNELS], | |||
| uint8_t | encoded_exp[AC3_MAX_CHANNELS][N/2], | |||
| uint8_t | bap[AC3_MAX_CHANNELS][N/2], | |||
| int32_t | mdct_coefs[AC3_MAX_CHANNELS][N/2], | |||
| int8_t | global_exp[AC3_MAX_CHANNELS], | |||
| int | block_num | |||
| ) |  [static] | 
        
| static int output_frame_end | ( | AC3EncodeContext * | s | ) |  [static] | 
        
| static void output_frame_header | ( | AC3EncodeContext * | s, | |
| unsigned char * | frame | |||
| ) |  [static] | 
        
| static unsigned int pow_poly | ( | unsigned int | a, | |
| unsigned int | n, | |||
| unsigned int | poly | |||
| ) |  [static] | 
        
| static int sym_quant | ( | int | c, | |
| int | e, | |||
| int | levels | |||
| ) |  [inline, static] | 
        
Initial value:
 {
    "ac3",
    CODEC_TYPE_AUDIO,
    CODEC_ID_AC3,
    sizeof(AC3EncodeContext),
    AC3_encode_init,
    AC3_encode_frame,
    AC3_encode_close,
    NULL,
    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
    .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
}
int16_t costab[64] [static]           | 
        
int16_t sintab[64] [static]           | 
        
int16_t xcos1[128] [static]           | 
        
int16_t xsin1[128] [static]           | 
        
 1.5.8