mpegaudio: use av_clip()

Originally committed as revision 18744 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Måns Rullgård 2009-05-05 18:44:07 +00:00
parent 4ee6a5c161
commit adb206c238

View File

@ -752,11 +752,7 @@ static inline int round_sample(int *sum)
int sum1; int sum1;
sum1 = (*sum) >> OUT_SHIFT; sum1 = (*sum) >> OUT_SHIFT;
*sum &= (1<<OUT_SHIFT)-1; *sum &= (1<<OUT_SHIFT)-1;
if (sum1 < OUT_MIN) return av_clip(sum1, OUT_MIN, OUT_MAX);
sum1 = OUT_MIN;
else if (sum1 > OUT_MAX)
sum1 = OUT_MAX;
return sum1;
} }
/* signed 16x16 -> 32 multiply add accumulate */ /* signed 16x16 -> 32 multiply add accumulate */
@ -774,11 +770,7 @@ static inline int round_sample(int64_t *sum)
int sum1; int sum1;
sum1 = (int)((*sum) >> OUT_SHIFT); sum1 = (int)((*sum) >> OUT_SHIFT);
*sum &= (1<<OUT_SHIFT)-1; *sum &= (1<<OUT_SHIFT)-1;
if (sum1 < OUT_MIN) return av_clip(sum1, OUT_MIN, OUT_MAX);
sum1 = OUT_MIN;
else if (sum1 > OUT_MAX)
sum1 = OUT_MAX;
return sum1;
} }
# define MULS(ra, rb) MUL64(ra, rb) # define MULS(ra, rb) MUL64(ra, rb)