Revision a4461664 libavcodec/pcm.c

View differences:

libavcodec/pcm.c
282 282
    case CODEC_ID_PCM_S8:
283 283
        for(;n>0;n--) {
284 284
            v = *samples++;
285
            dst[0] = v >> 8;
286
            dst++;
285
            *dst++ = v >> 8;
287 286
        }
288 287
        break;
289 288
    case CODEC_ID_PCM_U8:
290 289
        for(;n>0;n--) {
291 290
            v = *samples++;
292
            dst[0] = (v >> 8) + 128;
293
            dst++;
291
            *dst++ = (v >> 8) + 128;
294 292
        }
295 293
        break;
296 294
    case CODEC_ID_PCM_ALAW:
297 295
        for(;n>0;n--) {
298 296
            v = *samples++;
299
            dst[0] = linear_to_alaw[(v + 32768) >> 2];
300
            dst++;
297
            *dst++ = linear_to_alaw[(v + 32768) >> 2];
301 298
        }
302 299
        break;
303 300
    case CODEC_ID_PCM_MULAW:
304 301
        for(;n>0;n--) {
305 302
            v = *samples++;
306
            dst[0] = linear_to_ulaw[(v + 32768) >> 2];
307
            dst++;
303
            *dst++ = linear_to_ulaw[(v + 32768) >> 2];
308 304
        }
309 305
        break;
310 306
    default:
......
447 443
    case CODEC_ID_PCM_S8:
448 444
        n = buf_size;
449 445
        for(;n>0;n--) {
450
            *samples++ = src[0] << 8;
451
            src++;
446
            *samples++ = *src++ << 8;
452 447
        }
453 448
        break;
454 449
    case CODEC_ID_PCM_U8:
455 450
        n = buf_size;
456 451
        for(;n>0;n--) {
457
            *samples++ = ((int)src[0] - 128) << 8;
458
            src++;
452
            *samples++ = ((int)*src++ - 128) << 8;
459 453
        }
460 454
        break;
461 455
    case CODEC_ID_PCM_ALAW:
462 456
    case CODEC_ID_PCM_MULAW:
463 457
        n = buf_size;
464 458
        for(;n>0;n--) {
465
            *samples++ = s->table[src[0]];
466
            src++;
459
            *samples++ = s->table[*src++];
467 460
        }
468 461
        break;
469 462
    default:

Also available in: Unified diff