changeset 649:5a8f80522cf8 libavcodec

fixing overflow in 16->8 bit conversion, patch by (Nikolai Zhubr <s001 at hotbox dot ru>)
author michaelni
date Sat, 07 Sep 2002 10:57:51 +0000
parents dddcff6841f2
children ef4a33aad86e
files pcm.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pcm.c	Sat Sep 07 00:16:30 2002 +0000
+++ b/pcm.c	Sat Sep 07 10:57:51 2002 +0000
@@ -209,14 +209,14 @@
     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;