summaryrefslogtreecommitdiff
path: root/libavcodec/ac3enc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-04-04 02:15:12 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-04-04 02:15:12 +0200
commit2cae9809e2d59c7336fc2cccb97b82c7f764868a (patch)
tree823d962b7237e515e14e2679084e5981d5b808a5 /libavcodec/ac3enc.c
parent3c9bfb336867ccd32a6e8490930961bcc14b3fdc (diff)
parent906fd03070c7dc39b4c937befa2c3559bccf7ba7 (diff)
Merge remote branch 'qatar/master'
* qatar/master: fate: fix partial run when no samples path is specified ARM: NEON fixed-point forward MDCT ARM: NEON fixed-point FFT lavf: bump minor version and add an APIChanges entry for avio changes avio: simplify url_open_dyn_buf_internal by using avio_alloc_context() avio: make url_fdopen internal. avio: make url_open_dyn_packet_buf internal. avio: avio_ prefix for url_close_dyn_buf avio: avio_ prefix for url_open_dyn_buf avio: introduce an AVIOContext.seekable field ac3enc: use generic fixed-point mdct lavfi: add fade filter Change yadif to not use out of picture lines. lavc: deprecate AVCodecContext.antialias_algo lavc: mark mb_qmin/mb_qmax for removal on next major bump. Conflicts: doc/filters.texi libavcodec/ac3enc_fixed.h libavcodec/ac3enc_float.h libavfilter/Makefile libavfilter/allfilters.c libavfilter/vf_fade.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ac3enc.c')
-rw-r--r--libavcodec/ac3enc.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index bc6b9c8766..5f2868f5e6 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -29,6 +29,8 @@
//#define DEBUG
//#define ASSERT_LEVEL 2
+#include <stdint.h>
+
#include "libavutil/audioconvert.h"
#include "libavutil/avassert.h"
#include "libavutil/crc.h"
@@ -39,6 +41,7 @@
#include "ac3dsp.h"
#include "ac3.h"
#include "audioconvert.h"
+#include "fft.h"
#ifndef CONFIG_AC3ENC_FLOAT
@@ -55,16 +58,22 @@
#define AC3_REMATRIXING_NONE 1
#define AC3_REMATRIXING_ALWAYS 3
-/** Scale a float value by 2^bits and convert to an integer. */
-#define SCALE_FLOAT(a, bits) lrintf((a) * (float)(1 << (bits)))
-
-
#if CONFIG_AC3ENC_FLOAT
-#include "ac3enc_float.h"
+#define MAC_COEF(d,a,b) ((d)+=(a)*(b))
+typedef float SampleType;
+typedef float CoefType;
+typedef float CoefSumType;
#else
-#include "ac3enc_fixed.h"
+#define MAC_COEF(d,a,b) MAC64(d,a,b)
+typedef int16_t SampleType;
+typedef int32_t CoefType;
+typedef int64_t CoefSumType;
#endif
+typedef struct AC3MDCTContext {
+ const SampleType *window; ///< MDCT window function
+ FFTContext fft; ///< FFT context for MDCT calculation
+} AC3MDCTContext;
/**
* Encoding Options used by AVOption.
@@ -279,8 +288,6 @@ static av_cold void mdct_end(AC3MDCTContext *mdct);
static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
int nbits);
-static void mdct512(AC3MDCTContext *mdct, CoefType *out, SampleType *in);
-
static void apply_window(DSPContext *dsp, SampleType *output, const SampleType *input,
const SampleType *window, unsigned int len);
@@ -386,7 +393,8 @@ static void apply_mdct(AC3EncodeContext *s)
block->coeff_shift[ch] = normalize_samples(s);
- mdct512(&s->mdct, block->mdct_coef[ch], s->windowed_samples);
+ s->mdct.fft.mdct_calcw(&s->mdct.fft, block->mdct_coef[ch],
+ s->windowed_samples);
}
}
}