[FFmpeg-cvslog] avcodec/qdm2: move static init to normal init to avoid initializing tables that might never be used
Michael Niedermayer
git at videolan.org
Fri Dec 6 15:47:52 CET 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Dec 6 15:38:20 2013 +0100| [976fc5911c42783854d422eb1adcf4b57e6758f1] | committer: Michael Niedermayer
avcodec/qdm2: move static init to normal init to avoid initializing tables that might never be used
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=976fc5911c42783854d422eb1adcf4b57e6758f1
---
libavcodec/qdm2.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index 0a9eea0..bf830db 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -1750,12 +1750,19 @@ static void qdm2_synthesis_filter(QDM2Context *q, int index)
*
* @param q context
*/
-static av_cold void qdm2_init_static_data(AVCodec *codec) {
+static av_cold void qdm2_init_static_data(void) {
+ static int done;
+
+ if(done)
+ return;
+
qdm2_init_vlc();
ff_mpa_synth_init_float(ff_mpa_synth_window_float);
softclip_table_init();
rnd_table_init();
init_noise_samples();
+
+ done = 1;
}
/**
@@ -1768,6 +1775,8 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
int extradata_size;
int tmp_val, tmp, size;
+ qdm2_init_static_data();
+
/* extradata parsing
Structure:
@@ -2044,7 +2053,6 @@ AVCodec ff_qdm2_decoder = {
.id = AV_CODEC_ID_QDM2,
.priv_data_size = sizeof(QDM2Context),
.init = qdm2_decode_init,
- .init_static_data = qdm2_init_static_data,
.close = qdm2_decode_close,
.decode = qdm2_decode_frame,
.capabilities = CODEC_CAP_DR1,
More information about the ffmpeg-cvslog
mailing list