From aee481cebe8f95ce3789bdead6fb8ddfb142c37f Mon Sep 17 00:00:00 2001 From: Aurelien Jacobs Date: Sat, 11 Aug 2007 22:48:55 +0000 Subject: use av_clip_int16() where it makes sense Originally committed as revision 10078 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/dpcm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'libavcodec/dpcm.c') diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c index 6243881dee..0ce05c821a 100644 --- a/libavcodec/dpcm.c +++ b/libavcodec/dpcm.c @@ -46,8 +46,6 @@ typedef struct DPCMContext { const int *sol_table;//for SOL_DPCM } DPCMContext; -#define SATURATE_S16(x) if (x < -32768) x = -32768; \ - else if (x > 32767) x = 32767; #define SE_16BIT(x) if (x & 0x8000) x -= 0x10000; static int interplay_delta_table[] = { @@ -190,7 +188,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, /* decode the samples */ for (in = 8, out = 0; in < buf_size; in++, out++) { predictor[channel_number] += s->roq_square_array[buf[in]]; - SATURATE_S16(predictor[channel_number]); + predictor[channel_number] = av_clip_int16(predictor[channel_number]); output_samples[out] = predictor[channel_number]; /* toggle channel */ @@ -213,7 +211,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, while (in < buf_size) { predictor[channel_number] += interplay_delta_table[buf[in++]]; - SATURATE_S16(predictor[channel_number]); + predictor[channel_number] = av_clip_int16(predictor[channel_number]); output_samples[out++] = predictor[channel_number]; /* toggle channel */ @@ -248,7 +246,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, diff >>= shift[channel_number]; predictor[channel_number] += diff; - SATURATE_S16(predictor[channel_number]); + predictor[channel_number] = av_clip_int16(predictor[channel_number]); output_samples[out++] = predictor[channel_number]; /* toggle channel */ @@ -277,7 +275,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, n = buf[in++]; if (n & 0x80) s->sample[channel_number] -= s->sol_table[n & 0x7F]; else s->sample[channel_number] += s->sol_table[n & 0x7F]; - SATURATE_S16(s->sample[channel_number]); + s->sample[channel_number] = av_clip_int16(s->sample[channel_number]); output_samples[out++] = s->sample[channel_number]; /* toggle channel */ channel_number ^= s->channels - 1; -- cgit v1.2.3