aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpegaudiodec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-11-27 13:07:19 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2011-11-27 13:59:34 -0500
commit0df5e869cb9fc4eb6f7aacdf40920b0b87ce4db7 (patch)
treed375e419e3cb7dcb7bc52aa54143e8a1d6f6794a /libavcodec/mpegaudiodec.c
parentd9ba767d615ffb1f51ac3f990c51768ea8622da8 (diff)
downloadffmpeg-0df5e869cb9fc4eb6f7aacdf40920b0b87ce4db7.tar.gz
mpegaudio: do not use init_static_data() for initializing tables.
It is called once for each mpegaudio codec that is registered, which adds significant overhead.
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r--libavcodec/mpegaudiodec.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index bc012731b9..ffd369021c 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -266,7 +266,7 @@ static inline int l3_unscale(int value, int exponent)
return m;
}
-static void decode_init_static(AVCodec *codec)
+static av_cold void decode_init_static(void)
{
int i, j, k;
int offset;
@@ -457,8 +457,14 @@ static void decode_init_static(AVCodec *codec)
static av_cold int decode_init(AVCodecContext * avctx)
{
+ static int initialized_tables = 0;
MPADecodeContext *s = avctx->priv_data;
+ if (!initialized_tables) {
+ decode_init_static();
+ initialized_tables = 1;
+ }
+
s->avctx = avctx;
ff_mpadsp_init(&s->mpadsp);
@@ -2110,7 +2116,6 @@ AVCodec ff_mp1_decoder = {
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP1,
.priv_data_size = sizeof(MPADecodeContext),
- .init_static_data = decode_init_static,
.init = decode_init,
.decode = decode_frame,
#if FF_API_PARSE_FRAME
@@ -2126,7 +2131,6 @@ AVCodec ff_mp2_decoder = {
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP2,
.priv_data_size = sizeof(MPADecodeContext),
- .init_static_data = decode_init_static,
.init = decode_init,
.decode = decode_frame,
#if FF_API_PARSE_FRAME
@@ -2142,7 +2146,6 @@ AVCodec ff_mp3_decoder = {
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP3,
.priv_data_size = sizeof(MPADecodeContext),
- .init_static_data = decode_init_static,
.init = decode_init,
.decode = decode_frame,
#if FF_API_PARSE_FRAME
@@ -2158,7 +2161,6 @@ AVCodec ff_mp3adu_decoder = {
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP3ADU,
.priv_data_size = sizeof(MPADecodeContext),
- .init_static_data = decode_init_static,
.init = decode_init,
.decode = decode_frame_adu,
#if FF_API_PARSE_FRAME
@@ -2174,7 +2176,6 @@ AVCodec ff_mp3on4_decoder = {
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP3ON4,
.priv_data_size = sizeof(MP3On4DecodeContext),
- .init_static_data = decode_init_static,
.init = decode_init_mp3on4,
.close = decode_close_mp3on4,
.decode = decode_frame_mp3on4,