50#include "config_components.h"
54#define IMDCT_TYPE AV_TX_INT32_MDCT
59#define AC3_FIXED_COEFF_BITS 2
60#define AC3_FIXED_EXPONENT_MAX 24
71 50529027, 44278013, 39403370, 32292987, 27356480, 23729101, 20951060, 18755316
82 int temp, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
84 mul = (dynrng & 0x1f) + 0x20;
91 temp1 =
src[
i+1] * mul;
93 temp2 =
src[
i+2] * mul;
95 temp1 = temp1 +
round;
97 temp3 =
src[
i+3] * mul;
98 temp2 = temp2 +
round;
101 temp4 =
src[
i + 4] * mul;
102 temp3 = temp3 +
round;
105 temp5 =
src[
i+5] * mul;
106 temp4 = temp4 +
round;
108 temp6 =
src[
i+6] * mul;
111 temp5 = temp5 +
round;
112 temp7 =
src[
i+7] * mul;
113 temp6 = temp6 +
round;
116 temp7 = temp7 +
round;
144 mul = (dynrng & 0x1f) + 0x20;
159 const int unit = 1 <<
shift;
163 for (
i = 0;
i <
len;
i++) {
165 int remainder =
src[
i] - quotient * unit;
169 }
else if (
shift > 0) {
186 int out_ch,
int in_ch,
int len)
191 for (
i = 0;
i <
len;
i++) {
193 for (j = 0; j < in_ch; j++) {
194 v0 += samples[j][
i] *
matrix[0][j];
195 v1 += samples[j][
i] *
matrix[1][j];
197 samples[0][
i] = (v0+2048)>>12;
198 samples[1][
i] = (v1+2048)>>12;
200 }
else if (out_ch == 1) {
201 for (
i = 0;
i <
len;
i++) {
203 for (j = 0; j < in_ch; j++)
204 v0 += samples[j][
i] *
matrix[0][j];
205 samples[0][
i] = (v0+2048)>>12;
210#if CONFIG_EAC3_DECODER
216 {
"cons_noisegen",
"enable consistent noise generation",
OFFSET(consistent_noise_generation),
AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1,
PAR },
217 {
"drc_scale",
"percentage of dynamic range compression to apply",
OFFSET(drc_scale),
AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 6.0,
PAR },
218 {
"heavy_compr",
"enable heavy dynamic range compression",
OFFSET(heavy_compression),
AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1,
PAR },
224 .class_name =
"Fixed-Point AC-3 Decoder",
231 .p.name =
"ac3_fixed",
236 .priv_data_size =
sizeof (AC3DecodeContext),
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
#define AC3_FIXED_COEFF_BITS
static void ac3_downmix_c_fixed16(int16_t **samples, int16_t **matrix, int out_ch, int in_ch, int len)
Downmix samples from original signal to stereo or mono (this is for 16-bit samples and fixed point de...
static void scale_coefs_q2(int32_t *dst, const int32_t *src, int dynrng, int len)
static const int end_freq_inv_tab[8]
static av_always_inline int fixed_coeff_bits(const AC3DecodeContext *s)
const FFCodec ff_ac3_fixed_decoder
static void scale_coefs(int32_t *dst, const int32_t *src, int dynrng, int len)
static const AVClass ac3_decoder_class
static av_cold void close(AVCodecParserContext *s)
#define i(width, name, range_min, range_max)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define CODEC_SAMPLEFMTS(...)
void(* flush)(AVBSFContext *ctx)
int(* init)(AVBSFContext *ctx)
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
#define LIBAVUTIL_VERSION_INT
static av_cold void ac3_decode_flush(AVCodecContext *avctx)
static av_cold int ac3_decode_end(AVCodecContext *avctx)
Uninitialize the AC-3 decoder.
static int ac3_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Decode a single AC-3 frame.
static av_cold int ac3_decode_init(AVCodecContext *avctx)
AVCodec initialization.
static int shift(int a, int b)
static av_always_inline av_const double round(double x)
static av_const int sign_extend(int val, unsigned bits)
Describe the class of an AVClass context structure.