summaryrefslogtreecommitdiffstats
path: root/libavcodec/ac3enc_float.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-07-13 15:12:11 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-07-13 16:55:28 -0400
commitb5849f77095439e994b11c25e6063d443b36c228 (patch)
tree9728b5e7cda89d104e65ff8fed68155697a6c845 /libavcodec/ac3enc_float.c
parent82cea7cb6c38e251f88fbf090cd5361f5d0a49de (diff)
downloadffmpeg-streaming-b5849f77095439e994b11c25e6063d443b36c228.zip
ffmpeg-streaming-b5849f77095439e994b11c25e6063d443b36c228.tar.gz
ac3enc: merge AC3MDCTContext with AC3EncodeContext.
Since both the fixed-point and floating-point encoders use the FFTContext, this no longer needs to be in a separate context. Also, when a short-transform context is added, the same MDCT window will be used.
Diffstat (limited to 'libavcodec/ac3enc_float.c')
-rw-r--r--libavcodec/ac3enc_float.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/libavcodec/ac3enc_float.c b/libavcodec/ac3enc_float.c
index 718cc1f..deec79c 100644
--- a/libavcodec/ac3enc_float.c
+++ b/libavcodec/ac3enc_float.c
@@ -45,10 +45,10 @@ static AVClass ac3enc_class = { "AC-3 Encoder", av_default_item_name,
/**
* Finalize MDCT and free allocated memory.
*/
-av_cold void ff_ac3_float_mdct_end(AC3MDCTContext *mdct)
+av_cold void ff_ac3_float_mdct_end(AC3EncodeContext *s)
{
- ff_mdct_end(&mdct->fft);
- av_freep(&mdct->window);
+ ff_mdct_end(&s->mdct);
+ av_freep(&s->mdct_window);
}
@@ -56,26 +56,25 @@ av_cold void ff_ac3_float_mdct_end(AC3MDCTContext *mdct)
* Initialize MDCT tables.
* @param nbits log2(MDCT size)
*/
-av_cold int ff_ac3_float_mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
- int nbits)
+av_cold int ff_ac3_float_mdct_init(AC3EncodeContext *s)
{
float *window;
int i, n, n2;
- n = 1 << nbits;
+ n = 1 << 9;
n2 = n >> 1;
window = av_malloc(n * sizeof(*window));
if (!window) {
- av_log(avctx, AV_LOG_ERROR, "Cannot allocate memory.\n");
+ av_log(s->avctx, AV_LOG_ERROR, "Cannot allocate memory.\n");
return AVERROR(ENOMEM);
}
ff_kbd_window_init(window, 5.0, n2);
for (i = 0; i < n2; i++)
window[n-1-i] = window[i];
- mdct->window = window;
+ s->mdct_window = window;
- return ff_mdct_init(&mdct->fft, nbits, 0, -2.0 / n);
+ return ff_mdct_init(&s->mdct, 9, 0, -2.0 / n);
}
OpenPOWER on IntegriCloud