summaryrefslogtreecommitdiff
path: root/libavcodec/amrnbdec.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2010-04-21 17:57:48 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2010-04-21 17:57:48 +0000
commitb1078e9fe6b5d8f034d15a6ab91430fd41921fe2 (patch)
tree5d16af4805e9567267f3f3daa96e015523f4216c /libavcodec/amrnbdec.c
parent6858ce2ffc4c57a279b22ab6d8eb56ac3884796e (diff)
Move clipping of audio samples (for those codecs outputting float) from decoder
to the audio conversion routines. Originally committed as revision 22937 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/amrnbdec.c')
-rw-r--r--libavcodec/amrnbdec.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c
index 40cd91d110..cd2d95b11b 100644
--- a/libavcodec/amrnbdec.c
+++ b/libavcodec/amrnbdec.c
@@ -796,7 +796,7 @@ static int synthesis(AMRContext *p, float *lpc,
float fixed_gain, const float *fixed_vector,
float *samples, uint8_t overflow)
{
- int i, overflow_temp = 0;
+ int i;
float excitation[AMR_SUBFRAME_SIZE];
// if an overflow has been detected, the pitch vector is scaled down by a
@@ -831,12 +831,10 @@ static int synthesis(AMRContext *p, float *lpc,
// detect overflow
for (i = 0; i < AMR_SUBFRAME_SIZE; i++)
if (fabsf(samples[i]) > AMR_SAMPLE_BOUND) {
- overflow_temp = 1;
- samples[i] = av_clipf(samples[i], -AMR_SAMPLE_BOUND,
- AMR_SAMPLE_BOUND);
+ return 1;
}
- return overflow_temp;
+ return 0;
}
/// @}
@@ -1048,10 +1046,6 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
highpass_poles, highpass_gain,
p->high_pass_mem, AMR_BLOCK_SIZE);
- for (i = 0; i < AMR_BLOCK_SIZE; i++)
- buf_out[i] = av_clipf(buf_out[i] * AMR_SAMPLE_SCALE,
- -1.0, 32767.0 / 32768.0);
-
/* Update averaged lsf vector (used for fixed gain smoothing).
*
* Note that lsf_avg should not incorporate the current frame's LSFs