comparison adpcm.c @ 1491:222643544cf1 libavcodec

New demuxers: Sega FILM/CPK, Westwood VQA & AUD; new decoders: MS RLE & Video-1, Apple RPZA, Cinepak, Westwood IMA ADPCM
author tmmm
date Wed, 01 Oct 2003 04:39:38 +0000
parents 47f4c8a5a7fc
children 3b31998fe22f
comparison
equal deleted inserted replaced
1490:0355f2b3519a 1491:222643544cf1
20 20
21 /** 21 /**
22 * @file adpcm.c 22 * @file adpcm.c
23 * ADPCM codecs. 23 * ADPCM codecs.
24 * First version by Francois Revol revol@free.fr 24 * First version by Francois Revol revol@free.fr
25 * Fringe ADPCM codecs (e.g., DK3 and DK4) 25 * Fringe ADPCM codecs (e.g., DK3, DK4, Westwood)
26 * by Mike Melanson (melanson@pcisys.net) 26 * by Mike Melanson (melanson@pcisys.net)
27 * 27 *
28 * Features and limitations: 28 * Features and limitations:
29 * 29 *
30 * Reference documents: 30 * Reference documents:
656 diff_channel = (diff_channel + c->status[1].predictor) / 2; 656 diff_channel = (diff_channel + c->status[1].predictor) / 2;
657 *samples++ = c->status[0].predictor + c->status[1].predictor; 657 *samples++ = c->status[0].predictor + c->status[1].predictor;
658 *samples++ = c->status[0].predictor - c->status[1].predictor; 658 *samples++ = c->status[0].predictor - c->status[1].predictor;
659 } 659 }
660 break; 660 break;
661 case CODEC_ID_ADPCM_IMA_WS:
662 /* no per-block initialization; just start decoding the data */
663 while (src < buf + buf_size) {
664
665 if (st) {
666 *samples++ = adpcm_ima_expand_nibble(&c->status[0],
667 (src[0] >> 4) & 0x0F);
668 *samples++ = adpcm_ima_expand_nibble(&c->status[1],
669 src[0] & 0x0F);
670 } else {
671 *samples++ = adpcm_ima_expand_nibble(&c->status[0],
672 (src[0] >> 4) & 0x0F);
673 *samples++ = adpcm_ima_expand_nibble(&c->status[0],
674 src[0] & 0x0F);
675 }
676
677 src++;
678 }
679 break;
661 default: 680 default:
662 *data_size = 0; 681 *data_size = 0;
663 return -1; 682 return -1;
664 } 683 }
665 *data_size = (uint8_t *)samples - (uint8_t *)data; 684 *data_size = (uint8_t *)samples - (uint8_t *)data;
690 709
691 ADPCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt); 710 ADPCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
692 ADPCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav); 711 ADPCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
693 ADPCM_CODEC(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3); 712 ADPCM_CODEC(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3);
694 ADPCM_CODEC(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4); 713 ADPCM_CODEC(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4);
714 ADPCM_CODEC(CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws);
695 ADPCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms); 715 ADPCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms);
696 ADPCM_CODEC(CODEC_ID_ADPCM_4XM, adpcm_4xm); 716 ADPCM_CODEC(CODEC_ID_ADPCM_4XM, adpcm_4xm);
697 717
698 #undef ADPCM_CODEC 718 #undef ADPCM_CODEC