1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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.
This commit is contained in:
Justin Ruggles 2011-11-27 13:07:19 -05:00
parent d9ba767d61
commit 0df5e869cb
2 changed files with 7 additions and 11 deletions

View File

@ -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,

View File

@ -28,7 +28,6 @@ AVCodec ff_mp1float_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
@ -44,7 +43,6 @@ AVCodec ff_mp2float_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
@ -60,7 +58,6 @@ AVCodec ff_mp3float_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
@ -76,7 +73,6 @@ AVCodec ff_mp3adufloat_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
@ -92,7 +88,6 @@ AVCodec ff_mp3on4float_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,