History

mpegaudiodec: init static tables in AVCodec.init_static_data()

Justin Ruggles committed 15 years ago

Commit 11587451 parent 3f5d6a62 files · +22 −18Browse files

Unified · Split

2 files
  1. libavcodec/mpegaudiodec.c +17 −18
  2. libavcodec/mpegaudiodec_float.c +5 −0
libavcodec/mpegaudiodec.c+17−18
@@ -266,24 +266,9 @@ static inline int l3_unscale(int value, int exponent) · 265 unmodified lines
266 return m;266 return m;
267}267}
268 268
269static av_cold int decode_init(AVCodecContext * avctx)269static void decode_init_static(AVCodec *codec)
270{270{
271 MPADecodeContext *s = avctx->priv_data;
272 static int init = 0;
273 int i, j, k;271 int i, j, k;
274
275 s->avctx = avctx;
276
277 ff_mpadsp_init(&s->mpadsp);
278
279 avctx->sample_fmt= OUT_FMT;
280 s->err_recognition = avctx->err_recognition;
281
282#if FF_API_PARSE_FRAME
283 if (!init && !avctx->parse_only) {
284#else
285 if (!init) {
286#endif
287 int offset;272 int offset;
288 273
289 /* scale factors table for layer 1/2 */274 /* scale factors table for layer 1/2 */
@@ -468,9 +453,18 @@ static av_cold int decode_init(AVCodecContext * avctx) · 178 unmodified lines
468 mdct_win[j + 4][i + 1] = -mdct_win[j][i + 1];453 mdct_win[j + 4][i + 1] = -mdct_win[j][i + 1];
469 }454 }
470 }455 }
456}
471 457
472 init = 1;458static av_cold int decode_init(AVCodecContext * avctx)
473 }459{
460 MPADecodeContext *s = avctx->priv_data;
461
462 s->avctx = avctx;
463
464 ff_mpadsp_init(&s->mpadsp);
465
466 avctx->sample_fmt= OUT_FMT;
467 s->err_recognition = avctx->err_recognition;
474 468
475 if (avctx->codec_id == CODEC_ID_MP3ADU)469 if (avctx->codec_id == CODEC_ID_MP3ADU)
476 s->adu_mode = 1;470 s->adu_mode = 1;
@@ -2116,6 +2110,7 @@ AVCodec ff_mp1_decoder = { · 1639 unmodified lines
2116 .type = AVMEDIA_TYPE_AUDIO,2110 .type = AVMEDIA_TYPE_AUDIO,
2117 .id = CODEC_ID_MP1,2111 .id = CODEC_ID_MP1,
2118 .priv_data_size = sizeof(MPADecodeContext),2112 .priv_data_size = sizeof(MPADecodeContext),
2113 .init_static_data = decode_init_static,
2119 .init = decode_init,2114 .init = decode_init,
2120 .decode = decode_frame,2115 .decode = decode_frame,
2121#if FF_API_PARSE_FRAME2116#if FF_API_PARSE_FRAME
@@ -2131,6 +2126,7 @@ AVCodec ff_mp2_decoder = { · 9 unmodified lines
2131 .type = AVMEDIA_TYPE_AUDIO,2126 .type = AVMEDIA_TYPE_AUDIO,
2132 .id = CODEC_ID_MP2,2127 .id = CODEC_ID_MP2,
2133 .priv_data_size = sizeof(MPADecodeContext),2128 .priv_data_size = sizeof(MPADecodeContext),
2129 .init_static_data = decode_init_static,
2134 .init = decode_init,2130 .init = decode_init,
2135 .decode = decode_frame,2131 .decode = decode_frame,
2136#if FF_API_PARSE_FRAME2132#if FF_API_PARSE_FRAME
@@ -2146,6 +2142,7 @@ AVCodec ff_mp3_decoder = { · 9 unmodified lines
2146 .type = AVMEDIA_TYPE_AUDIO,2142 .type = AVMEDIA_TYPE_AUDIO,
2147 .id = CODEC_ID_MP3,2143 .id = CODEC_ID_MP3,
2148 .priv_data_size = sizeof(MPADecodeContext),2144 .priv_data_size = sizeof(MPADecodeContext),
2145 .init_static_data = decode_init_static,
2149 .init = decode_init,2146 .init = decode_init,
2150 .decode = decode_frame,2147 .decode = decode_frame,
2151#if FF_API_PARSE_FRAME2148#if FF_API_PARSE_FRAME
@@ -2161,6 +2158,7 @@ AVCodec ff_mp3adu_decoder = { · 9 unmodified lines
2161 .type = AVMEDIA_TYPE_AUDIO,2158 .type = AVMEDIA_TYPE_AUDIO,
2162 .id = CODEC_ID_MP3ADU,2159 .id = CODEC_ID_MP3ADU,
2163 .priv_data_size = sizeof(MPADecodeContext),2160 .priv_data_size = sizeof(MPADecodeContext),
2161 .init_static_data = decode_init_static,
2164 .init = decode_init,2162 .init = decode_init,
2165 .decode = decode_frame_adu,2163 .decode = decode_frame_adu,
2166#if FF_API_PARSE_FRAME2164#if FF_API_PARSE_FRAME
@@ -2176,6 +2174,7 @@ AVCodec ff_mp3on4_decoder = { · 9 unmodified lines
2176 .type = AVMEDIA_TYPE_AUDIO,2174 .type = AVMEDIA_TYPE_AUDIO,
2177 .id = CODEC_ID_MP3ON4,2175 .id = CODEC_ID_MP3ON4,
2178 .priv_data_size = sizeof(MP3On4DecodeContext),2176 .priv_data_size = sizeof(MP3On4DecodeContext),
2177 .init_static_data = decode_init_static,
2179 .init = decode_init_mp3on4,2178 .init = decode_init_mp3on4,
2180 .close = decode_close_mp3on4,2179 .close = decode_close_mp3on4,
2181 .decode = decode_frame_mp3on4,2180 .decode = decode_frame_mp3on4,
libavcodec/mpegaudiodec_float.c+5−0
@@ -28,6 +28,7 @@ AVCodec ff_mp1float_decoder = { · 27 unmodified lines
28 .type = AVMEDIA_TYPE_AUDIO,28 .type = AVMEDIA_TYPE_AUDIO,
29 .id = CODEC_ID_MP1,29 .id = CODEC_ID_MP1,
30 .priv_data_size = sizeof(MPADecodeContext),30 .priv_data_size = sizeof(MPADecodeContext),
31 .init_static_data = decode_init_static,
31 .init = decode_init,32 .init = decode_init,
32 .decode = decode_frame,33 .decode = decode_frame,
33#if FF_API_PARSE_FRAME34#if FF_API_PARSE_FRAME
@@ -43,6 +44,7 @@ AVCodec ff_mp2float_decoder = { · 9 unmodified lines
43 .type = AVMEDIA_TYPE_AUDIO,44 .type = AVMEDIA_TYPE_AUDIO,
44 .id = CODEC_ID_MP2,45 .id = CODEC_ID_MP2,
45 .priv_data_size = sizeof(MPADecodeContext),46 .priv_data_size = sizeof(MPADecodeContext),
47 .init_static_data = decode_init_static,
46 .init = decode_init,48 .init = decode_init,
47 .decode = decode_frame,49 .decode = decode_frame,
48#if FF_API_PARSE_FRAME50#if FF_API_PARSE_FRAME
@@ -58,6 +60,7 @@ AVCodec ff_mp3float_decoder = { · 9 unmodified lines
58 .type = AVMEDIA_TYPE_AUDIO,60 .type = AVMEDIA_TYPE_AUDIO,
59 .id = CODEC_ID_MP3,61 .id = CODEC_ID_MP3,
60 .priv_data_size = sizeof(MPADecodeContext),62 .priv_data_size = sizeof(MPADecodeContext),
63 .init_static_data = decode_init_static,
61 .init = decode_init,64 .init = decode_init,
62 .decode = decode_frame,65 .decode = decode_frame,
63#if FF_API_PARSE_FRAME66#if FF_API_PARSE_FRAME
@@ -73,6 +76,7 @@ AVCodec ff_mp3adufloat_decoder = { · 9 unmodified lines
73 .type = AVMEDIA_TYPE_AUDIO,76 .type = AVMEDIA_TYPE_AUDIO,
74 .id = CODEC_ID_MP3ADU,77 .id = CODEC_ID_MP3ADU,
75 .priv_data_size = sizeof(MPADecodeContext),78 .priv_data_size = sizeof(MPADecodeContext),
79 .init_static_data = decode_init_static,
76 .init = decode_init,80 .init = decode_init,
77 .decode = decode_frame_adu,81 .decode = decode_frame_adu,
78#if FF_API_PARSE_FRAME82#if FF_API_PARSE_FRAME
@@ -88,6 +92,7 @@ AVCodec ff_mp3on4float_decoder = { · 9 unmodified lines
88 .type = AVMEDIA_TYPE_AUDIO,92 .type = AVMEDIA_TYPE_AUDIO,
89 .id = CODEC_ID_MP3ON4,93 .id = CODEC_ID_MP3ON4,
90 .priv_data_size = sizeof(MP3On4DecodeContext),94 .priv_data_size = sizeof(MP3On4DecodeContext),
95 .init_static_data = decode_init_static,
91 .init = decode_init_mp3on4,96 .init = decode_init_mp3on4,
92 .close = decode_close_mp3on4,97 .close = decode_close_mp3on4,
93 .decode = decode_frame_mp3on4,98 .decode = decode_frame_mp3on4,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t