]> git.sesse.net Git - ffmpeg/commitdiff
fixing overflow in 16->8 bit conversion, patch by (Nikolai Zhubr <s001 at hotbox...
authorNikolai Zhubr <s001@hotbox.ru>
Sat, 7 Sep 2002 10:57:51 +0000 (10:57 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 7 Sep 2002 10:57:51 +0000 (10:57 +0000)
Originally committed as revision 913 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/pcm.c

index c9ae292c4bf446e6362f1b70f285b321a532c5fa..245afdea4ee7124d1461be7e6453d32d3a3117c4 100644 (file)
@@ -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;