aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ac3enc_fixed.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-06-14 04:55:27 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-06-14 04:56:26 +0200
commit173cd695cbb79a50a0738ce7bcc966cb40f4a28a (patch)
tree1a8025d98e71b5950eb12ed24c2c8787a5c185e3 /libavcodec/ac3enc_fixed.c
parentfdb5e02901111a6a53f8386d82afae0aa2d746a7 (diff)
parent35bdaf3d427b6856df01d41ee826bd515440ec46 (diff)
downloadffmpeg-173cd695cbb79a50a0738ce7bcc966cb40f4a28a.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: (24 commits) utils: Drop pointless '#if 1' preprocessor directive. ac3enc: remove empty ac3_float function that is never called ac3enc: split templated float vs. fixed functions into a separate file. ac3enc: dynamically allocate AC3EncodeContext fields windowed_samples and mdct ac3enc: use function pointer to choose between AC-3 and E-AC-3 header output functions. Roll back 4:4:4 H.264 for now Needs some ARM/PPC asm modifications. Fix SVQ3 after adding 4:4:4 H.264 support H.264: fix CODEC_FLAG_GRAY 4:4:4 H.264 decoding support h264_parser: Fix whitespace after previous change. h264_parser: Fix behaviour when PARSER_FLAG_COMPLETE_FRAMES is set. wav: remove an invalid free(). lavf: initialise reference_dts in av_estimate_timings_from_pts. h264: don't be so picky on decoding pps in extradata. avcodec.h: add or elaborate on some documentation comments. h264: change a few comments into error messages ac3dec: fix doxy-style for comment ("///>" should be "///<" instead). img2: add .dpx to the list of supported file extensions. ffv1: fix undefined behavior with insane widths. ARM: jrevdct_arm: simplify stack usage ... Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ac3enc_fixed.c')
-rw-r--r--libavcodec/ac3enc_fixed.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c
index 6b1ee88c9f..f4d447e3b2 100644
--- a/libavcodec/ac3enc_fixed.c
+++ b/libavcodec/ac3enc_fixed.c
@@ -28,13 +28,20 @@
#define CONFIG_FFT_FLOAT 0
#undef CONFIG_AC3ENC_FLOAT
-#include "ac3enc.c"
+#include "ac3enc.h"
+
+#define AC3ENC_TYPE AC3ENC_TYPE_AC3_FIXED
+#include "ac3enc_opts_template.c"
+static AVClass ac3enc_class = { "Fixed-Point AC-3 Encoder", av_default_item_name,
+ ac3fixed_options, LIBAVUTIL_VERSION_INT };
+
+#include "ac3enc_template.c"
/**
* Finalize MDCT and free allocated memory.
*/
-static av_cold void mdct_end(AC3MDCTContext *mdct)
+av_cold void AC3_NAME(mdct_end)(AC3MDCTContext *mdct)
{
ff_mdct_end(&mdct->fft);
}
@@ -44,8 +51,8 @@ static av_cold void mdct_end(AC3MDCTContext *mdct)
* Initialize MDCT tables.
* @param nbits log2(MDCT size)
*/
-static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
- int nbits)
+av_cold int AC3_NAME(mdct_init)(AVCodecContext *avctx, AC3MDCTContext *mdct,
+ int nbits)
{
int ret = ff_mdct_init(&mdct->fft, nbits, 0, -1.0);
mdct->window = ff_ac3_window;
@@ -56,8 +63,9 @@ static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
/**
* Apply KBD window to input samples prior to MDCT.
*/
-static void apply_window(DSPContext *dsp, int16_t *output, const int16_t *input,
- const int16_t *window, unsigned int len)
+void AC3_NAME(apply_window)(DSPContext *dsp, int16_t *output,
+ const int16_t *input, const int16_t *window,
+ unsigned int len)
{
dsp->apply_window_int16(output, input, window, len);
}
@@ -82,7 +90,7 @@ static int log2_tab(AC3EncodeContext *s, int16_t *src, int len)
*
* @return exponent shift
*/
-static int normalize_samples(AC3EncodeContext *s)
+int AC3_NAME(normalize_samples)(AC3EncodeContext *s)
{
int v = 14 - log2_tab(s, s->windowed_samples, AC3_WINDOW_SIZE);
if (v > 0)
@@ -95,7 +103,7 @@ static int normalize_samples(AC3EncodeContext *s)
/**
* Scale MDCT coefficients to 25-bit signed fixed-point.
*/
-static void scale_coefficients(AC3EncodeContext *s)
+void AC3_NAME(scale_coefficients)(AC3EncodeContext *s)
{
int blk, ch;
@@ -109,14 +117,22 @@ static void scale_coefficients(AC3EncodeContext *s)
}
+static av_cold int ac3_fixed_encode_init(AVCodecContext *avctx)
+{
+ AC3EncodeContext *s = avctx->priv_data;
+ s->fixed_point = 1;
+ return ff_ac3_encode_init(avctx);
+}
+
+
AVCodec ff_ac3_fixed_encoder = {
"ac3_fixed",
AVMEDIA_TYPE_AUDIO,
CODEC_ID_AC3,
sizeof(AC3EncodeContext),
- ac3_encode_init,
- ac3_encode_frame,
- ac3_encode_close,
+ ac3_fixed_encode_init,
+ ff_ac3_encode_frame,
+ ff_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)"),