X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fliba52.c;h=68147a125ef62610fcc7a793a17acbe8a85a06f7;hb=f55f27ba987749c3d99b10874ed62c0360d74556;hp=1fbed09d883bbc6544f621f1d94f0808eabb6873;hpb=b04f49c74c45d5908afcc4119633e2eec2a92100;p=ffmpeg diff --git a/libavcodec/liba52.c b/libavcodec/liba52.c index 1fbed09d883..68147a125ef 100644 --- a/libavcodec/liba52.c +++ b/libavcodec/liba52.c @@ -120,16 +120,7 @@ static int a52_decode_init(AVCodecContext *avctx) return 0; } -/**** the following two functions comes from a52dec */ -static inline int blah (int32_t i) -{ - if (i > 0x43c07fff) - return 32767; - else if (i < 0x43bf8000) - return -32768; - return i - 0x43c00000; -} - +/**** the following function comes from a52dec */ static inline void float_to_int (float * _f, int16_t * s16, int nchannels) { int i, j, c; @@ -139,7 +130,7 @@ static inline void float_to_int (float * _f, int16_t * s16, int nchannels) nchannels *= 256; for (i = 0; i < 256; i++) { for (c = 0; c < nchannels; c += 256) - s16[j++] = blah (f[i + c]); + s16[j++] = av_clip_int16(f[i + c] - 0x43c00000); } }