changeset 4960:1745d0452e87 libavcodec

Simplify ptr[0]; ptr++; to *ptr++
author ramiro
date Wed, 09 May 2007 23:32:29 +0000
parents e00e16be833a
children 3e8e345084cb
files pcm.c
diffstat 1 files changed, 7 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/pcm.c	Wed May 09 23:21:07 2007 +0000
+++ b/pcm.c	Wed May 09 23:32:29 2007 +0000
@@ -282,29 +282,25 @@
     case CODEC_ID_PCM_S8:
         for(;n>0;n--) {
             v = *samples++;
-            dst[0] = v >> 8;
-            dst++;
+            *dst++ = v >> 8;
         }
         break;
     case CODEC_ID_PCM_U8:
         for(;n>0;n--) {
             v = *samples++;
-            dst[0] = (v >> 8) + 128;
-            dst++;
+            *dst++ = (v >> 8) + 128;
         }
         break;
     case CODEC_ID_PCM_ALAW:
         for(;n>0;n--) {
             v = *samples++;
-            dst[0] = linear_to_alaw[(v + 32768) >> 2];
-            dst++;
+            *dst++ = linear_to_alaw[(v + 32768) >> 2];
         }
         break;
     case CODEC_ID_PCM_MULAW:
         for(;n>0;n--) {
             v = *samples++;
-            dst[0] = linear_to_ulaw[(v + 32768) >> 2];
-            dst++;
+            *dst++ = linear_to_ulaw[(v + 32768) >> 2];
         }
         break;
     default:
@@ -447,23 +443,20 @@
     case CODEC_ID_PCM_S8:
         n = buf_size;
         for(;n>0;n--) {
-            *samples++ = src[0] << 8;
-            src++;
+            *samples++ = *src++ << 8;
         }
         break;
     case CODEC_ID_PCM_U8:
         n = buf_size;
         for(;n>0;n--) {
-            *samples++ = ((int)src[0] - 128) << 8;
-            src++;
+            *samples++ = ((int)*src++ - 128) << 8;
         }
         break;
     case CODEC_ID_PCM_ALAW:
     case CODEC_ID_PCM_MULAW:
         n = buf_size;
         for(;n>0;n--) {
-            *samples++ = s->table[src[0]];
-            src++;
+            *samples++ = s->table[*src++];
         }
         break;
     default: