Merge remote-tracking branch 'qatar/master'

* qatar/master:
  lavf: fix multiplication overflow in avformat_find_stream_info()
  cosmetics: indentation
  mpegaudiodec: init static tables in AVCodec.init_static_data()

Conflicts:
	libavcodec/mpegaudiodec.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
pull/2/head
Michael Niedermayer 13 years ago
commit c1c836d9eb
  1. 39
      libavcodec/mpegaudiodec.c
  2. 5
      libavcodec/mpegaudiodec_float.c

@ -269,24 +269,9 @@ static inline int l3_unscale(int value, int exponent)
return m; return m;
} }
static av_cold int decode_init(AVCodecContext * avctx) static void decode_init_static(AVCodec *codec)
{ {
MPADecodeContext *s = avctx->priv_data;
static int init = 0;
int i, j, k; int i, j, k;
s->avctx = avctx;
ff_mpadsp_init(&s->mpadsp);
avctx->sample_fmt= OUT_FMT;
s->err_recognition = avctx->err_recognition;
#if FF_API_PARSE_FRAME
if (!init && !avctx->parse_only) {
#else
if (!init) {
#endif
int offset; int offset;
/* scale factors table for layer 1/2 */ /* scale factors table for layer 1/2 */
@ -306,7 +291,7 @@ static av_cold int decode_init(AVCodecContext * avctx)
scale_factor_mult[i][0] = MULLx(norm, FIXR(1.0 * 2.0), FRAC_BITS); scale_factor_mult[i][0] = MULLx(norm, FIXR(1.0 * 2.0), FRAC_BITS);
scale_factor_mult[i][1] = MULLx(norm, FIXR(0.7937005259 * 2.0), FRAC_BITS); scale_factor_mult[i][1] = MULLx(norm, FIXR(0.7937005259 * 2.0), FRAC_BITS);
scale_factor_mult[i][2] = MULLx(norm, FIXR(0.6299605249 * 2.0), FRAC_BITS); scale_factor_mult[i][2] = MULLx(norm, FIXR(0.6299605249 * 2.0), FRAC_BITS);
av_dlog(avctx, "%d: norm=%x s=%x %x %x\n", i, norm, av_dlog(NULL, "%d: norm=%x s=%x %x %x\n", i, norm,
scale_factor_mult[i][0], scale_factor_mult[i][0],
scale_factor_mult[i][1], scale_factor_mult[i][1],
scale_factor_mult[i][2]); scale_factor_mult[i][2]);
@ -411,7 +396,7 @@ static av_cold int decode_init(AVCodecContext * avctx)
k = i & 1; k = i & 1;
is_table_lsf[j][k ^ 1][i] = FIXR(f); is_table_lsf[j][k ^ 1][i] = FIXR(f);
is_table_lsf[j][k ][i] = FIXR(1.0); is_table_lsf[j][k ][i] = FIXR(1.0);
av_dlog(avctx, "is_table_lsf %d %d: %f %f\n", av_dlog(NULL, "is_table_lsf %d %d: %f %f\n",
i, j, (float) is_table_lsf[j][0][i], i, j, (float) is_table_lsf[j][0][i],
(float) is_table_lsf[j][1][i]); (float) is_table_lsf[j][1][i]);
} }
@ -473,9 +458,18 @@ static av_cold int decode_init(AVCodecContext * avctx)
mdct_win[j + 4][i + 1] = -mdct_win[j][i + 1]; mdct_win[j + 4][i + 1] = -mdct_win[j][i + 1];
} }
} }
}
init = 1; static av_cold int decode_init(AVCodecContext * avctx)
} {
MPADecodeContext *s = avctx->priv_data;
s->avctx = avctx;
ff_mpadsp_init(&s->mpadsp);
avctx->sample_fmt= OUT_FMT;
s->err_recognition = avctx->err_recognition;
if (avctx->codec_id == CODEC_ID_MP3ADU) if (avctx->codec_id == CODEC_ID_MP3ADU)
s->adu_mode = 1; s->adu_mode = 1;
@ -2002,6 +1996,7 @@ AVCodec ff_mp1_decoder = {
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP1, .id = CODEC_ID_MP1,
.priv_data_size = sizeof(MPADecodeContext), .priv_data_size = sizeof(MPADecodeContext),
.init_static_data = decode_init_static,
.init = decode_init, .init = decode_init,
.decode = decode_frame, .decode = decode_frame,
#if FF_API_PARSE_FRAME #if FF_API_PARSE_FRAME
@ -2017,6 +2012,7 @@ AVCodec ff_mp2_decoder = {
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP2, .id = CODEC_ID_MP2,
.priv_data_size = sizeof(MPADecodeContext), .priv_data_size = sizeof(MPADecodeContext),
.init_static_data = decode_init_static,
.init = decode_init, .init = decode_init,
.decode = decode_frame, .decode = decode_frame,
#if FF_API_PARSE_FRAME #if FF_API_PARSE_FRAME
@ -2032,6 +2028,7 @@ AVCodec ff_mp3_decoder = {
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP3, .id = CODEC_ID_MP3,
.priv_data_size = sizeof(MPADecodeContext), .priv_data_size = sizeof(MPADecodeContext),
.init_static_data = decode_init_static,
.init = decode_init, .init = decode_init,
.decode = decode_frame, .decode = decode_frame,
#if FF_API_PARSE_FRAME #if FF_API_PARSE_FRAME
@ -2047,6 +2044,7 @@ AVCodec ff_mp3adu_decoder = {
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP3ADU, .id = CODEC_ID_MP3ADU,
.priv_data_size = sizeof(MPADecodeContext), .priv_data_size = sizeof(MPADecodeContext),
.init_static_data = decode_init_static,
.init = decode_init, .init = decode_init,
.decode = decode_frame_adu, .decode = decode_frame_adu,
#if FF_API_PARSE_FRAME #if FF_API_PARSE_FRAME
@ -2062,6 +2060,7 @@ AVCodec ff_mp3on4_decoder = {
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP3ON4, .id = CODEC_ID_MP3ON4,
.priv_data_size = sizeof(MP3On4DecodeContext), .priv_data_size = sizeof(MP3On4DecodeContext),
.init_static_data = decode_init_static,
.init = decode_init_mp3on4, .init = decode_init_mp3on4,
.close = decode_close_mp3on4, .close = decode_close_mp3on4,
.decode = decode_frame_mp3on4, .decode = decode_frame_mp3on4,

@ -28,6 +28,7 @@ AVCodec ff_mp1float_decoder = {
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP1, .id = CODEC_ID_MP1,
.priv_data_size = sizeof(MPADecodeContext), .priv_data_size = sizeof(MPADecodeContext),
.init_static_data = decode_init_static,
.init = decode_init, .init = decode_init,
.decode = decode_frame, .decode = decode_frame,
#if FF_API_PARSE_FRAME #if FF_API_PARSE_FRAME
@ -43,6 +44,7 @@ AVCodec ff_mp2float_decoder = {
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP2, .id = CODEC_ID_MP2,
.priv_data_size = sizeof(MPADecodeContext), .priv_data_size = sizeof(MPADecodeContext),
.init_static_data = decode_init_static,
.init = decode_init, .init = decode_init,
.decode = decode_frame, .decode = decode_frame,
#if FF_API_PARSE_FRAME #if FF_API_PARSE_FRAME
@ -58,6 +60,7 @@ AVCodec ff_mp3float_decoder = {
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP3, .id = CODEC_ID_MP3,
.priv_data_size = sizeof(MPADecodeContext), .priv_data_size = sizeof(MPADecodeContext),
.init_static_data = decode_init_static,
.init = decode_init, .init = decode_init,
.decode = decode_frame, .decode = decode_frame,
#if FF_API_PARSE_FRAME #if FF_API_PARSE_FRAME
@ -73,6 +76,7 @@ AVCodec ff_mp3adufloat_decoder = {
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP3ADU, .id = CODEC_ID_MP3ADU,
.priv_data_size = sizeof(MPADecodeContext), .priv_data_size = sizeof(MPADecodeContext),
.init_static_data = decode_init_static,
.init = decode_init, .init = decode_init,
.decode = decode_frame_adu, .decode = decode_frame_adu,
#if FF_API_PARSE_FRAME #if FF_API_PARSE_FRAME
@ -88,6 +92,7 @@ AVCodec ff_mp3on4float_decoder = {
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP3ON4, .id = CODEC_ID_MP3ON4,
.priv_data_size = sizeof(MP3On4DecodeContext), .priv_data_size = sizeof(MP3On4DecodeContext),
.init_static_data = decode_init_static,
.init = decode_init_mp3on4, .init = decode_init_mp3on4,
.close = decode_close_mp3on4, .close = decode_close_mp3on4,
.decode = decode_frame_mp3on4, .decode = decode_frame_mp3on4,

Loading…
Cancel
Save