[FFmpeg-devel] [PATCH] mpegaudio: use av_clip()
Mans Rullgard
mans
Tue May 5 19:18:41 CEST 2009
---
libavcodec/mpegaudiodec.c | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index b4d4699..4d1129f 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -752,11 +752,7 @@ static inline int round_sample(int *sum)
int sum1;
sum1 = (*sum) >> OUT_SHIFT;
*sum &= (1<<OUT_SHIFT)-1;
- if (sum1 < OUT_MIN)
- sum1 = OUT_MIN;
- else if (sum1 > OUT_MAX)
- sum1 = OUT_MAX;
- return sum1;
+ return av_clip(sum1, OUT_MIN, OUT_MAX);
}
/* signed 16x16 -> 32 multiply add accumulate */
@@ -774,11 +770,7 @@ static inline int round_sample(int64_t *sum)
int sum1;
sum1 = (int)((*sum) >> OUT_SHIFT);
*sum &= (1<<OUT_SHIFT)-1;
- if (sum1 < OUT_MIN)
- sum1 = OUT_MIN;
- else if (sum1 > OUT_MAX)
- sum1 = OUT_MAX;
- return sum1;
+ return av_clip(sum1, OUT_MIN, OUT_MAX);
}
# define MULS(ra, rb) MUL64(ra, rb)
--
1.6.2.3
More information about the ffmpeg-devel
mailing list