aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolai Zhubr <s001@hotbox.ru>2002-09-07 10:57:51 +0000
committerMichael Niedermayer <michaelni@gmx.at>2002-09-07 10:57:51 +0000
commit0eaec10550bd9a0682db9f7920ed0d86f1450f4b (patch)
tree1809db1164f63b897a8ec9767a646a0def0a9086
parentb2a0a7fb8a3580897f2c9d8f2d160a5acab433e4 (diff)
downloadffmpeg-0eaec10550bd9a0682db9f7920ed0d86f1450f4b.tar.gz
fixing overflow in 16->8 bit conversion, patch by (Nikolai Zhubr <s001 at hotbox dot ru>)
Originally committed as revision 913 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/pcm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index c9ae292c4b..245afdea4e 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -209,14 +209,14 @@ static int pcm_encode_frame(AVCodecContext *avctx,
case CODEC_ID_PCM_S8:
for(;n>0;n--) {
v = *samples++;
- dst[0] = (v + 128) >> 8;
+ dst[0] = v >> 8;
dst++;
}
break;
case CODEC_ID_PCM_U8:
for(;n>0;n--) {
v = *samples++;
- dst[0] = ((v + 128) >> 8) + 128;
+ dst[0] = (v >> 8) + 128;
dst++;
}
break;