[FFmpeg-cvslog] ac3: Only initialize float_dsp for the float encoder variant

Diego Biurrun git at videolan.org
Fri Jun 13 19:51:52 CEST 2014


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Wed Jun 11 05:32:01 2014 -0700| [27631796c9d1b8146ad4a16e6539ecc08afa7565] | committer: Diego Biurrun

ac3: Only initialize float_dsp for the float encoder variant

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=27631796c9d1b8146ad4a16e6539ecc08afa7565
---

 libavcodec/ac3enc.c       |    1 -
 libavcodec/ac3enc.h       |    1 +
 libavcodec/ac3enc_float.c |    8 +++++++-
 libavcodec/eac3enc.c      |    2 +-
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index ce6c1a6..cc8df47 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -2481,7 +2481,6 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
         goto init_fail;
 
     ff_dsputil_init(&s->dsp, avctx);
-    avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
     ff_ac3dsp_init(&s->ac3dsp, avctx->flags & CODEC_FLAG_BITEXACT);
 
     dprint_options(s);
diff --git a/libavcodec/ac3enc.h b/libavcodec/ac3enc.h
index a533536..90bbf2a 100644
--- a/libavcodec/ac3enc.h
+++ b/libavcodec/ac3enc.h
@@ -266,6 +266,7 @@ typedef struct AC3EncodeContext {
 extern const uint64_t ff_ac3_channel_layouts[19];
 
 int ff_ac3_encode_init(AVCodecContext *avctx);
+int ff_ac3_float_encode_init(AVCodecContext *avctx);
 
 int ff_ac3_encode_close(AVCodecContext *avctx);
 
diff --git a/libavcodec/ac3enc_float.c b/libavcodec/ac3enc_float.c
index 03b782c..6b6290f 100644
--- a/libavcodec/ac3enc_float.c
+++ b/libavcodec/ac3enc_float.c
@@ -124,6 +124,12 @@ static CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType energy_cpl)
     return FFMIN(coord, COEF_MAX);
 }
 
+av_cold int ff_ac3_float_encode_init(AVCodecContext *avctx)
+{
+    AC3EncodeContext *s = avctx->priv_data;
+    avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
+    return ff_ac3_encode_init(avctx);
+}
 
 AVCodec ff_ac3_encoder = {
     .name            = "ac3",
@@ -131,7 +137,7 @@ AVCodec ff_ac3_encoder = {
     .type            = AVMEDIA_TYPE_AUDIO,
     .id              = AV_CODEC_ID_AC3,
     .priv_data_size  = sizeof(AC3EncodeContext),
-    .init            = ff_ac3_encode_init,
+    .init            = ff_ac3_float_encode_init,
     .encode2         = ff_ac3_float_encode_frame,
     .close           = ff_ac3_encode_close,
     .sample_fmts     = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,
diff --git a/libavcodec/eac3enc.c b/libavcodec/eac3enc.c
index 18e9f73..3aa2d54 100644
--- a/libavcodec/eac3enc.c
+++ b/libavcodec/eac3enc.c
@@ -253,7 +253,7 @@ AVCodec ff_eac3_encoder = {
     .type            = AVMEDIA_TYPE_AUDIO,
     .id              = AV_CODEC_ID_EAC3,
     .priv_data_size  = sizeof(AC3EncodeContext),
-    .init            = ff_ac3_encode_init,
+    .init            = ff_ac3_float_encode_init,
     .encode2         = ff_ac3_float_encode_frame,
     .close           = ff_ac3_encode_close,
     .sample_fmts     = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,



More information about the ffmpeg-cvslog mailing list