summaryrefslogtreecommitdiff
path: root/libavcodec/ac3enc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-06-15 02:15:25 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-06-15 02:15:25 +0200
commitc137fdd778e1bb82c2f0d7fa4a88adc97058d6d4 (patch)
tree6ba8284ec414ae9cc98d70a80fcb81a719d66272 /libavcodec/ac3enc.c
parent9e2f448d68d9df7ad79d968db315c6b0cc79c4df (diff)
parent4e0583020567dd2062a908fe59aacba484e68049 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: swscale: remove misplaced comment. ffmpeg: fix streaming to ffserver. swscale: split out RGB48 output functions from yuv2packed[12X]_c(). build: move vpath directives to main Makefile swscale: fix JPEG-range YUV scaling artifacts. build: move ALLFFLIBS to a more logical place ARM: factor some repetitive code into macros Fix SVQ3 after adding 4:4:4 H.264 support H.264: fix CODEC_FLAG_GRAY 4:4:4 H.264 decoding support ac3enc: fix allocation of floating point samples. Conflicts: ffmpeg.c libavcodec/dsputil_template.c libavcodec/h264.c libavcodec/mpegvideo.c libavcodec/snow.c libswscale/swscale.c libswscale/swscale_internal.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ac3enc.c')
-rw-r--r--libavcodec/ac3enc.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index f61e7f8c4d..6ee8a7ac15 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -2215,15 +2215,9 @@ static av_cold int allocate_buffers(AVCodecContext *avctx)
AC3EncodeContext *s = avctx->priv_data;
int channels = s->channels + 1; /* includes coupling channel */
- FF_ALLOC_OR_GOTO(avctx, s->windowed_samples, AC3_WINDOW_SIZE *
- sizeof(*s->windowed_samples), alloc_fail);
- FF_ALLOC_OR_GOTO(avctx, s->planar_samples, s->channels * sizeof(*s->planar_samples),
- alloc_fail);
- for (ch = 0; ch < s->channels; ch++) {
- FF_ALLOCZ_OR_GOTO(avctx, s->planar_samples[ch],
- (AC3_FRAME_SIZE+AC3_BLOCK_SIZE) * sizeof(**s->planar_samples),
- alloc_fail);
- }
+ if (s->allocate_sample_buffers(s))
+ goto alloc_fail;
+
FF_ALLOC_OR_GOTO(avctx, s->bap_buffer, AC3_MAX_BLOCKS * channels *
AC3_MAX_COEFS * sizeof(*s->bap_buffer), alloc_fail);
FF_ALLOC_OR_GOTO(avctx, s->bap1_buffer, AC3_MAX_BLOCKS * channels *
@@ -2323,6 +2317,8 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
AC3EncodeContext *s = avctx->priv_data;
int ret, frame_size_58;
+ s->avctx = avctx;
+
s->eac3 = avctx->codec_id == CODEC_ID_EAC3;
avctx->frame_size = AC3_FRAME_SIZE;
@@ -2355,6 +2351,7 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
s->apply_window = ff_ac3_fixed_apply_window;
s->normalize_samples = ff_ac3_fixed_normalize_samples;
s->scale_coefficients = ff_ac3_fixed_scale_coefficients;
+ s->allocate_sample_buffers = ff_ac3_fixed_allocate_sample_buffers;
s->deinterleave_input_samples = ff_ac3_fixed_deinterleave_input_samples;
s->apply_mdct = ff_ac3_fixed_apply_mdct;
s->apply_channel_coupling = ff_ac3_fixed_apply_channel_coupling;
@@ -2364,6 +2361,7 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
s->mdct_init = ff_ac3_float_mdct_init;
s->apply_window = ff_ac3_float_apply_window;
s->scale_coefficients = ff_ac3_float_scale_coefficients;
+ s->allocate_sample_buffers = ff_ac3_float_allocate_sample_buffers;
s->deinterleave_input_samples = ff_ac3_float_deinterleave_input_samples;
s->apply_mdct = ff_ac3_float_apply_mdct;
s->apply_channel_coupling = ff_ac3_float_apply_channel_coupling;