2 * Copyright (c) 2001-2003 The FFmpeg project
4 * first version by Francois Revol (revol@free.fr)
5 * fringe ADPCM codecs (e.g., DK3, DK4, Westwood)
6 * by Mike Melanson (melanson@pcisys.net)
8 * This file is part of Libav.
10 * Libav is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * Libav is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with Libav; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 #include "bytestream.h"
29 #include "adpcm_data.h"
35 * See ADPCM decoder reference documents for codec information.
38 typedef struct TrellisPath {
43 typedef struct TrellisNode {
51 typedef struct ADPCMEncodeContext {
52 ADPCMChannelStatus status[6];
54 TrellisNode *node_buf;
55 TrellisNode **nodep_buf;
56 uint8_t *trellis_hash;
59 #define FREEZE_INTERVAL 128
61 static av_cold int adpcm_encode_init(AVCodecContext *avctx)
63 ADPCMEncodeContext *s = avctx->priv_data;
66 int ret = AVERROR(ENOMEM);
68 if (avctx->channels > 2) {
69 av_log(avctx, AV_LOG_ERROR, "only stereo or mono is supported\n");
70 return AVERROR(EINVAL);
73 if (avctx->trellis && (unsigned)avctx->trellis > 16U) {
74 av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n");
75 return AVERROR(EINVAL);
79 int frontier = 1 << avctx->trellis;
80 int max_paths = frontier * FREEZE_INTERVAL;
81 FF_ALLOC_OR_GOTO(avctx, s->paths,
82 max_paths * sizeof(*s->paths), error);
83 FF_ALLOC_OR_GOTO(avctx, s->node_buf,
84 2 * frontier * sizeof(*s->node_buf), error);
85 FF_ALLOC_OR_GOTO(avctx, s->nodep_buf,
86 2 * frontier * sizeof(*s->nodep_buf), error);
87 FF_ALLOC_OR_GOTO(avctx, s->trellis_hash,
88 65536 * sizeof(*s->trellis_hash), error);
91 avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
93 switch (avctx->codec->id) {
94 case AV_CODEC_ID_ADPCM_IMA_WAV:
95 /* each 16 bits sample gives one nibble
96 and we have 4 bytes per channel overhead */
97 avctx->frame_size = (BLKSIZE - 4 * avctx->channels) * 8 /
98 (4 * avctx->channels) + 1;
99 /* seems frame_size isn't taken into account...
100 have to buffer the samples :-( */
101 avctx->block_align = BLKSIZE;
103 case AV_CODEC_ID_ADPCM_IMA_QT:
104 avctx->frame_size = 64;
105 avctx->block_align = 34 * avctx->channels;
107 case AV_CODEC_ID_ADPCM_MS:
108 /* each 16 bits sample gives one nibble
109 and we have 7 bytes per channel overhead */
110 avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 /
112 avctx->block_align = BLKSIZE;
113 if (!(avctx->extradata = av_malloc(32 + AV_INPUT_BUFFER_PADDING_SIZE)))
115 avctx->extradata_size = 32;
116 extradata = avctx->extradata;
117 bytestream_put_le16(&extradata, avctx->frame_size);
118 bytestream_put_le16(&extradata, 7); /* wNumCoef */
119 for (i = 0; i < 7; i++) {
120 bytestream_put_le16(&extradata, ff_adpcm_AdaptCoeff1[i] * 4);
121 bytestream_put_le16(&extradata, ff_adpcm_AdaptCoeff2[i] * 4);
124 case AV_CODEC_ID_ADPCM_YAMAHA:
125 avctx->frame_size = BLKSIZE * 2 / avctx->channels;
126 avctx->block_align = BLKSIZE;
128 case AV_CODEC_ID_ADPCM_SWF:
129 if (avctx->sample_rate != 11025 &&
130 avctx->sample_rate != 22050 &&
131 avctx->sample_rate != 44100) {
132 av_log(avctx, AV_LOG_ERROR, "Sample rate must be 11025, "
134 ret = AVERROR(EINVAL);
137 avctx->frame_size = 512 * (avctx->sample_rate / 11025);
140 ret = AVERROR(EINVAL);
147 av_freep(&s->node_buf);
148 av_freep(&s->nodep_buf);
149 av_freep(&s->trellis_hash);
153 static av_cold int adpcm_encode_close(AVCodecContext *avctx)
155 ADPCMEncodeContext *s = avctx->priv_data;
157 av_freep(&s->node_buf);
158 av_freep(&s->nodep_buf);
159 av_freep(&s->trellis_hash);
165 static inline uint8_t adpcm_ima_compress_sample(ADPCMChannelStatus *c,
168 int delta = sample - c->prev_sample;
169 int nibble = FFMIN(7, abs(delta) * 4 /
170 ff_adpcm_step_table[c->step_index]) + (delta < 0) * 8;
171 c->prev_sample += ((ff_adpcm_step_table[c->step_index] *
172 ff_adpcm_yamaha_difflookup[nibble]) / 8);
173 c->prev_sample = av_clip_int16(c->prev_sample);
174 c->step_index = av_clip(c->step_index + ff_adpcm_index_table[nibble], 0, 88);
178 static inline uint8_t adpcm_ima_qt_compress_sample(ADPCMChannelStatus *c,
181 int delta = sample - c->prev_sample;
182 int mask, step = ff_adpcm_step_table[c->step_index];
183 int diff = step >> 3;
191 for (mask = 4; mask;) {
202 c->prev_sample -= diff;
204 c->prev_sample += diff;
206 c->prev_sample = av_clip_int16(c->prev_sample);
207 c->step_index = av_clip(c->step_index + ff_adpcm_index_table[nibble], 0, 88);
212 static inline uint8_t adpcm_ms_compress_sample(ADPCMChannelStatus *c,
215 int predictor, nibble, bias;
217 predictor = (((c->sample1) * (c->coeff1)) +
218 (( c->sample2) * (c->coeff2))) / 64;
220 nibble = sample - predictor;
222 bias = c->idelta / 2;
224 bias = -c->idelta / 2;
226 nibble = (nibble + bias) / c->idelta;
227 nibble = av_clip(nibble, -8, 7) & 0x0F;
229 predictor += ((nibble & 0x08) ? (nibble - 0x10) : nibble) * c->idelta;
231 c->sample2 = c->sample1;
232 c->sample1 = av_clip_int16(predictor);
234 c->idelta = (ff_adpcm_AdaptationTable[nibble] * c->idelta) >> 8;
241 static inline uint8_t adpcm_yamaha_compress_sample(ADPCMChannelStatus *c,
251 delta = sample - c->predictor;
253 nibble = FFMIN(7, abs(delta) * 4 / c->step) + (delta < 0) * 8;
255 c->predictor += ((c->step * ff_adpcm_yamaha_difflookup[nibble]) / 8);
256 c->predictor = av_clip_int16(c->predictor);
257 c->step = (c->step * ff_adpcm_yamaha_indexscale[nibble]) >> 8;
258 c->step = av_clip(c->step, 127, 24567);
263 static void adpcm_compress_trellis(AVCodecContext *avctx,
264 const int16_t *samples, uint8_t *dst,
265 ADPCMChannelStatus *c, int n, int stride)
267 //FIXME 6% faster if frontier is a compile-time constant
268 ADPCMEncodeContext *s = avctx->priv_data;
269 const int frontier = 1 << avctx->trellis;
270 const int version = avctx->codec->id;
271 TrellisPath *paths = s->paths, *p;
272 TrellisNode *node_buf = s->node_buf;
273 TrellisNode **nodep_buf = s->nodep_buf;
274 TrellisNode **nodes = nodep_buf; // nodes[] is always sorted by .ssd
275 TrellisNode **nodes_next = nodep_buf + frontier;
276 int pathn = 0, froze = -1, i, j, k, generation = 0;
277 uint8_t *hash = s->trellis_hash;
278 memset(hash, 0xff, 65536 * sizeof(*hash));
280 memset(nodep_buf, 0, 2 * frontier * sizeof(*nodep_buf));
281 nodes[0] = node_buf + frontier;
284 nodes[0]->step = c->step_index;
285 nodes[0]->sample1 = c->sample1;
286 nodes[0]->sample2 = c->sample2;
287 if (version == AV_CODEC_ID_ADPCM_IMA_WAV ||
288 version == AV_CODEC_ID_ADPCM_IMA_QT ||
289 version == AV_CODEC_ID_ADPCM_SWF)
290 nodes[0]->sample1 = c->prev_sample;
291 if (version == AV_CODEC_ID_ADPCM_MS)
292 nodes[0]->step = c->idelta;
293 if (version == AV_CODEC_ID_ADPCM_YAMAHA) {
295 nodes[0]->step = 127;
296 nodes[0]->sample1 = 0;
298 nodes[0]->step = c->step;
299 nodes[0]->sample1 = c->predictor;
303 for (i = 0; i < n; i++) {
304 TrellisNode *t = node_buf + frontier*(i&1);
306 int sample = samples[i * stride];
308 memset(nodes_next, 0, frontier * sizeof(TrellisNode*));
309 for (j = 0; j < frontier && nodes[j]; j++) {
310 // higher j have higher ssd already, so they're likely
311 // to yield a suboptimal next sample too
312 const int range = (j < frontier / 2) ? 1 : 0;
313 const int step = nodes[j]->step;
315 if (version == AV_CODEC_ID_ADPCM_MS) {
316 const int predictor = ((nodes[j]->sample1 * c->coeff1) +
317 (nodes[j]->sample2 * c->coeff2)) / 64;
318 const int div = (sample - predictor) / step;
319 const int nmin = av_clip(div-range, -8, 6);
320 const int nmax = av_clip(div+range, -7, 7);
321 for (nidx = nmin; nidx <= nmax; nidx++) {
322 const int nibble = nidx & 0xf;
323 int dec_sample = predictor + nidx * step;
324 #define STORE_NODE(NAME, STEP_INDEX)\
330 dec_sample = av_clip_int16(dec_sample);\
331 d = sample - dec_sample;\
332 ssd = nodes[j]->ssd + d*d;\
333 /* Check for wraparound, skip such samples completely. \
334 * Note, changing ssd to a 64 bit variable would be \
335 * simpler, avoiding this check, but it's slower on \
336 * x86 32 bit at the moment. */\
337 if (ssd < nodes[j]->ssd)\
339 /* Collapse any two states with the same previous sample value. \
340 * One could also distinguish states by step and by 2nd to last
341 * sample, but the effects of that are negligible.
342 * Since nodes in the previous generation are iterated
343 * through a heap, they're roughly ordered from better to
344 * worse, but not strictly ordered. Therefore, an earlier
345 * node with the same sample value is better in most cases
346 * (and thus the current is skipped), but not strictly
347 * in all cases. Only skipping samples where ssd >=
348 * ssd of the earlier node with the same sample gives
349 * slightly worse quality, though, for some reason. */ \
350 h = &hash[(uint16_t) dec_sample];\
351 if (*h == generation)\
353 if (heap_pos < frontier) {\
356 /* Try to replace one of the leaf nodes with the new \
357 * one, but try a different slot each time. */\
358 pos = (frontier >> 1) +\
359 (heap_pos & ((frontier >> 1) - 1));\
360 if (ssd > nodes_next[pos]->ssd)\
365 u = nodes_next[pos];\
367 assert(pathn < FREEZE_INTERVAL << avctx->trellis);\
369 nodes_next[pos] = u;\
373 u->step = STEP_INDEX;\
374 u->sample2 = nodes[j]->sample1;\
375 u->sample1 = dec_sample;\
376 paths[u->path].nibble = nibble;\
377 paths[u->path].prev = nodes[j]->path;\
378 /* Sift the newly inserted node up in the heap to \
379 * restore the heap property. */\
381 int parent = (pos - 1) >> 1;\
382 if (nodes_next[parent]->ssd <= ssd)\
384 FFSWAP(TrellisNode*, nodes_next[parent], nodes_next[pos]);\
388 STORE_NODE(ms, FFMAX(16,
389 (ff_adpcm_AdaptationTable[nibble] * step) >> 8));
391 } else if (version == AV_CODEC_ID_ADPCM_IMA_WAV ||
392 version == AV_CODEC_ID_ADPCM_IMA_QT ||
393 version == AV_CODEC_ID_ADPCM_SWF) {
394 #define LOOP_NODES(NAME, STEP_TABLE, STEP_INDEX)\
395 const int predictor = nodes[j]->sample1;\
396 const int div = (sample - predictor) * 4 / STEP_TABLE;\
397 int nmin = av_clip(div - range, -7, 6);\
398 int nmax = av_clip(div + range, -6, 7);\
400 nmin--; /* distinguish -0 from +0 */\
403 for (nidx = nmin; nidx <= nmax; nidx++) {\
404 const int nibble = nidx < 0 ? 7 - nidx : nidx;\
405 int dec_sample = predictor +\
407 ff_adpcm_yamaha_difflookup[nibble]) / 8;\
408 STORE_NODE(NAME, STEP_INDEX);\
410 LOOP_NODES(ima, ff_adpcm_step_table[step],
411 av_clip(step + ff_adpcm_index_table[nibble], 0, 88));
412 } else { //AV_CODEC_ID_ADPCM_YAMAHA
413 LOOP_NODES(yamaha, step,
414 av_clip((step * ff_adpcm_yamaha_indexscale[nibble]) >> 8,
426 if (generation == 255) {
427 memset(hash, 0xff, 65536 * sizeof(*hash));
432 if (nodes[0]->ssd > (1 << 28)) {
433 for (j = 1; j < frontier && nodes[j]; j++)
434 nodes[j]->ssd -= nodes[0]->ssd;
438 // merge old paths to save memory
439 if (i == froze + FREEZE_INTERVAL) {
440 p = &paths[nodes[0]->path];
441 for (k = i; k > froze; k--) {
447 // other nodes might use paths that don't coincide with the frozen one.
448 // checking which nodes do so is too slow, so just kill them all.
449 // this also slightly improves quality, but I don't know why.
450 memset(nodes + 1, 0, (frontier - 1) * sizeof(TrellisNode*));
454 p = &paths[nodes[0]->path];
455 for (i = n - 1; i > froze; i--) {
460 c->predictor = nodes[0]->sample1;
461 c->sample1 = nodes[0]->sample1;
462 c->sample2 = nodes[0]->sample2;
463 c->step_index = nodes[0]->step;
464 c->step = nodes[0]->step;
465 c->idelta = nodes[0]->step;
468 static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
469 const AVFrame *frame, int *got_packet_ptr)
471 int n, i, ch, st, pkt_size, ret;
472 const int16_t *samples;
475 ADPCMEncodeContext *c = avctx->priv_data;
478 samples = (const int16_t *)frame->data[0];
479 samples_p = (int16_t **)frame->extended_data;
480 st = avctx->channels == 2;
482 if (avctx->codec_id == AV_CODEC_ID_ADPCM_SWF)
483 pkt_size = (2 + avctx->channels * (22 + 4 * (frame->nb_samples - 1)) + 7) / 8;
485 pkt_size = avctx->block_align;
486 if ((ret = ff_alloc_packet(avpkt, pkt_size))) {
487 av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
492 switch(avctx->codec->id) {
493 case AV_CODEC_ID_ADPCM_IMA_WAV:
497 blocks = (frame->nb_samples - 1) / 8;
499 for (ch = 0; ch < avctx->channels; ch++) {
500 ADPCMChannelStatus *status = &c->status[ch];
501 status->prev_sample = samples_p[ch][0];
502 /* status->step_index = 0;
503 XXX: not sure how to init the state machine */
504 bytestream_put_le16(&dst, status->prev_sample);
505 *dst++ = status->step_index;
506 *dst++ = 0; /* unknown */
509 /* stereo: 4 bytes (8 samples) for left, 4 bytes for right */
510 if (avctx->trellis > 0) {
511 FF_ALLOC_OR_GOTO(avctx, buf, avctx->channels * blocks * 8, error);
512 for (ch = 0; ch < avctx->channels; ch++) {
513 adpcm_compress_trellis(avctx, &samples_p[ch][1],
514 buf + ch * blocks * 8, &c->status[ch],
517 for (i = 0; i < blocks; i++) {
518 for (ch = 0; ch < avctx->channels; ch++) {
519 uint8_t *buf1 = buf + ch * blocks * 8 + i * 8;
520 for (j = 0; j < 8; j += 2)
521 *dst++ = buf1[j] | (buf1[j + 1] << 4);
526 for (i = 0; i < blocks; i++) {
527 for (ch = 0; ch < avctx->channels; ch++) {
528 ADPCMChannelStatus *status = &c->status[ch];
529 const int16_t *smp = &samples_p[ch][1 + i * 8];
530 for (j = 0; j < 8; j += 2) {
531 uint8_t v = adpcm_ima_compress_sample(status, smp[j ]);
532 v |= adpcm_ima_compress_sample(status, smp[j + 1]) << 4;
540 case AV_CODEC_ID_ADPCM_IMA_QT:
543 init_put_bits(&pb, dst, pkt_size * 8);
545 for (ch = 0; ch < avctx->channels; ch++) {
546 ADPCMChannelStatus *status = &c->status[ch];
547 put_bits(&pb, 9, (status->prev_sample & 0xFFFF) >> 7);
548 put_bits(&pb, 7, status->step_index);
549 if (avctx->trellis > 0) {
551 adpcm_compress_trellis(avctx, &samples_p[ch][0], buf, status,
553 for (i = 0; i < 64; i++)
554 put_bits(&pb, 4, buf[i ^ 1]);
555 status->prev_sample = status->predictor;
557 for (i = 0; i < 64; i += 2) {
559 t1 = adpcm_ima_qt_compress_sample(status, samples_p[ch][i ]);
560 t2 = adpcm_ima_qt_compress_sample(status, samples_p[ch][i + 1]);
561 put_bits(&pb, 4, t2);
562 put_bits(&pb, 4, t1);
570 case AV_CODEC_ID_ADPCM_SWF:
573 init_put_bits(&pb, dst, pkt_size * 8);
575 n = frame->nb_samples - 1;
577 // store AdpcmCodeSize
578 put_bits(&pb, 2, 2); // set 4-bit flash adpcm format
580 // init the encoder state
581 for (i = 0; i < avctx->channels; i++) {
582 // clip step so it fits 6 bits
583 c->status[i].step_index = av_clip(c->status[i].step_index, 0, 63);
584 put_sbits(&pb, 16, samples[i]);
585 put_bits(&pb, 6, c->status[i].step_index);
586 c->status[i].prev_sample = samples[i];
589 if (avctx->trellis > 0) {
590 FF_ALLOC_OR_GOTO(avctx, buf, 2 * n, error);
591 adpcm_compress_trellis(avctx, samples + avctx->channels, buf,
592 &c->status[0], n, avctx->channels);
593 if (avctx->channels == 2)
594 adpcm_compress_trellis(avctx, samples + avctx->channels + 1,
595 buf + n, &c->status[1], n,
597 for (i = 0; i < n; i++) {
598 put_bits(&pb, 4, buf[i]);
599 if (avctx->channels == 2)
600 put_bits(&pb, 4, buf[n + i]);
604 for (i = 1; i < frame->nb_samples; i++) {
605 put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[0],
606 samples[avctx->channels * i]));
607 if (avctx->channels == 2)
608 put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[1],
609 samples[2 * i + 1]));
615 case AV_CODEC_ID_ADPCM_MS:
616 for (i = 0; i < avctx->channels; i++) {
619 c->status[i].coeff1 = ff_adpcm_AdaptCoeff1[predictor];
620 c->status[i].coeff2 = ff_adpcm_AdaptCoeff2[predictor];
622 for (i = 0; i < avctx->channels; i++) {
623 if (c->status[i].idelta < 16)
624 c->status[i].idelta = 16;
625 bytestream_put_le16(&dst, c->status[i].idelta);
627 for (i = 0; i < avctx->channels; i++)
628 c->status[i].sample2= *samples++;
629 for (i = 0; i < avctx->channels; i++) {
630 c->status[i].sample1 = *samples++;
631 bytestream_put_le16(&dst, c->status[i].sample1);
633 for (i = 0; i < avctx->channels; i++)
634 bytestream_put_le16(&dst, c->status[i].sample2);
636 if (avctx->trellis > 0) {
637 n = avctx->block_align - 7 * avctx->channels;
638 FF_ALLOC_OR_GOTO(avctx, buf, 2 * n, error);
639 if (avctx->channels == 1) {
640 adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n,
642 for (i = 0; i < n; i += 2)
643 *dst++ = (buf[i] << 4) | buf[i + 1];
645 adpcm_compress_trellis(avctx, samples, buf,
646 &c->status[0], n, avctx->channels);
647 adpcm_compress_trellis(avctx, samples + 1, buf + n,
648 &c->status[1], n, avctx->channels);
649 for (i = 0; i < n; i++)
650 *dst++ = (buf[i] << 4) | buf[n + i];
654 for (i = 7 * avctx->channels; i < avctx->block_align; i++) {
656 nibble = adpcm_ms_compress_sample(&c->status[ 0], *samples++) << 4;
657 nibble |= adpcm_ms_compress_sample(&c->status[st], *samples++);
662 case AV_CODEC_ID_ADPCM_YAMAHA:
663 n = frame->nb_samples / 2;
664 if (avctx->trellis > 0) {
665 FF_ALLOC_OR_GOTO(avctx, buf, 2 * n * 2, error);
667 if (avctx->channels == 1) {
668 adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n,
670 for (i = 0; i < n; i += 2)
671 *dst++ = buf[i] | (buf[i + 1] << 4);
673 adpcm_compress_trellis(avctx, samples, buf,
674 &c->status[0], n, avctx->channels);
675 adpcm_compress_trellis(avctx, samples + 1, buf + n,
676 &c->status[1], n, avctx->channels);
677 for (i = 0; i < n; i++)
678 *dst++ = buf[i] | (buf[n + i] << 4);
682 for (n *= avctx->channels; n > 0; n--) {
684 nibble = adpcm_yamaha_compress_sample(&c->status[ 0], *samples++);
685 nibble |= adpcm_yamaha_compress_sample(&c->status[st], *samples++) << 4;
690 return AVERROR(EINVAL);
693 avpkt->size = pkt_size;
697 return AVERROR(ENOMEM);
700 static const enum AVSampleFormat sample_fmts[] = {
701 AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
704 static const enum AVSampleFormat sample_fmts_p[] = {
705 AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_NONE
708 #define ADPCM_ENCODER(id_, name_, sample_fmts_, long_name_) \
709 AVCodec ff_ ## name_ ## _encoder = { \
711 .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
712 .type = AVMEDIA_TYPE_AUDIO, \
714 .priv_data_size = sizeof(ADPCMEncodeContext), \
715 .init = adpcm_encode_init, \
716 .encode2 = adpcm_encode_frame, \
717 .close = adpcm_encode_close, \
718 .sample_fmts = sample_fmts_, \
721 ADPCM_ENCODER(AV_CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt, sample_fmts_p, "ADPCM IMA QuickTime");
722 ADPCM_ENCODER(AV_CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav, sample_fmts_p, "ADPCM IMA WAV");
723 ADPCM_ENCODER(AV_CODEC_ID_ADPCM_MS, adpcm_ms, sample_fmts, "ADPCM Microsoft");
724 ADPCM_ENCODER(AV_CODEC_ID_ADPCM_SWF, adpcm_swf, sample_fmts, "ADPCM Shockwave Flash");
725 ADPCM_ENCODER(AV_CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha, sample_fmts, "ADPCM Yamaha");