00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "avcodec.h"
00021 #include "get_bits.h"
00022 #include "put_bits.h"
00023 #include "bytestream.h"
00024 #include "adpcm.h"
00025 #include "adpcm_data.h"
00026
00059
00060 static const int xa_adpcm_table[5][2] = {
00061 { 0, 0 },
00062 { 60, 0 },
00063 { 115, -52 },
00064 { 98, -55 },
00065 { 122, -60 }
00066 };
00067
00068 static const int ea_adpcm_table[] = {
00069 0, 240, 460, 392,
00070 0, 0, -208, -220,
00071 0, 1, 3, 4,
00072 7, 8, 10, 11,
00073 0, -1, -3, -4
00074 };
00075
00076
00077 static const int swf_index_tables[4][16] = {
00078 { -1, 2 },
00079 { -1, -1, 2, 4 },
00080 { -1, -1, -1, -1, 2, 4, 6, 8 },
00081 { -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16 }
00082 };
00083
00084
00085
00086 typedef struct ADPCMDecodeContext {
00087 AVFrame frame;
00088 ADPCMChannelStatus status[6];
00089 int vqa_version;
00090 } ADPCMDecodeContext;
00091
00092 static av_cold int adpcm_decode_init(AVCodecContext * avctx)
00093 {
00094 ADPCMDecodeContext *c = avctx->priv_data;
00095 unsigned int min_channels = 1;
00096 unsigned int max_channels = 2;
00097
00098 switch(avctx->codec->id) {
00099 case CODEC_ID_ADPCM_EA:
00100 min_channels = 2;
00101 break;
00102 case CODEC_ID_ADPCM_EA_R1:
00103 case CODEC_ID_ADPCM_EA_R2:
00104 case CODEC_ID_ADPCM_EA_R3:
00105 case CODEC_ID_ADPCM_EA_XAS:
00106 max_channels = 6;
00107 break;
00108 }
00109 if (avctx->channels < min_channels || avctx->channels > max_channels) {
00110 av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n");
00111 return AVERROR(EINVAL);
00112 }
00113
00114 switch(avctx->codec->id) {
00115 case CODEC_ID_ADPCM_CT:
00116 c->status[0].step = c->status[1].step = 511;
00117 break;
00118 case CODEC_ID_ADPCM_IMA_WAV:
00119 if (avctx->bits_per_coded_sample != 4) {
00120 av_log(avctx, AV_LOG_ERROR, "Only 4-bit ADPCM IMA WAV files are supported\n");
00121 return -1;
00122 }
00123 break;
00124 case CODEC_ID_ADPCM_IMA_APC:
00125 if (avctx->extradata && avctx->extradata_size >= 8) {
00126 c->status[0].predictor = AV_RL32(avctx->extradata);
00127 c->status[1].predictor = AV_RL32(avctx->extradata + 4);
00128 }
00129 break;
00130 case CODEC_ID_ADPCM_IMA_WS:
00131 if (avctx->extradata && avctx->extradata_size >= 42)
00132 c->vqa_version = AV_RL16(avctx->extradata);
00133 break;
00134 default:
00135 break;
00136 }
00137 avctx->sample_fmt = AV_SAMPLE_FMT_S16;
00138
00139 avcodec_get_frame_defaults(&c->frame);
00140 avctx->coded_frame = &c->frame;
00141
00142 return 0;
00143 }
00144
00145 static inline short adpcm_ima_expand_nibble(ADPCMChannelStatus *c, char nibble, int shift)
00146 {
00147 int step_index;
00148 int predictor;
00149 int sign, delta, diff, step;
00150
00151 step = ff_adpcm_step_table[c->step_index];
00152 step_index = c->step_index + ff_adpcm_index_table[(unsigned)nibble];
00153 if (step_index < 0) step_index = 0;
00154 else if (step_index > 88) step_index = 88;
00155
00156 sign = nibble & 8;
00157 delta = nibble & 7;
00158
00159
00160
00161 diff = ((2 * delta + 1) * step) >> shift;
00162 predictor = c->predictor;
00163 if (sign) predictor -= diff;
00164 else predictor += diff;
00165
00166 c->predictor = av_clip_int16(predictor);
00167 c->step_index = step_index;
00168
00169 return (short)c->predictor;
00170 }
00171
00172 static inline int adpcm_ima_qt_expand_nibble(ADPCMChannelStatus *c, int nibble, int shift)
00173 {
00174 int step_index;
00175 int predictor;
00176 int diff, step;
00177
00178 step = ff_adpcm_step_table[c->step_index];
00179 step_index = c->step_index + ff_adpcm_index_table[nibble];
00180 step_index = av_clip(step_index, 0, 88);
00181
00182 diff = step >> 3;
00183 if (nibble & 4) diff += step;
00184 if (nibble & 2) diff += step >> 1;
00185 if (nibble & 1) diff += step >> 2;
00186
00187 if (nibble & 8)
00188 predictor = c->predictor - diff;
00189 else
00190 predictor = c->predictor + diff;
00191
00192 c->predictor = av_clip_int16(predictor);
00193 c->step_index = step_index;
00194
00195 return c->predictor;
00196 }
00197
00198 static inline short adpcm_ms_expand_nibble(ADPCMChannelStatus *c, char nibble)
00199 {
00200 int predictor;
00201
00202 predictor = (((c->sample1) * (c->coeff1)) + ((c->sample2) * (c->coeff2))) / 64;
00203 predictor += (signed)((nibble & 0x08)?(nibble - 0x10):(nibble)) * c->idelta;
00204
00205 c->sample2 = c->sample1;
00206 c->sample1 = av_clip_int16(predictor);
00207 c->idelta = (ff_adpcm_AdaptationTable[(int)nibble] * c->idelta) >> 8;
00208 if (c->idelta < 16) c->idelta = 16;
00209
00210 return c->sample1;
00211 }
00212
00213 static inline short adpcm_ct_expand_nibble(ADPCMChannelStatus *c, char nibble)
00214 {
00215 int sign, delta, diff;
00216 int new_step;
00217
00218 sign = nibble & 8;
00219 delta = nibble & 7;
00220
00221
00222
00223 diff = ((2 * delta + 1) * c->step) >> 3;
00224
00225 c->predictor = ((c->predictor * 254) >> 8) + (sign ? -diff : diff);
00226 c->predictor = av_clip_int16(c->predictor);
00227
00228 new_step = (ff_adpcm_AdaptationTable[nibble & 7] * c->step) >> 8;
00229 c->step = av_clip(new_step, 511, 32767);
00230
00231 return (short)c->predictor;
00232 }
00233
00234 static inline short adpcm_sbpro_expand_nibble(ADPCMChannelStatus *c, char nibble, int size, int shift)
00235 {
00236 int sign, delta, diff;
00237
00238 sign = nibble & (1<<(size-1));
00239 delta = nibble & ((1<<(size-1))-1);
00240 diff = delta << (7 + c->step + shift);
00241
00242
00243 c->predictor = av_clip(c->predictor + (sign ? -diff : diff), -16384,16256);
00244
00245
00246 if (delta >= (2*size - 3) && c->step < 3)
00247 c->step++;
00248 else if (delta == 0 && c->step > 0)
00249 c->step--;
00250
00251 return (short) c->predictor;
00252 }
00253
00254 static inline short adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, unsigned char nibble)
00255 {
00256 if(!c->step) {
00257 c->predictor = 0;
00258 c->step = 127;
00259 }
00260
00261 c->predictor += (c->step * ff_adpcm_yamaha_difflookup[nibble]) / 8;
00262 c->predictor = av_clip_int16(c->predictor);
00263 c->step = (c->step * ff_adpcm_yamaha_indexscale[nibble]) >> 8;
00264 c->step = av_clip(c->step, 127, 24567);
00265 return c->predictor;
00266 }
00267
00268 static int xa_decode(AVCodecContext *avctx,
00269 short *out, const unsigned char *in,
00270 ADPCMChannelStatus *left, ADPCMChannelStatus *right, int inc)
00271 {
00272 int i, j;
00273 int shift,filter,f0,f1;
00274 int s_1,s_2;
00275 int d,s,t;
00276
00277 for(i=0;i<4;i++) {
00278
00279 shift = 12 - (in[4+i*2] & 15);
00280 filter = in[4+i*2] >> 4;
00281 if (filter > 4) {
00282 av_log(avctx, AV_LOG_ERROR,
00283 "Invalid XA-ADPCM filter %d (max. allowed is 4)\n",
00284 filter);
00285 return AVERROR_INVALIDDATA;
00286 }
00287 f0 = xa_adpcm_table[filter][0];
00288 f1 = xa_adpcm_table[filter][1];
00289
00290 s_1 = left->sample1;
00291 s_2 = left->sample2;
00292
00293 for(j=0;j<28;j++) {
00294 d = in[16+i+j*4];
00295
00296 t = (signed char)(d<<4)>>4;
00297 s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
00298 s_2 = s_1;
00299 s_1 = av_clip_int16(s);
00300 *out = s_1;
00301 out += inc;
00302 }
00303
00304 if (inc==2) {
00305 left->sample1 = s_1;
00306 left->sample2 = s_2;
00307 s_1 = right->sample1;
00308 s_2 = right->sample2;
00309 out = out + 1 - 28*2;
00310 }
00311
00312 shift = 12 - (in[5+i*2] & 15);
00313 filter = in[5+i*2] >> 4;
00314 if (filter > 4) {
00315 av_log(avctx, AV_LOG_ERROR,
00316 "Invalid XA-ADPCM filter %d (max. allowed is 4)\n",
00317 filter);
00318 return AVERROR_INVALIDDATA;
00319 }
00320 f0 = xa_adpcm_table[filter][0];
00321 f1 = xa_adpcm_table[filter][1];
00322
00323 for(j=0;j<28;j++) {
00324 d = in[16+i+j*4];
00325
00326 t = (signed char)d >> 4;
00327 s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
00328 s_2 = s_1;
00329 s_1 = av_clip_int16(s);
00330 *out = s_1;
00331 out += inc;
00332 }
00333
00334 if (inc==2) {
00335 right->sample1 = s_1;
00336 right->sample2 = s_2;
00337 out -= 1;
00338 } else {
00339 left->sample1 = s_1;
00340 left->sample2 = s_2;
00341 }
00342 }
00343
00344 return 0;
00345 }
00346
00356 static int get_nb_samples(AVCodecContext *avctx, const uint8_t *buf,
00357 int buf_size, int *coded_samples)
00358 {
00359 ADPCMDecodeContext *s = avctx->priv_data;
00360 int nb_samples = 0;
00361 int ch = avctx->channels;
00362 int has_coded_samples = 0;
00363 int header_size;
00364
00365 *coded_samples = 0;
00366
00367 if(ch <= 0)
00368 return 0;
00369
00370 switch (avctx->codec->id) {
00371
00372 case CODEC_ID_ADPCM_EA_XAS:
00373 if (buf_size < 76 * ch)
00374 return 0;
00375 nb_samples = 128;
00376 break;
00377 case CODEC_ID_ADPCM_IMA_QT:
00378 if (buf_size < 34 * ch)
00379 return 0;
00380 nb_samples = 64;
00381 break;
00382
00383 case CODEC_ID_ADPCM_CT:
00384 case CODEC_ID_ADPCM_IMA_APC:
00385 case CODEC_ID_ADPCM_IMA_EA_SEAD:
00386 case CODEC_ID_ADPCM_IMA_WS:
00387 case CODEC_ID_ADPCM_YAMAHA:
00388 nb_samples = buf_size * 2 / ch;
00389 break;
00390 }
00391 if (nb_samples)
00392 return nb_samples;
00393
00394
00395 header_size = 0;
00396 switch (avctx->codec->id) {
00397 case CODEC_ID_ADPCM_4XM:
00398 case CODEC_ID_ADPCM_IMA_ISS: header_size = 4 * ch; break;
00399 case CODEC_ID_ADPCM_IMA_AMV: header_size = 8; break;
00400 case CODEC_ID_ADPCM_IMA_SMJPEG: header_size = 4; break;
00401 }
00402 if (header_size > 0)
00403 return (buf_size - header_size) * 2 / ch;
00404
00405
00406 switch (avctx->codec->id) {
00407 case CODEC_ID_ADPCM_EA:
00408 has_coded_samples = 1;
00409 if (buf_size < 4)
00410 return 0;
00411 *coded_samples = AV_RL32(buf);
00412 *coded_samples -= *coded_samples % 28;
00413 nb_samples = (buf_size - 12) / 30 * 28;
00414 break;
00415 case CODEC_ID_ADPCM_IMA_EA_EACS:
00416 has_coded_samples = 1;
00417 if (buf_size < 4)
00418 return 0;
00419 *coded_samples = AV_RL32(buf);
00420 nb_samples = (buf_size - (4 + 8 * ch)) * 2 / ch;
00421 break;
00422 case CODEC_ID_ADPCM_EA_MAXIS_XA:
00423 nb_samples = ((buf_size - ch) / (2 * ch)) * 2 * ch;
00424 break;
00425 case CODEC_ID_ADPCM_EA_R1:
00426 case CODEC_ID_ADPCM_EA_R2:
00427 case CODEC_ID_ADPCM_EA_R3:
00428
00429
00430 has_coded_samples = 1;
00431 if (buf_size < 4)
00432 return 0;
00433 switch (avctx->codec->id) {
00434 case CODEC_ID_ADPCM_EA_R1:
00435 header_size = 4 + 9 * ch;
00436 *coded_samples = AV_RL32(buf);
00437 break;
00438 case CODEC_ID_ADPCM_EA_R2:
00439 header_size = 4 + 5 * ch;
00440 *coded_samples = AV_RL32(buf);
00441 break;
00442 case CODEC_ID_ADPCM_EA_R3:
00443 header_size = 4 + 5 * ch;
00444 *coded_samples = AV_RB32(buf);
00445 break;
00446 }
00447 *coded_samples -= *coded_samples % 28;
00448 nb_samples = (buf_size - header_size) * 2 / ch;
00449 nb_samples -= nb_samples % 28;
00450 break;
00451 case CODEC_ID_ADPCM_IMA_DK3:
00452 if (avctx->block_align > 0)
00453 buf_size = FFMIN(buf_size, avctx->block_align);
00454 nb_samples = ((buf_size - 16) * 8 / 3) / ch;
00455 break;
00456 case CODEC_ID_ADPCM_IMA_DK4:
00457 nb_samples = 1 + (buf_size - 4 * ch) * 2 / ch;
00458 break;
00459 case CODEC_ID_ADPCM_IMA_WAV:
00460 if (avctx->block_align > 0)
00461 buf_size = FFMIN(buf_size, avctx->block_align);
00462 nb_samples = 1 + (buf_size - 4 * ch) / (4 * ch) * 8;
00463 break;
00464 case CODEC_ID_ADPCM_MS:
00465 if (avctx->block_align > 0)
00466 buf_size = FFMIN(buf_size, avctx->block_align);
00467 nb_samples = 2 + (buf_size - 7 * ch) * 2 / ch;
00468 break;
00469 case CODEC_ID_ADPCM_SBPRO_2:
00470 case CODEC_ID_ADPCM_SBPRO_3:
00471 case CODEC_ID_ADPCM_SBPRO_4:
00472 {
00473 int samples_per_byte;
00474 switch (avctx->codec->id) {
00475 case CODEC_ID_ADPCM_SBPRO_2: samples_per_byte = 4; break;
00476 case CODEC_ID_ADPCM_SBPRO_3: samples_per_byte = 3; break;
00477 case CODEC_ID_ADPCM_SBPRO_4: samples_per_byte = 2; break;
00478 }
00479 if (!s->status[0].step_index) {
00480 nb_samples++;
00481 buf_size -= ch;
00482 }
00483 nb_samples += buf_size * samples_per_byte / ch;
00484 break;
00485 }
00486 case CODEC_ID_ADPCM_SWF:
00487 {
00488 int buf_bits = buf_size * 8 - 2;
00489 int nbits = (buf[0] >> 6) + 2;
00490 int block_hdr_size = 22 * ch;
00491 int block_size = block_hdr_size + nbits * ch * 4095;
00492 int nblocks = buf_bits / block_size;
00493 int bits_left = buf_bits - nblocks * block_size;
00494 nb_samples = nblocks * 4096;
00495 if (bits_left >= block_hdr_size)
00496 nb_samples += 1 + (bits_left - block_hdr_size) / (nbits * ch);
00497 break;
00498 }
00499 case CODEC_ID_ADPCM_THP:
00500 has_coded_samples = 1;
00501 if (buf_size < 8)
00502 return 0;
00503 *coded_samples = AV_RB32(&buf[4]);
00504 *coded_samples -= *coded_samples % 14;
00505 nb_samples = (buf_size - 80) / (8 * ch) * 14;
00506 break;
00507 case CODEC_ID_ADPCM_XA:
00508 nb_samples = (buf_size / 128) * 224 / ch;
00509 break;
00510 }
00511
00512
00513 if (has_coded_samples && (*coded_samples <= 0 || *coded_samples > nb_samples))
00514 return AVERROR_INVALIDDATA;
00515
00516 return nb_samples;
00517 }
00518
00519
00520 #define DK3_GET_NEXT_NIBBLE() \
00521 if (decode_top_nibble_next) \
00522 { \
00523 nibble = last_byte >> 4; \
00524 decode_top_nibble_next = 0; \
00525 } \
00526 else \
00527 { \
00528 if (end_of_packet) \
00529 break; \
00530 last_byte = *src++; \
00531 if (src >= buf + buf_size) \
00532 end_of_packet = 1; \
00533 nibble = last_byte & 0x0F; \
00534 decode_top_nibble_next = 1; \
00535 }
00536
00537 static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
00538 int *got_frame_ptr, AVPacket *avpkt)
00539 {
00540 const uint8_t *buf = avpkt->data;
00541 int buf_size = avpkt->size;
00542 ADPCMDecodeContext *c = avctx->priv_data;
00543 ADPCMChannelStatus *cs;
00544 int n, m, channel, i;
00545 short *samples;
00546 const uint8_t *src;
00547 int st;
00548 int count1, count2;
00549 int nb_samples, coded_samples, ret;
00550
00551 nb_samples = get_nb_samples(avctx, buf, buf_size, &coded_samples);
00552 if (nb_samples <= 0) {
00553 av_log(avctx, AV_LOG_ERROR, "invalid number of samples in packet\n");
00554 return AVERROR_INVALIDDATA;
00555 }
00556
00557
00558 c->frame.nb_samples = nb_samples;
00559 if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) {
00560 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
00561 return ret;
00562 }
00563 samples = (short *)c->frame.data[0];
00564
00565
00566
00567 if (coded_samples) {
00568 if (coded_samples != nb_samples)
00569 av_log(avctx, AV_LOG_WARNING, "mismatch in coded sample count\n");
00570 c->frame.nb_samples = nb_samples = coded_samples;
00571 }
00572
00573 src = buf;
00574
00575 st = avctx->channels == 2 ? 1 : 0;
00576
00577 switch(avctx->codec->id) {
00578 case CODEC_ID_ADPCM_IMA_QT:
00579
00580
00581 for (channel = 0; channel < avctx->channels; channel++) {
00582 int16_t predictor;
00583 int step_index;
00584 cs = &(c->status[channel]);
00585
00586
00587
00588 predictor = AV_RB16(src);
00589 step_index = predictor & 0x7F;
00590 predictor &= 0xFF80;
00591
00592 src += 2;
00593
00594 if (cs->step_index == step_index) {
00595 int diff = (int)predictor - cs->predictor;
00596 if (diff < 0)
00597 diff = - diff;
00598 if (diff > 0x7f)
00599 goto update;
00600 } else {
00601 update:
00602 cs->step_index = step_index;
00603 cs->predictor = predictor;
00604 }
00605
00606 if (cs->step_index > 88){
00607 av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
00608 cs->step_index = 88;
00609 }
00610
00611 samples = (short *)c->frame.data[0] + channel;
00612
00613 for (m = 0; m < 32; m++) {
00614 *samples = adpcm_ima_qt_expand_nibble(cs, src[0] & 0x0F, 3);
00615 samples += avctx->channels;
00616 *samples = adpcm_ima_qt_expand_nibble(cs, src[0] >> 4 , 3);
00617 samples += avctx->channels;
00618 src ++;
00619 }
00620 }
00621 break;
00622 case CODEC_ID_ADPCM_IMA_WAV:
00623 if (avctx->block_align != 0 && buf_size > avctx->block_align)
00624 buf_size = avctx->block_align;
00625
00626 for(i=0; i<avctx->channels; i++){
00627 cs = &(c->status[i]);
00628 cs->predictor = *samples++ = (int16_t)bytestream_get_le16(&src);
00629
00630 cs->step_index = *src++;
00631 if (cs->step_index > 88){
00632 av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
00633 cs->step_index = 88;
00634 }
00635 if (*src++) av_log(avctx, AV_LOG_ERROR, "unused byte should be null but is %d!!\n", src[-1]);
00636 }
00637
00638 for (n = (nb_samples - 1) / 8; n > 0; n--) {
00639 for (i = 0; i < avctx->channels; i++) {
00640 cs = &c->status[i];
00641 for (m = 0; m < 4; m++) {
00642 uint8_t v = *src++;
00643 *samples = adpcm_ima_expand_nibble(cs, v & 0x0F, 3);
00644 samples += avctx->channels;
00645 *samples = adpcm_ima_expand_nibble(cs, v >> 4 , 3);
00646 samples += avctx->channels;
00647 }
00648 samples -= 8 * avctx->channels - 1;
00649 }
00650 samples += 7 * avctx->channels;
00651 }
00652 break;
00653 case CODEC_ID_ADPCM_4XM:
00654 for (i = 0; i < avctx->channels; i++)
00655 c->status[i].predictor= (int16_t)bytestream_get_le16(&src);
00656
00657 for (i = 0; i < avctx->channels; i++) {
00658 c->status[i].step_index= (int16_t)bytestream_get_le16(&src);
00659 c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88);
00660 }
00661
00662 for (i = 0; i < avctx->channels; i++) {
00663 samples = (short *)c->frame.data[0] + i;
00664 cs = &c->status[i];
00665 for (n = nb_samples >> 1; n > 0; n--, src++) {
00666 uint8_t v = *src;
00667 *samples = adpcm_ima_expand_nibble(cs, v & 0x0F, 4);
00668 samples += avctx->channels;
00669 *samples = adpcm_ima_expand_nibble(cs, v >> 4 , 4);
00670 samples += avctx->channels;
00671 }
00672 }
00673 break;
00674 case CODEC_ID_ADPCM_MS:
00675 {
00676 int block_predictor;
00677
00678 if (avctx->block_align != 0 && buf_size > avctx->block_align)
00679 buf_size = avctx->block_align;
00680
00681 block_predictor = av_clip(*src++, 0, 6);
00682 c->status[0].coeff1 = ff_adpcm_AdaptCoeff1[block_predictor];
00683 c->status[0].coeff2 = ff_adpcm_AdaptCoeff2[block_predictor];
00684 if (st) {
00685 block_predictor = av_clip(*src++, 0, 6);
00686 c->status[1].coeff1 = ff_adpcm_AdaptCoeff1[block_predictor];
00687 c->status[1].coeff2 = ff_adpcm_AdaptCoeff2[block_predictor];
00688 }
00689 c->status[0].idelta = (int16_t)bytestream_get_le16(&src);
00690 if (st){
00691 c->status[1].idelta = (int16_t)bytestream_get_le16(&src);
00692 }
00693
00694 c->status[0].sample1 = bytestream_get_le16(&src);
00695 if (st) c->status[1].sample1 = bytestream_get_le16(&src);
00696 c->status[0].sample2 = bytestream_get_le16(&src);
00697 if (st) c->status[1].sample2 = bytestream_get_le16(&src);
00698
00699 *samples++ = c->status[0].sample2;
00700 if (st) *samples++ = c->status[1].sample2;
00701 *samples++ = c->status[0].sample1;
00702 if (st) *samples++ = c->status[1].sample1;
00703 for(n = (nb_samples - 2) >> (1 - st); n > 0; n--, src++) {
00704 *samples++ = adpcm_ms_expand_nibble(&c->status[0 ], src[0] >> 4 );
00705 *samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F);
00706 }
00707 break;
00708 }
00709 case CODEC_ID_ADPCM_IMA_DK4:
00710 if (avctx->block_align != 0 && buf_size > avctx->block_align)
00711 buf_size = avctx->block_align;
00712
00713 for (channel = 0; channel < avctx->channels; channel++) {
00714 cs = &c->status[channel];
00715 cs->predictor = (int16_t)bytestream_get_le16(&src);
00716 cs->step_index = av_clip(*src++, 0, 88);
00717 src++;
00718 *samples++ = cs->predictor;
00719 }
00720 for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
00721 uint8_t v = *src;
00722 *samples++ = adpcm_ima_expand_nibble(&c->status[0 ], v >> 4 , 3);
00723 *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3);
00724 }
00725 break;
00726 case CODEC_ID_ADPCM_IMA_DK3:
00727 {
00728 unsigned char last_byte = 0;
00729 unsigned char nibble;
00730 int decode_top_nibble_next = 0;
00731 int end_of_packet = 0;
00732 int diff_channel;
00733
00734 if (avctx->block_align != 0 && buf_size > avctx->block_align)
00735 buf_size = avctx->block_align;
00736
00737 c->status[0].predictor = (int16_t)AV_RL16(src + 10);
00738 c->status[1].predictor = (int16_t)AV_RL16(src + 12);
00739 c->status[0].step_index = av_clip(src[14], 0, 88);
00740 c->status[1].step_index = av_clip(src[15], 0, 88);
00741
00742 src += 16;
00743 diff_channel = c->status[1].predictor;
00744
00745
00746
00747 while (1) {
00748
00749
00750
00751
00752
00753 DK3_GET_NEXT_NIBBLE();
00754 adpcm_ima_expand_nibble(&c->status[0], nibble, 3);
00755
00756
00757 DK3_GET_NEXT_NIBBLE();
00758 adpcm_ima_expand_nibble(&c->status[1], nibble, 3);
00759
00760
00761 diff_channel = (diff_channel + c->status[1].predictor) / 2;
00762 *samples++ = c->status[0].predictor + c->status[1].predictor;
00763 *samples++ = c->status[0].predictor - c->status[1].predictor;
00764
00765
00766 DK3_GET_NEXT_NIBBLE();
00767 adpcm_ima_expand_nibble(&c->status[0], nibble, 3);
00768
00769
00770 diff_channel = (diff_channel + c->status[1].predictor) / 2;
00771 *samples++ = c->status[0].predictor + c->status[1].predictor;
00772 *samples++ = c->status[0].predictor - c->status[1].predictor;
00773 }
00774 break;
00775 }
00776 case CODEC_ID_ADPCM_IMA_ISS:
00777 for (channel = 0; channel < avctx->channels; channel++) {
00778 cs = &c->status[channel];
00779 cs->predictor = (int16_t)bytestream_get_le16(&src);
00780 cs->step_index = av_clip(*src++, 0, 88);
00781 src++;
00782 }
00783
00784 for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
00785 uint8_t v1, v2;
00786 uint8_t v = *src;
00787
00788 if (st) {
00789 v1 = v >> 4;
00790 v2 = v & 0x0F;
00791 } else {
00792 v2 = v >> 4;
00793 v1 = v & 0x0F;
00794 }
00795 *samples++ = adpcm_ima_expand_nibble(&c->status[0 ], v1, 3);
00796 *samples++ = adpcm_ima_expand_nibble(&c->status[st], v2, 3);
00797 }
00798 break;
00799 case CODEC_ID_ADPCM_IMA_APC:
00800 while (src < buf + buf_size) {
00801 uint8_t v = *src++;
00802 *samples++ = adpcm_ima_expand_nibble(&c->status[0], v >> 4 , 3);
00803 *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3);
00804 }
00805 break;
00806 case CODEC_ID_ADPCM_IMA_WS:
00807 for (channel = 0; channel < avctx->channels; channel++) {
00808 const uint8_t *src0;
00809 int src_stride;
00810 int16_t *smp = samples + channel;
00811
00812 if (c->vqa_version == 3) {
00813 src0 = src + channel * buf_size / 2;
00814 src_stride = 1;
00815 } else {
00816 src0 = src + channel;
00817 src_stride = avctx->channels;
00818 }
00819 for (n = nb_samples / 2; n > 0; n--) {
00820 uint8_t v = *src0;
00821 src0 += src_stride;
00822 *smp = adpcm_ima_expand_nibble(&c->status[channel], v >> 4 , 3);
00823 smp += avctx->channels;
00824 *smp = adpcm_ima_expand_nibble(&c->status[channel], v & 0x0F, 3);
00825 smp += avctx->channels;
00826 }
00827 }
00828 src = buf + buf_size;
00829 break;
00830 case CODEC_ID_ADPCM_XA:
00831 while (buf_size >= 128) {
00832 if ((ret = xa_decode(avctx, samples, src, &c->status[0],
00833 &c->status[1], avctx->channels)) < 0)
00834 return ret;
00835 src += 128;
00836 samples += 28 * 8;
00837 buf_size -= 128;
00838 }
00839 break;
00840 case CODEC_ID_ADPCM_IMA_EA_EACS:
00841 src += 4;
00842
00843 for (i=0; i<=st; i++)
00844 c->status[i].step_index = av_clip(bytestream_get_le32(&src), 0, 88);
00845 for (i=0; i<=st; i++)
00846 c->status[i].predictor = bytestream_get_le32(&src);
00847
00848 for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
00849 *samples++ = adpcm_ima_expand_nibble(&c->status[0], *src>>4, 3);
00850 *samples++ = adpcm_ima_expand_nibble(&c->status[st], *src&0x0F, 3);
00851 }
00852 break;
00853 case CODEC_ID_ADPCM_IMA_EA_SEAD:
00854 for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
00855 *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] >> 4, 6);
00856 *samples++ = adpcm_ima_expand_nibble(&c->status[st],src[0]&0x0F, 6);
00857 }
00858 break;
00859 case CODEC_ID_ADPCM_EA:
00860 {
00861 int32_t previous_left_sample, previous_right_sample;
00862 int32_t current_left_sample, current_right_sample;
00863 int32_t next_left_sample, next_right_sample;
00864 int32_t coeff1l, coeff2l, coeff1r, coeff2r;
00865 uint8_t shift_left, shift_right;
00866
00867
00868
00869
00870 if(avctx->channels != 2)
00871 return AVERROR_INVALIDDATA;
00872
00873 src += 4;
00874
00875 current_left_sample = (int16_t)bytestream_get_le16(&src);
00876 previous_left_sample = (int16_t)bytestream_get_le16(&src);
00877 current_right_sample = (int16_t)bytestream_get_le16(&src);
00878 previous_right_sample = (int16_t)bytestream_get_le16(&src);
00879
00880 for (count1 = 0; count1 < nb_samples / 28; count1++) {
00881 coeff1l = ea_adpcm_table[ *src >> 4 ];
00882 coeff2l = ea_adpcm_table[(*src >> 4 ) + 4];
00883 coeff1r = ea_adpcm_table[*src & 0x0F];
00884 coeff2r = ea_adpcm_table[(*src & 0x0F) + 4];
00885 src++;
00886
00887 shift_left = 20 - (*src >> 4);
00888 shift_right = 20 - (*src & 0x0F);
00889 src++;
00890
00891 for (count2 = 0; count2 < 28; count2++) {
00892 next_left_sample = sign_extend(*src >> 4, 4) << shift_left;
00893 next_right_sample = sign_extend(*src, 4) << shift_right;
00894 src++;
00895
00896 next_left_sample = (next_left_sample +
00897 (current_left_sample * coeff1l) +
00898 (previous_left_sample * coeff2l) + 0x80) >> 8;
00899 next_right_sample = (next_right_sample +
00900 (current_right_sample * coeff1r) +
00901 (previous_right_sample * coeff2r) + 0x80) >> 8;
00902
00903 previous_left_sample = current_left_sample;
00904 current_left_sample = av_clip_int16(next_left_sample);
00905 previous_right_sample = current_right_sample;
00906 current_right_sample = av_clip_int16(next_right_sample);
00907 *samples++ = (unsigned short)current_left_sample;
00908 *samples++ = (unsigned short)current_right_sample;
00909 }
00910 }
00911
00912 if (src - buf == buf_size - 2)
00913 src += 2;
00914
00915 break;
00916 }
00917 case CODEC_ID_ADPCM_EA_MAXIS_XA:
00918 {
00919 int coeff[2][2], shift[2];
00920
00921 for(channel = 0; channel < avctx->channels; channel++) {
00922 for (i=0; i<2; i++)
00923 coeff[channel][i] = ea_adpcm_table[(*src >> 4) + 4*i];
00924 shift[channel] = 20 - (*src & 0x0F);
00925 src++;
00926 }
00927 for (count1 = 0; count1 < nb_samples / 2; count1++) {
00928 for(i = 4; i >= 0; i-=4) {
00929 for(channel = 0; channel < avctx->channels; channel++) {
00930 int32_t sample = sign_extend(src[channel] >> i, 4) << shift[channel];
00931 sample = (sample +
00932 c->status[channel].sample1 * coeff[channel][0] +
00933 c->status[channel].sample2 * coeff[channel][1] + 0x80) >> 8;
00934 c->status[channel].sample2 = c->status[channel].sample1;
00935 c->status[channel].sample1 = av_clip_int16(sample);
00936 *samples++ = c->status[channel].sample1;
00937 }
00938 }
00939 src+=avctx->channels;
00940 }
00941
00942 src = buf + buf_size;
00943 break;
00944 }
00945 case CODEC_ID_ADPCM_EA_R1:
00946 case CODEC_ID_ADPCM_EA_R2:
00947 case CODEC_ID_ADPCM_EA_R3: {
00948
00949
00950
00951
00952 const int big_endian = avctx->codec->id == CODEC_ID_ADPCM_EA_R3;
00953 int32_t previous_sample, current_sample, next_sample;
00954 int32_t coeff1, coeff2;
00955 uint8_t shift;
00956 unsigned int channel;
00957 uint16_t *samplesC;
00958 const uint8_t *srcC;
00959 const uint8_t *src_end = buf + buf_size;
00960 int count = 0;
00961
00962 src += 4;
00963
00964 for (channel=0; channel<avctx->channels; channel++) {
00965 int32_t offset = (big_endian ? bytestream_get_be32(&src)
00966 : bytestream_get_le32(&src))
00967 + (avctx->channels-channel-1) * 4;
00968
00969 if ((offset < 0) || (offset >= src_end - src - 4)) break;
00970 srcC = src + offset;
00971 samplesC = samples + channel;
00972
00973 if (avctx->codec->id == CODEC_ID_ADPCM_EA_R1) {
00974 current_sample = (int16_t)bytestream_get_le16(&srcC);
00975 previous_sample = (int16_t)bytestream_get_le16(&srcC);
00976 } else {
00977 current_sample = c->status[channel].predictor;
00978 previous_sample = c->status[channel].prev_sample;
00979 }
00980
00981 for (count1 = 0; count1 < nb_samples / 28; count1++) {
00982 if (*srcC == 0xEE) {
00983 srcC++;
00984 if (srcC > src_end - 30*2) break;
00985 current_sample = (int16_t)bytestream_get_be16(&srcC);
00986 previous_sample = (int16_t)bytestream_get_be16(&srcC);
00987
00988 for (count2=0; count2<28; count2++) {
00989 *samplesC = (int16_t)bytestream_get_be16(&srcC);
00990 samplesC += avctx->channels;
00991 }
00992 } else {
00993 coeff1 = ea_adpcm_table[ *srcC>>4 ];
00994 coeff2 = ea_adpcm_table[(*srcC>>4) + 4];
00995 shift = 20 - (*srcC++ & 0x0F);
00996
00997 if (srcC > src_end - 14) break;
00998 for (count2=0; count2<28; count2++) {
00999 if (count2 & 1)
01000 next_sample = sign_extend(*srcC++, 4) << shift;
01001 else
01002 next_sample = sign_extend(*srcC >> 4, 4) << shift;
01003
01004 next_sample += (current_sample * coeff1) +
01005 (previous_sample * coeff2);
01006 next_sample = av_clip_int16(next_sample >> 8);
01007
01008 previous_sample = current_sample;
01009 current_sample = next_sample;
01010 *samplesC = current_sample;
01011 samplesC += avctx->channels;
01012 }
01013 }
01014 }
01015 if (!count) {
01016 count = count1;
01017 } else if (count != count1) {
01018 av_log(avctx, AV_LOG_WARNING, "per-channel sample count mismatch\n");
01019 count = FFMAX(count, count1);
01020 }
01021
01022 if (avctx->codec->id != CODEC_ID_ADPCM_EA_R1) {
01023 c->status[channel].predictor = current_sample;
01024 c->status[channel].prev_sample = previous_sample;
01025 }
01026 }
01027
01028 c->frame.nb_samples = count * 28;
01029 src = src_end;
01030 break;
01031 }
01032 case CODEC_ID_ADPCM_EA_XAS:
01033 for (channel=0; channel<avctx->channels; channel++) {
01034 int coeff[2][4], shift[4];
01035 short *s2, *s = &samples[channel];
01036 for (n=0; n<4; n++, s+=32*avctx->channels) {
01037 for (i=0; i<2; i++)
01038 coeff[i][n] = ea_adpcm_table[(src[0]&0x0F)+4*i];
01039 shift[n] = 20 - (src[2] & 0x0F);
01040 for (s2=s, i=0; i<2; i++, src+=2, s2+=avctx->channels)
01041 s2[0] = (src[0]&0xF0) + (src[1]<<8);
01042 }
01043
01044 for (m=2; m<32; m+=2) {
01045 s = &samples[m*avctx->channels + channel];
01046 for (n=0; n<4; n++, src++, s+=32*avctx->channels) {
01047 for (s2=s, i=0; i<8; i+=4, s2+=avctx->channels) {
01048 int level = sign_extend(*src >> (4 - i), 4) << shift[n];
01049 int pred = s2[-1*avctx->channels] * coeff[0][n]
01050 + s2[-2*avctx->channels] * coeff[1][n];
01051 s2[0] = av_clip_int16((level + pred + 0x80) >> 8);
01052 }
01053 }
01054 }
01055 }
01056 break;
01057 case CODEC_ID_ADPCM_IMA_AMV:
01058 case CODEC_ID_ADPCM_IMA_SMJPEG:
01059 if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV) {
01060 c->status[0].predictor = sign_extend(bytestream_get_le16(&src), 16);
01061 c->status[0].step_index = av_clip(bytestream_get_le16(&src), 0, 88);
01062 src += 4;
01063 } else {
01064 c->status[0].predictor = sign_extend(bytestream_get_be16(&src), 16);
01065 c->status[0].step_index = av_clip(bytestream_get_byte(&src), 0, 88);
01066 src += 1;
01067 }
01068
01069 for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
01070 char hi, lo;
01071 lo = *src & 0x0F;
01072 hi = *src >> 4;
01073
01074 if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV)
01075 FFSWAP(char, hi, lo);
01076
01077 *samples++ = adpcm_ima_expand_nibble(&c->status[0],
01078 lo, 3);
01079 *samples++ = adpcm_ima_expand_nibble(&c->status[0],
01080 hi, 3);
01081 }
01082 break;
01083 case CODEC_ID_ADPCM_CT:
01084 for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
01085 uint8_t v = *src;
01086 *samples++ = adpcm_ct_expand_nibble(&c->status[0 ], v >> 4 );
01087 *samples++ = adpcm_ct_expand_nibble(&c->status[st], v & 0x0F);
01088 }
01089 break;
01090 case CODEC_ID_ADPCM_SBPRO_4:
01091 case CODEC_ID_ADPCM_SBPRO_3:
01092 case CODEC_ID_ADPCM_SBPRO_2:
01093 if (!c->status[0].step_index) {
01094
01095 *samples++ = 128 * (*src++ - 0x80);
01096 if (st)
01097 *samples++ = 128 * (*src++ - 0x80);
01098 c->status[0].step_index = 1;
01099 nb_samples--;
01100 }
01101 if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_4) {
01102 for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
01103 *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
01104 src[0] >> 4, 4, 0);
01105 *samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
01106 src[0] & 0x0F, 4, 0);
01107 }
01108 } else if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_3) {
01109 for (n = nb_samples / 3; n > 0; n--, src++) {
01110 *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
01111 src[0] >> 5 , 3, 0);
01112 *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
01113 (src[0] >> 2) & 0x07, 3, 0);
01114 *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
01115 src[0] & 0x03, 2, 0);
01116 }
01117 } else {
01118 for (n = nb_samples >> (2 - st); n > 0; n--, src++) {
01119 *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
01120 src[0] >> 6 , 2, 2);
01121 *samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
01122 (src[0] >> 4) & 0x03, 2, 2);
01123 *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
01124 (src[0] >> 2) & 0x03, 2, 2);
01125 *samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
01126 src[0] & 0x03, 2, 2);
01127 }
01128 }
01129 break;
01130 case CODEC_ID_ADPCM_SWF:
01131 {
01132 GetBitContext gb;
01133 const int *table;
01134 int k0, signmask, nb_bits, count;
01135 int size = buf_size*8;
01136
01137 init_get_bits(&gb, buf, size);
01138
01139
01140 nb_bits = get_bits(&gb, 2)+2;
01141
01142 table = swf_index_tables[nb_bits-2];
01143 k0 = 1 << (nb_bits-2);
01144 signmask = 1 << (nb_bits-1);
01145
01146 while (get_bits_count(&gb) <= size - 22*avctx->channels) {
01147 for (i = 0; i < avctx->channels; i++) {
01148 *samples++ = c->status[i].predictor = get_sbits(&gb, 16);
01149 c->status[i].step_index = get_bits(&gb, 6);
01150 }
01151
01152 for (count = 0; get_bits_count(&gb) <= size - nb_bits*avctx->channels && count < 4095; count++) {
01153 int i;
01154
01155 for (i = 0; i < avctx->channels; i++) {
01156
01157 int delta = get_bits(&gb, nb_bits);
01158 int step = ff_adpcm_step_table[c->status[i].step_index];
01159 long vpdiff = 0;
01160 int k = k0;
01161
01162 do {
01163 if (delta & k)
01164 vpdiff += step;
01165 step >>= 1;
01166 k >>= 1;
01167 } while(k);
01168 vpdiff += step;
01169
01170 if (delta & signmask)
01171 c->status[i].predictor -= vpdiff;
01172 else
01173 c->status[i].predictor += vpdiff;
01174
01175 c->status[i].step_index += table[delta & (~signmask)];
01176
01177 c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88);
01178 c->status[i].predictor = av_clip_int16(c->status[i].predictor);
01179
01180 *samples++ = c->status[i].predictor;
01181 }
01182 }
01183 }
01184 src += buf_size;
01185 break;
01186 }
01187 case CODEC_ID_ADPCM_YAMAHA:
01188 for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
01189 uint8_t v = *src;
01190 *samples++ = adpcm_yamaha_expand_nibble(&c->status[0 ], v & 0x0F);
01191 *samples++ = adpcm_yamaha_expand_nibble(&c->status[st], v >> 4 );
01192 }
01193 break;
01194 case CODEC_ID_ADPCM_THP:
01195 {
01196 int table[2][16];
01197 int prev[2][2];
01198 int ch;
01199
01200 src += 4;
01201 src += 4;
01202
01203 for (i = 0; i < 32; i++)
01204 table[0][i] = (int16_t)bytestream_get_be16(&src);
01205
01206
01207 for (i = 0; i < 4; i++)
01208 prev[0][i] = (int16_t)bytestream_get_be16(&src);
01209
01210 for (ch = 0; ch <= st; ch++) {
01211 samples = (short *)c->frame.data[0] + ch;
01212
01213
01214 for (i = 0; i < nb_samples / 14; i++) {
01215 int index = (*src >> 4) & 7;
01216 unsigned int exp = *src++ & 15;
01217 int factor1 = table[ch][index * 2];
01218 int factor2 = table[ch][index * 2 + 1];
01219
01220
01221 for (n = 0; n < 14; n++) {
01222 int32_t sampledat;
01223 if(n&1) sampledat = sign_extend(*src++, 4);
01224 else sampledat = sign_extend(*src >> 4, 4);
01225
01226 sampledat = ((prev[ch][0]*factor1
01227 + prev[ch][1]*factor2) >> 11) + (sampledat << exp);
01228 *samples = av_clip_int16(sampledat);
01229 prev[ch][1] = prev[ch][0];
01230 prev[ch][0] = *samples++;
01231
01232
01233
01234 samples += st;
01235 }
01236 }
01237 }
01238 break;
01239 }
01240
01241 default:
01242 return -1;
01243 }
01244
01245 *got_frame_ptr = 1;
01246 *(AVFrame *)data = c->frame;
01247
01248 return src - buf;
01249 }
01250
01251
01252 #define ADPCM_DECODER(id_, name_, long_name_) \
01253 AVCodec ff_ ## name_ ## _decoder = { \
01254 .name = #name_, \
01255 .type = AVMEDIA_TYPE_AUDIO, \
01256 .id = id_, \
01257 .priv_data_size = sizeof(ADPCMDecodeContext), \
01258 .init = adpcm_decode_init, \
01259 .decode = adpcm_decode_frame, \
01260 .capabilities = CODEC_CAP_DR1, \
01261 .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
01262 }
01263
01264
01265 ADPCM_DECODER(CODEC_ID_ADPCM_4XM, adpcm_4xm, "ADPCM 4X Movie");
01266 ADPCM_DECODER(CODEC_ID_ADPCM_CT, adpcm_ct, "ADPCM Creative Technology");
01267 ADPCM_DECODER(CODEC_ID_ADPCM_EA, adpcm_ea, "ADPCM Electronic Arts");
01268 ADPCM_DECODER(CODEC_ID_ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa, "ADPCM Electronic Arts Maxis CDROM XA");
01269 ADPCM_DECODER(CODEC_ID_ADPCM_EA_R1, adpcm_ea_r1, "ADPCM Electronic Arts R1");
01270 ADPCM_DECODER(CODEC_ID_ADPCM_EA_R2, adpcm_ea_r2, "ADPCM Electronic Arts R2");
01271 ADPCM_DECODER(CODEC_ID_ADPCM_EA_R3, adpcm_ea_r3, "ADPCM Electronic Arts R3");
01272 ADPCM_DECODER(CODEC_ID_ADPCM_EA_XAS, adpcm_ea_xas, "ADPCM Electronic Arts XAS");
01273 ADPCM_DECODER(CODEC_ID_ADPCM_IMA_AMV, adpcm_ima_amv, "ADPCM IMA AMV");
01274 ADPCM_DECODER(CODEC_ID_ADPCM_IMA_APC, adpcm_ima_apc, "ADPCM IMA CRYO APC");
01275 ADPCM_DECODER(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3, "ADPCM IMA Duck DK3");
01276 ADPCM_DECODER(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4, "ADPCM IMA Duck DK4");
01277 ADPCM_DECODER(CODEC_ID_ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs, "ADPCM IMA Electronic Arts EACS");
01278 ADPCM_DECODER(CODEC_ID_ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead, "ADPCM IMA Electronic Arts SEAD");
01279 ADPCM_DECODER(CODEC_ID_ADPCM_IMA_ISS, adpcm_ima_iss, "ADPCM IMA Funcom ISS");
01280 ADPCM_DECODER(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt, "ADPCM IMA QuickTime");
01281 ADPCM_DECODER(CODEC_ID_ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg, "ADPCM IMA Loki SDL MJPEG");
01282 ADPCM_DECODER(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav, "ADPCM IMA WAV");
01283 ADPCM_DECODER(CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws, "ADPCM IMA Westwood");
01284 ADPCM_DECODER(CODEC_ID_ADPCM_MS, adpcm_ms, "ADPCM Microsoft");
01285 ADPCM_DECODER(CODEC_ID_ADPCM_SBPRO_2, adpcm_sbpro_2, "ADPCM Sound Blaster Pro 2-bit");
01286 ADPCM_DECODER(CODEC_ID_ADPCM_SBPRO_3, adpcm_sbpro_3, "ADPCM Sound Blaster Pro 2.6-bit");
01287 ADPCM_DECODER(CODEC_ID_ADPCM_SBPRO_4, adpcm_sbpro_4, "ADPCM Sound Blaster Pro 4-bit");
01288 ADPCM_DECODER(CODEC_ID_ADPCM_SWF, adpcm_swf, "ADPCM Shockwave Flash");
01289 ADPCM_DECODER(CODEC_ID_ADPCM_THP, adpcm_thp, "ADPCM Nintendo Gamecube THP");
01290 ADPCM_DECODER(CODEC_ID_ADPCM_XA, adpcm_xa, "ADPCM CDROM XA");
01291 ADPCM_DECODER(CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha, "ADPCM Yamaha");