Mercurial > libavcodec.hg
comparison adpcm.c @ 2795:de03cac6f7c2 libavcodec
yamaha adpcm nibbles in the wrong order fix by (Vidar Madsen: vidarino, gmail com)
author | michael |
---|---|
date | Sat, 16 Jul 2005 11:18:42 +0000 |
parents | ed1ab1566353 |
children | ef2149182f1c |
comparison
equal
deleted
inserted
replaced
2794:ed1ab1566353 | 2795:de03cac6f7c2 |
---|---|
404 case CODEC_ID_ADPCM_YAMAHA: | 404 case CODEC_ID_ADPCM_YAMAHA: |
405 n = avctx->frame_size / 2; | 405 n = avctx->frame_size / 2; |
406 for (; n>0; n--) { | 406 for (; n>0; n--) { |
407 for(i = 0; i < avctx->channels; i++) { | 407 for(i = 0; i < avctx->channels; i++) { |
408 int nibble; | 408 int nibble; |
409 nibble = adpcm_yamaha_compress_sample(&c->status[i], samples[i]) << 4; | 409 nibble = adpcm_yamaha_compress_sample(&c->status[i], samples[i]); |
410 nibble |= adpcm_yamaha_compress_sample(&c->status[i], samples[i+avctx->channels]); | 410 nibble |= adpcm_yamaha_compress_sample(&c->status[i], samples[i+avctx->channels]) << 4; |
411 *dst++ = nibble; | 411 *dst++ = nibble; |
412 } | 412 } |
413 samples += 2 * avctx->channels; | 413 samples += 2 * avctx->channels; |
414 } | 414 } |
415 break; | 415 break; |
1045 } | 1045 } |
1046 case CODEC_ID_ADPCM_YAMAHA: | 1046 case CODEC_ID_ADPCM_YAMAHA: |
1047 while (src < buf + buf_size) { | 1047 while (src < buf + buf_size) { |
1048 if (st) { | 1048 if (st) { |
1049 *samples++ = adpcm_yamaha_expand_nibble(&c->status[0], | 1049 *samples++ = adpcm_yamaha_expand_nibble(&c->status[0], |
1050 src[0] & 0x0F); | |
1051 *samples++ = adpcm_yamaha_expand_nibble(&c->status[1], | |
1050 (src[0] >> 4) & 0x0F); | 1052 (src[0] >> 4) & 0x0F); |
1051 *samples++ = adpcm_yamaha_expand_nibble(&c->status[1], | |
1052 src[0] & 0x0F); | |
1053 } else { | 1053 } else { |
1054 *samples++ = adpcm_yamaha_expand_nibble(&c->status[0], | 1054 *samples++ = adpcm_yamaha_expand_nibble(&c->status[0], |
1055 src[0] & 0x0F); | |
1056 *samples++ = adpcm_yamaha_expand_nibble(&c->status[0], | |
1055 (src[0] >> 4) & 0x0F); | 1057 (src[0] >> 4) & 0x0F); |
1056 *samples++ = adpcm_yamaha_expand_nibble(&c->status[0], | |
1057 src[0] & 0x0F); | |
1058 } | 1058 } |
1059 src++; | 1059 src++; |
1060 } | 1060 } |
1061 break; | 1061 break; |
1062 default: | 1062 default: |