FFmpeg
Data Structures | Macros | Functions | Variables
ac3enc.c File Reference
#include <stdint.h>
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
#include "libavutil/internal.h"
#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/thread.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "config_components.h"
#include "encode.h"
#include "internal.h"
#include "me_cmp.h"
#include "put_bits.h"
#include "audiodsp.h"
#include "ac3dsp.h"
#include "ac3.h"
#include "ac3defs.h"
#include "ac3tab.h"
#include "fft.h"
#include "ac3enc.h"
#include "eac3enc.h"

Go to the source code of this file.

Data Structures

struct  AC3Mant
 

Macros

#define CMIXLEV_NUM_OPTIONS   3
 
#define SURMIXLEV_NUM_OPTIONS   3
 
#define EXTMIXLEV_NUM_OPTIONS   8
 
#define OFFSET(param)   offsetof(AC3EncodeContext, options.param)
 
#define AC3ENC_PARAM   (AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
 
#define EXP_DIFF_THRESHOLD   500
 Exponent Difference Threshold. More...
 
#define CRC16_POLY   ((1 << 0) | (1 << 2) | (1 << 15) | (1 << 16))
 CRC-16 Polynomial. More...
 
#define FLT_OPTION_THRESHOLD   0.01
 

Functions

void ff_ac3_adjust_frame_size (AC3EncodeContext *s)
 Adjust the frame size to make the average bit rate match the target bit rate. More...
 
void ff_ac3_compute_coupling_strategy (AC3EncodeContext *s)
 Set the initial coupling strategy parameters prior to coupling analysis. More...
 
static void ac3_apply_rematrixing (AC3EncodeContext *s)
 Apply stereo rematrixing to coefficients based on rematrixing flags. More...
 
static av_cold void exponent_init (void)
 
static void extract_exponents (AC3EncodeContext *s)
 
static void compute_exp_strategy (AC3EncodeContext *s)
 
static void encode_exponents_blk_ch (uint8_t *exp, int nb_exps, int exp_strategy, int cpl)
 Update the exponents so that they are the ones the decoder will decode. More...
 
static void encode_exponents (AC3EncodeContext *s)
 
static int count_exponent_bits (AC3EncodeContext *s)
 
static void ac3_group_exponents (AC3EncodeContext *s)
 Group exponents. More...
 
static void ac3_process_exponents (AC3EncodeContext *s)
 Calculate final exponents from the supplied MDCT coefficients and exponent shift. More...
 
static void count_frame_bits_fixed (AC3EncodeContext *s)
 
static av_cold void bit_alloc_init (AC3EncodeContext *s)
 
static void count_frame_bits (AC3EncodeContext *s)
 
static void bit_alloc_masking (AC3EncodeContext *s)
 
static void reset_block_bap (AC3EncodeContext *s)
 
static void count_mantissa_bits_init (uint16_t mant_cnt[AC3_MAX_BLOCKS][16])
 Initialize mantissa counts. More...
 
static void count_mantissa_bits_update_ch (AC3EncodeContext *s, int ch, uint16_t mant_cnt[AC3_MAX_BLOCKS][16], int start, int end)
 Update mantissa bit counts for all blocks in 1 channel in a given bandwidth range. More...
 
static int count_mantissa_bits (AC3EncodeContext *s)
 
static int bit_alloc (AC3EncodeContext *s, int snr_offset)
 Run the bit allocation with a given SNR offset. More...
 
static int cbr_bit_allocation (AC3EncodeContext *s)
 
static int ac3_compute_bit_allocation (AC3EncodeContext *s)
 
static int sym_quant (int c, int e, int levels)
 Symmetric quantization on 'levels' levels. More...
 
static int asym_quant (int c, int e, int qbits)
 Asymmetric quantization on 2^qbits levels. More...
 
static void quantize_mantissas_blk_ch (AC3Mant *s, int32_t *fixed_coef, uint8_t *exp, uint8_t *bap, int16_t *qmant, int start_freq, int end_freq)
 Quantize a set of mantissas for a single channel in a single block. More...
 
static void ac3_quantize_mantissas (AC3EncodeContext *s)
 Quantize mantissas using coefficients, exponents, and bit allocation pointers. More...
 
static void ac3_output_frame_header (AC3EncodeContext *s)
 
static void output_audio_block (AC3EncodeContext *s, int blk)
 
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 void output_frame_end (AC3EncodeContext *s)
 
static void ac3_output_frame (AC3EncodeContext *s, unsigned char *frame)
 Write the frame to the output bitstream. More...
 
int ff_ac3_encode_frame_common_end (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
 
static void dprint_options (AC3EncodeContext *s)
 
static int validate_float_option (float v, const float *v_list, int v_list_size)
 
static void validate_mix_level (void *log_ctx, const char *opt_name, float *opt_param, const float *list, int list_size, int default_value, int min_value, int *ctx_param)
 
int ff_ac3_validate_metadata (AC3EncodeContext *s)
 Validate metadata options as set by AVOption system. More...
 
av_cold int ff_ac3_encode_close (AVCodecContext *avctx)
 Finalize encoding and free any memory allocated by the encoder. More...
 
static av_cold int set_channel_info (AVCodecContext *avctx)
 
static av_cold int validate_options (AC3EncodeContext *s)
 
static av_cold void set_bandwidth (AC3EncodeContext *s)
 
static av_cold int allocate_buffers (AC3EncodeContext *s)
 
av_cold int ff_ac3_encode_init (AVCodecContext *avctx)
 

Variables

static const float cmixlev_options [CMIXLEV_NUM_OPTIONS]
 
static const float surmixlev_options [SURMIXLEV_NUM_OPTIONS]
 
static const float extmixlev_options [EXTMIXLEV_NUM_OPTIONS]
 
const AVOption ff_ac3_enc_options []
 
const AVClass ff_ac3enc_class
 
const FFCodecDefault ff_ac3_enc_defaults []
 
static uint8_t exponent_group_tab [2][3][256]
 LUT for number of exponent groups. More...
 
const AVChannelLayout ff_ac3_ch_layouts [19]
 List of supported channel layouts. More...
 
static const uint8_t ac3_enc_channel_map [8][2][6]
 Table to remap channels from SMPTE order to AC-3 order. More...
 
static const uint8_t ac3_bandwidth_tab [5][3][19]
 LUT to select the bandwidth code based on the bit rate, sample rate, and number of full-bandwidth channels. More...
 
static const int8_t ac3_coupling_start_tab [6][3][19]
 LUT to select the coupling start band based on the bit rate, sample rate, and number of full-bandwidth channels. More...
 
static const uint8_t exp_strategy_reuse_tab [4][6]
 Table used to select exponent strategy based on exponent reuse block interval. More...
 

Detailed Description

The simplest AC-3 encoder.

Definition in file ac3enc.c.

Macro Definition Documentation

◆ CMIXLEV_NUM_OPTIONS

#define CMIXLEV_NUM_OPTIONS   3

Definition at line 61 of file ac3enc.c.

◆ SURMIXLEV_NUM_OPTIONS

#define SURMIXLEV_NUM_OPTIONS   3

Definition at line 66 of file ac3enc.c.

◆ EXTMIXLEV_NUM_OPTIONS

#define EXTMIXLEV_NUM_OPTIONS   8

Definition at line 71 of file ac3enc.c.

◆ OFFSET

#define OFFSET (   param)    offsetof(AC3EncodeContext, options.param)

Definition at line 80 of file ac3enc.c.

◆ AC3ENC_PARAM

#define AC3ENC_PARAM   (AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)

Definition at line 81 of file ac3enc.c.

◆ EXP_DIFF_THRESHOLD

#define EXP_DIFF_THRESHOLD   500

Exponent Difference Threshold.

New exponents are sent if their SAD exceed this number.

Definition at line 463 of file ac3enc.c.

◆ CRC16_POLY

#define CRC16_POLY   ((1 << 0) | (1 << 2) | (1 << 15) | (1 << 16))

CRC-16 Polynomial.

Definition at line 1697 of file ac3enc.c.

◆ FLT_OPTION_THRESHOLD

#define FLT_OPTION_THRESHOLD   0.01

Definition at line 1944 of file ac3enc.c.

Function Documentation

◆ ff_ac3_adjust_frame_size()

void ff_ac3_adjust_frame_size ( AC3EncodeContext s)

Adjust the frame size to make the average bit rate match the target bit rate.

This is only needed for 11025, 22050, and 44100 sample rates or any E-AC-3.

Parameters
sAC-3 encoder private context

Definition at line 307 of file ac3enc.c.

Referenced by encode_frame().

◆ ff_ac3_compute_coupling_strategy()

void ff_ac3_compute_coupling_strategy ( AC3EncodeContext s)

Set the initial coupling strategy parameters prior to coupling analysis.

Parameters
sAC-3 encoder private context

Definition at line 325 of file ac3enc.c.

Referenced by encode_frame().

◆ ac3_apply_rematrixing()

static void ac3_apply_rematrixing ( AC3EncodeContext s)
static

Apply stereo rematrixing to coefficients based on rematrixing flags.

Parameters
sAC-3 encoder private context

Definition at line 396 of file ac3enc.c.

Referenced by ff_ac3_encode_frame_common_end().

◆ exponent_init()

static av_cold void exponent_init ( void  )
static

Definition at line 430 of file ac3enc.c.

Referenced by ff_ac3_encode_init().

◆ extract_exponents()

static void extract_exponents ( AC3EncodeContext s)
static

Definition at line 449 of file ac3enc.c.

Referenced by ac3_process_exponents().

◆ compute_exp_strategy()

static void compute_exp_strategy ( AC3EncodeContext s)
static

Definition at line 479 of file ac3enc.c.

Referenced by ac3_process_exponents().

◆ encode_exponents_blk_ch()

static void encode_exponents_blk_ch ( uint8_t *  exp,
int  nb_exps,
int  exp_strategy,
int  cpl 
)
static

Update the exponents so that they are the ones the decoder will decode.

Parameters
[in,out]exparray of exponents for 1 block in 1 channel
nb_expsnumber of exponents in active bandwidth
exp_strategyexponent strategy for the block
cplindicates if the block is in the coupling channel

Definition at line 545 of file ac3enc.c.

Referenced by encode_exponents().

◆ encode_exponents()

static void encode_exponents ( AC3EncodeContext s)
static

Definition at line 618 of file ac3enc.c.

Referenced by ac3_process_exponents().

◆ count_exponent_bits()

static int count_exponent_bits ( AC3EncodeContext s)
static

Definition at line 668 of file ac3enc.c.

Referenced by ac3_compute_bit_allocation().

◆ ac3_group_exponents()

static void ac3_group_exponents ( AC3EncodeContext s)
static

Group exponents.

3 delta-encoded exponents are in each 7-bit group. The number of groups varies depending on exponent strategy and bandwidth.

Parameters
sAC-3 encoder private context

Definition at line 700 of file ac3enc.c.

Referenced by ff_ac3_encode_frame_common_end().

◆ ac3_process_exponents()

static void ac3_process_exponents ( AC3EncodeContext s)
static

Calculate final exponents from the supplied MDCT coefficients and exponent shift.

Extract exponents from MDCT coefficients, calculate exponent strategies, and encode final exponents.

Parameters
sAC-3 encoder private context

Definition at line 758 of file ac3enc.c.

Referenced by ff_ac3_encode_frame_common_end().

◆ count_frame_bits_fixed()

static void count_frame_bits_fixed ( AC3EncodeContext s)
static

Definition at line 774 of file ac3enc.c.

Referenced by bit_alloc_init().

◆ bit_alloc_init()

static av_cold void bit_alloc_init ( AC3EncodeContext s)
static

Definition at line 883 of file ac3enc.c.

Referenced by ff_ac3_encode_init().

◆ count_frame_bits()

static void count_frame_bits ( AC3EncodeContext s)
static

Definition at line 919 of file ac3enc.c.

Referenced by ac3_compute_bit_allocation().

◆ bit_alloc_masking()

static void bit_alloc_masking ( AC3EncodeContext s)
static

Definition at line 1062 of file ac3enc.c.

Referenced by ac3_compute_bit_allocation().

◆ reset_block_bap()

static void reset_block_bap ( AC3EncodeContext s)
static

Definition at line 1092 of file ac3enc.c.

Referenced by bit_alloc(), and cbr_bit_allocation().

◆ count_mantissa_bits_init()

static void count_mantissa_bits_init ( uint16_t  mant_cnt[AC3_MAX_BLOCKS][16])
static

Initialize mantissa counts.

These are set so that they are padded to the next whole group size when bits are counted in compute_mantissa_size.

Parameters
[in,out]mant_cntrunning counts for each bap value for each block

Definition at line 1117 of file ac3enc.c.

Referenced by count_mantissa_bits().

◆ count_mantissa_bits_update_ch()

static void count_mantissa_bits_update_ch ( AC3EncodeContext s,
int  ch,
uint16_t  mant_cnt[AC3_MAX_BLOCKS][16],
int  start,
int  end 
)
static

Update mantissa bit counts for all blocks in 1 channel in a given bandwidth range.

Parameters
sAC-3 encoder private context
chchannel index
[in,out]mant_cntrunning counts for each bap value for each block
startstarting coefficient bin
endending coefficient bin

Definition at line 1139 of file ac3enc.c.

Referenced by count_mantissa_bits().

◆ count_mantissa_bits()

static int count_mantissa_bits ( AC3EncodeContext s)
static

Definition at line 1159 of file ac3enc.c.

Referenced by bit_alloc().

◆ bit_alloc()

static int bit_alloc ( AC3EncodeContext s,
int  snr_offset 
)
static

Run the bit allocation with a given SNR offset.

This calculates the bit allocation pointers that will be used to determine the quantization of each mantissa.

Parameters
sAC-3 encoder private context
snr_offsetSNR offset, 0 to 1023
Returns
the number of bits needed for mantissas if the given SNR offset is is used.

Definition at line 1185 of file ac3enc.c.

Referenced by cbr_bit_allocation(), compute_bit_allocation(), encode_frame(), mp_decode_layer2(), and MPA_encode_frame().

◆ cbr_bit_allocation()

static int cbr_bit_allocation ( AC3EncodeContext s)
static

Definition at line 1216 of file ac3enc.c.

Referenced by ac3_compute_bit_allocation().

◆ ac3_compute_bit_allocation()

static int ac3_compute_bit_allocation ( AC3EncodeContext s)
static

Definition at line 1267 of file ac3enc.c.

Referenced by ff_ac3_encode_frame_common_end().

◆ sym_quant()

static int sym_quant ( int  c,
int  e,
int  levels 
)
inlinestatic

Symmetric quantization on 'levels' levels.

Parameters
cunquantized coefficient
eexponent
levelsnumber of quantization levels
Returns
quantized coefficient

Definition at line 1287 of file ac3enc.c.

Referenced by quantize_mantissas_blk_ch().

◆ asym_quant()

static int asym_quant ( int  c,
int  e,
int  qbits 
)
inlinestatic

Asymmetric quantization on 2^qbits levels.

Parameters
cunquantized coefficient
eexponent
qbitsnumber of quantization bits
Returns
quantized coefficient

Definition at line 1303 of file ac3enc.c.

Referenced by quantize_mantissas_blk_ch().

◆ quantize_mantissas_blk_ch()

static void quantize_mantissas_blk_ch ( AC3Mant s,
int32_t fixed_coef,
uint8_t *  exp,
uint8_t *  bap,
int16_t *  qmant,
int  start_freq,
int  end_freq 
)
static

Quantize a set of mantissas for a single channel in a single block.

Parameters
sMantissa count context
fixed_coefunquantized fixed-point coefficients
expexponents
bapbit allocation pointer indices
[out]qmantquantized coefficients
start_freqstarting coefficient bin
end_freqending coefficient bin

Definition at line 1327 of file ac3enc.c.

Referenced by ac3_quantize_mantissas().

◆ ac3_quantize_mantissas()

static void ac3_quantize_mantissas ( AC3EncodeContext s)
static

Quantize mantissas using coefficients, exponents, and bit allocation pointers.

Parameters
sAC-3 encoder private context

Definition at line 1422 of file ac3enc.c.

Referenced by ff_ac3_encode_frame_common_end().

◆ ac3_output_frame_header()

static void ac3_output_frame_header ( AC3EncodeContext s)
static

Definition at line 1451 of file ac3enc.c.

Referenced by ff_ac3_encode_init().

◆ output_audio_block()

static void output_audio_block ( AC3EncodeContext s,
int  blk 
)
static

Definition at line 1507 of file ac3enc.c.

Referenced by ac3_output_frame().

◆ mul_poly()

static unsigned int mul_poly ( unsigned int  a,
unsigned int  b,
unsigned int  poly 
)
static

Definition at line 1700 of file ac3enc.c.

Referenced by output_frame_end(), and pow_poly().

◆ pow_poly()

static unsigned int pow_poly ( unsigned int  a,
unsigned int  n,
unsigned int  poly 
)
static

Definition at line 1717 of file ac3enc.c.

Referenced by ff_ac3_encode_init().

◆ output_frame_end()

static void output_frame_end ( AC3EncodeContext s)
static

Definition at line 1734 of file ac3enc.c.

Referenced by ac3_output_frame().

◆ ac3_output_frame()

static void ac3_output_frame ( AC3EncodeContext s,
unsigned char *  frame 
)
static

Write the frame to the output bitstream.

Parameters
sAC-3 encoder private context
frameoutput data buffer

Definition at line 1783 of file ac3enc.c.

Referenced by ff_ac3_encode_frame_common_end().

◆ ff_ac3_encode_frame_common_end()

int ff_ac3_encode_frame_common_end ( AVCodecContext avctx,
AVPacket avpkt,
const AVFrame frame,
int got_packet_ptr 
)

Definition at line 1797 of file ac3enc.c.

Referenced by encode_frame().

◆ dprint_options()

static void dprint_options ( AC3EncodeContext s)
static

Definition at line 1829 of file ac3enc.c.

Referenced by ff_ac3_encode_init().

◆ validate_float_option()

static int validate_float_option ( float  v,
const float v_list,
int  v_list_size 
)
static

Definition at line 1946 of file ac3enc.c.

Referenced by validate_mix_level().

◆ validate_mix_level()

static void validate_mix_level ( void *  log_ctx,
const char *  opt_name,
float opt_param,
const float list,
int  list_size,
int  default_value,
int  min_value,
int ctx_param 
)
static

Definition at line 1962 of file ac3enc.c.

Referenced by ff_ac3_validate_metadata().

◆ ff_ac3_validate_metadata()

int ff_ac3_validate_metadata ( AC3EncodeContext s)

Validate metadata options as set by AVOption system.

These values can optionally be changed per-frame.

Parameters
sAC-3 encoder private context

Definition at line 1986 of file ac3enc.c.

Referenced by encode_frame(), and validate_options().

◆ ff_ac3_encode_close()

av_cold int ff_ac3_encode_close ( AVCodecContext avctx)

Finalize encoding and free any memory allocated by the encoder.

Parameters
avctxCodec context

Definition at line 2169 of file ac3enc.c.

◆ set_channel_info()

static av_cold int set_channel_info ( AVCodecContext avctx)
static

Definition at line 2216 of file ac3enc.c.

Referenced by validate_options().

◆ validate_options()

static av_cold int validate_options ( AC3EncodeContext s)
static

Definition at line 2263 of file ac3enc.c.

Referenced by ff_ac3_encode_init().

◆ set_bandwidth()

static av_cold void set_bandwidth ( AC3EncodeContext s)
static

Definition at line 2408 of file ac3enc.c.

Referenced by ff_ac3_encode_init().

◆ allocate_buffers()

static av_cold int allocate_buffers ( AC3EncodeContext s)
static

Definition at line 2478 of file ac3enc.c.

Referenced by ff_ac3_encode_init().

◆ ff_ac3_encode_init()

av_cold int ff_ac3_encode_init ( AVCodecContext avctx)

Definition at line 2564 of file ac3enc.c.

Referenced by ac3_fixed_encode_init(), and ff_ac3_float_encode_init().

Variable Documentation

◆ cmixlev_options

const float cmixlev_options[CMIXLEV_NUM_OPTIONS]
static
Initial value:

Definition at line 62 of file ac3enc.c.

Referenced by ff_ac3_validate_metadata().

◆ surmixlev_options

const float surmixlev_options[SURMIXLEV_NUM_OPTIONS]
static
Initial value:

Definition at line 67 of file ac3enc.c.

Referenced by ff_ac3_validate_metadata().

◆ extmixlev_options

const float extmixlev_options[EXTMIXLEV_NUM_OPTIONS]
static

◆ ff_ac3_enc_options

const AVOption ff_ac3_enc_options[]

Definition at line 82 of file ac3enc.c.

◆ ff_ac3enc_class

const AVClass ff_ac3enc_class
Initial value:
= {
.class_name = "AC-3 Encoder",
.item_name = av_default_item_name,
.option = ff_ac3_enc_options,
}

Definition at line 132 of file ac3enc.c.

◆ ff_ac3_enc_defaults

const FFCodecDefault ff_ac3_enc_defaults[]
Initial value:
= {
{ "b", "0" },
{ NULL }
}

Definition at line 139 of file ac3enc.c.

◆ exponent_group_tab

uint8_t exponent_group_tab[2][3][256]
static

LUT for number of exponent groups.

exponent_group_tab[coupling][exponent strategy-1][number of coefficients]

Definition at line 148 of file ac3enc.c.

Referenced by ac3_group_exponents(), count_exponent_bits(), encode_exponents_blk_ch(), exponent_init(), and output_audio_block().

◆ ff_ac3_ch_layouts

const AVChannelLayout ff_ac3_ch_layouts[19]

List of supported channel layouts.

Definition at line 178 of file ac3enc.c.

◆ ac3_enc_channel_map

const uint8_t ac3_enc_channel_map[8][2][6]
static
Initial value:
= {
{ { 0, 1, 2, 3, }, { 0, 1, 3, 4, 2, } },
{ { 0, 2, 1, 3, 4, }, { 0, 2, 1, 4, 5, 3 } },
}

Table to remap channels from SMPTE order to AC-3 order.

[channel_mode][lfe][ch]

Definition at line 222 of file ac3enc.c.

Referenced by set_channel_info().

◆ ac3_bandwidth_tab

const uint8_t ac3_bandwidth_tab[5][3][19]
static
Initial value:
= {
{ { 0, 0, 0, 12, 16, 32, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48 },
{ 0, 0, 0, 16, 20, 36, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56 },
{ 0, 0, 0, 32, 40, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60 } },
{ { 0, 0, 0, 0, 0, 0, 0, 20, 24, 32, 48, 48, 48, 48, 48, 48, 48, 48, 48 },
{ 0, 0, 0, 0, 0, 0, 4, 24, 28, 36, 56, 56, 56, 56, 56, 56, 56, 56, 56 },
{ 0, 0, 0, 0, 0, 0, 20, 44, 52, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60 } },
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 24, 32, 40, 48, 48, 48, 48, 48, 48 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 4, 20, 28, 36, 44, 56, 56, 56, 56, 56, 56 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 20, 40, 48, 60, 60, 60, 60, 60, 60, 60, 60 } },
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 24, 32, 48, 48, 48, 48, 48, 48 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 28, 36, 56, 56, 56, 56, 56, 56 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 48, 60, 60, 60, 60, 60, 60, 60 } },
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 20, 32, 40, 48, 48, 48, 48 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 24, 36, 44, 56, 56, 56, 56 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 44, 60, 60, 60, 60, 60, 60 } }
}

LUT to select the bandwidth code based on the bit rate, sample rate, and number of full-bandwidth channels.

bandwidth_tab[fbw_channels-1][sample rate code][bit rate code]

Definition at line 233 of file ac3enc.c.

Referenced by set_bandwidth().

◆ ac3_coupling_start_tab

const int8_t ac3_coupling_start_tab[6][3][19]
static

LUT to select the coupling start band based on the bit rate, sample rate, and number of full-bandwidth channels.

-1 = coupling off ac3_coupling_start_tab[channel_mode-2][sample rate code][bit rate code]

TODO: more testing for optimal parameters. multi-channel tests at 44.1kHz and 32kHz.

Definition at line 266 of file ac3enc.c.

Referenced by set_bandwidth().

◆ exp_strategy_reuse_tab

const uint8_t exp_strategy_reuse_tab[4][6]
static
Initial value:

Table used to select exponent strategy based on exponent reuse block interval.

Definition at line 468 of file ac3enc.c.

Referenced by compute_exp_strategy().

EXP_D45
#define EXP_D45
Definition: ac3defs.h:43
LEVEL_MINUS_6DB
#define LEVEL_MINUS_6DB
Definition: ac3.h:90
COMMON_CHANNEL_MAP
#define COMMON_CHANNEL_MAP
Definition: ac3tab.h:64
LEVEL_MINUS_4POINT5DB
#define LEVEL_MINUS_4POINT5DB
Definition: ac3.h:89
ff_ac3_enc_options
const AVOption ff_ac3_enc_options[]
Definition: ac3enc.c:82
LEVEL_PLUS_3DB
#define LEVEL_PLUS_3DB
Definition: ac3.h:85
LEVEL_MINUS_3DB
#define LEVEL_MINUS_3DB
Definition: ac3.h:88
EXP_D15
#define EXP_D15
Definition: ac3defs.h:41
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
LEVEL_MINUS_1POINT5DB
#define LEVEL_MINUS_1POINT5DB
Definition: ac3.h:87
LEVEL_ONE
#define LEVEL_ONE
Definition: ac3.h:93
LEVEL_PLUS_1POINT5DB
#define LEVEL_PLUS_1POINT5DB
Definition: ac3.h:86
LEVEL_ZERO
#define LEVEL_ZERO
Definition: ac3.h:92
EXP_D25
#define EXP_D25
Definition: ac3defs.h:42