X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmpegaudiodec_template.c;h=a5ac5817f34b5f8eab4df2345119171e38f6a5ec;hb=87cd8dc0b0b2293fddeb94c6c5c12a27ec3874cf;hp=1114428f33d3806b99bd048af404d3b0b55258e4;hpb=f47540523741fdc98f2467e522dc6dac0ade4a0b;p=ffmpeg diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c index 1114428f33d..a5ac5817f34 100644 --- a/libavcodec/mpegaudiodec_template.c +++ b/libavcodec/mpegaudiodec_template.c @@ -251,9 +251,9 @@ static inline int l3_unscale(int value, int exponent) if(e < 1) av_log(NULL, AV_LOG_WARNING, "l3_unscale: e is %d\n", e); #endif - if (e > 31) + if (e > (SUINT)31) return 0; - m = (m + (1 << (e - 1))) >> e; + m = (m + ((1U << e)>>1)) >> e; return m; } @@ -457,9 +457,9 @@ static av_cold int decode_init(AVCodecContext * avctx) /* 12 points IMDCT. We compute it "by hand" by factorizing obvious cases. */ -static void imdct12(INTFLOAT *out, INTFLOAT *in) +static void imdct12(INTFLOAT *out, SUINTFLOAT *in) { - INTFLOAT in0, in1, in2, in3, in4, in5, t1, t2; + SUINTFLOAT in0, in1, in2, in3, in4, in5, t1, t2; in0 = in[0*3]; in1 = in[1*3] + in[0*3]; @@ -1182,9 +1182,9 @@ found2: } while (0) #else #define AA(j) do { \ - int tmp0 = ptr[-1-j]; \ - int tmp1 = ptr[ j]; \ - int tmp2 = MULH(tmp0 + tmp1, csa_table[j][0]); \ + SUINT tmp0 = ptr[-1-j]; \ + SUINT tmp1 = ptr[ j]; \ + SUINT tmp2 = MULH(tmp0 + tmp1, csa_table[j][0]); \ ptr[-1-j] = 4 * (tmp2 - MULH(tmp1, csa_table[j][2])); \ ptr[ j] = 4 * (tmp2 + MULH(tmp0, csa_table[j][3])); \ } while (0) @@ -1665,7 +1665,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr, header = AV_RB32(buf); if (header>>8 == AV_RB32("TAG")>>8) { av_log(avctx, AV_LOG_DEBUG, "discarding ID3 tag\n"); - return buf_size; + return buf_size + skipped; } ret = avpriv_mpegaudio_decode_header((MPADecodeHeader *)s, header); if (ret < 0) { @@ -1828,6 +1828,9 @@ static av_cold int decode_close_mp3on4(AVCodecContext * avctx) MP3On4DecodeContext *s = avctx->priv_data; int i; + if (s->mp3decctx[0]) + av_freep(&s->mp3decctx[0]->fdsp); + for (i = 0; i < s->frames; i++) av_freep(&s->mp3decctx[i]);