2 * Copyright (c) 2001-2003 The ffmpeg Project
4 * This file is part of Libav.
6 * Libav is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * Libav is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with Libav; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #include "bytestream.h"
26 #include "adpcm_data.h"
31 * First version by Francois Revol (revol@free.fr)
32 * Fringe ADPCM codecs (e.g., DK3, DK4, Westwood)
33 * by Mike Melanson (melanson@pcisys.net)
35 * Reference documents:
36 * http://www.pcisys.net/~melanson/codecs/simpleaudio.html
37 * http://www.geocities.com/SiliconValley/8682/aud3.txt
38 * http://openquicktime.sourceforge.net/plugins.htm
39 * XAnim sources (xa_codec.c) http://www.rasnaimaging.com/people/lapus/download.html
40 * http://www.cs.ucla.edu/~leec/mediabench/applications.html
41 * SoX source code http://home.sprynet.com/~cbagwell/sox.html
44 typedef struct TrellisPath {
49 typedef struct TrellisNode {
57 typedef struct ADPCMEncodeContext {
58 ADPCMChannelStatus status[6];
60 TrellisNode *node_buf;
61 TrellisNode **nodep_buf;
62 uint8_t *trellis_hash;
65 #define FREEZE_INTERVAL 128
67 static av_cold int adpcm_encode_init(AVCodecContext *avctx)
69 ADPCMEncodeContext *s = avctx->priv_data;
72 if (avctx->channels > 2)
73 return -1; /* only stereo or mono =) */
75 if(avctx->trellis && (unsigned)avctx->trellis > 16U){
76 av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n");
81 int frontier = 1 << avctx->trellis;
82 int max_paths = frontier * FREEZE_INTERVAL;
83 FF_ALLOC_OR_GOTO(avctx, s->paths, max_paths * sizeof(*s->paths), error);
84 FF_ALLOC_OR_GOTO(avctx, s->node_buf, 2 * frontier * sizeof(*s->node_buf), error);
85 FF_ALLOC_OR_GOTO(avctx, s->nodep_buf, 2 * frontier * sizeof(*s->nodep_buf), error);
86 FF_ALLOC_OR_GOTO(avctx, s->trellis_hash, 65536 * sizeof(*s->trellis_hash), error);
89 avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
91 switch(avctx->codec->id) {
92 case CODEC_ID_ADPCM_IMA_WAV:
93 avctx->frame_size = (BLKSIZE - 4 * avctx->channels) * 8 / (4 * avctx->channels) + 1; /* each 16 bits sample gives one nibble */
94 /* and we have 4 bytes per channel overhead */
95 avctx->block_align = BLKSIZE;
96 /* seems frame_size isn't taken into account... have to buffer the samples :-( */
98 case CODEC_ID_ADPCM_IMA_QT:
99 avctx->frame_size = 64;
100 avctx->block_align = 34 * avctx->channels;
102 case CODEC_ID_ADPCM_MS:
103 avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2; /* each 16 bits sample gives one nibble */
104 /* and we have 7 bytes per channel overhead */
105 avctx->block_align = BLKSIZE;
106 avctx->extradata_size = 32;
107 extradata = avctx->extradata = av_malloc(avctx->extradata_size);
109 return AVERROR(ENOMEM);
110 bytestream_put_le16(&extradata, avctx->frame_size);
111 bytestream_put_le16(&extradata, 7); /* wNumCoef */
112 for (i = 0; i < 7; i++) {
113 bytestream_put_le16(&extradata, ff_adpcm_AdaptCoeff1[i] * 4);
114 bytestream_put_le16(&extradata, ff_adpcm_AdaptCoeff2[i] * 4);
117 case CODEC_ID_ADPCM_YAMAHA:
118 avctx->frame_size = BLKSIZE * avctx->channels;
119 avctx->block_align = BLKSIZE;
121 case CODEC_ID_ADPCM_SWF:
122 if (avctx->sample_rate != 11025 &&
123 avctx->sample_rate != 22050 &&
124 avctx->sample_rate != 44100) {
125 av_log(avctx, AV_LOG_ERROR, "Sample rate must be 11025, 22050 or 44100\n");
128 avctx->frame_size = 512 * (avctx->sample_rate / 11025);
134 avctx->coded_frame= avcodec_alloc_frame();
135 avctx->coded_frame->key_frame= 1;
140 av_freep(&s->node_buf);
141 av_freep(&s->nodep_buf);
142 av_freep(&s->trellis_hash);
146 static av_cold int adpcm_encode_close(AVCodecContext *avctx)
148 ADPCMEncodeContext *s = avctx->priv_data;
149 av_freep(&avctx->coded_frame);
151 av_freep(&s->node_buf);
152 av_freep(&s->nodep_buf);
153 av_freep(&s->trellis_hash);
159 static inline unsigned char adpcm_ima_compress_sample(ADPCMChannelStatus *c, short sample)
161 int delta = sample - c->prev_sample;
162 int nibble = FFMIN(7, abs(delta)*4/ff_adpcm_step_table[c->step_index]) + (delta<0)*8;
163 c->prev_sample += ((ff_adpcm_step_table[c->step_index] * ff_adpcm_yamaha_difflookup[nibble]) / 8);
164 c->prev_sample = av_clip_int16(c->prev_sample);
165 c->step_index = av_clip(c->step_index + ff_adpcm_index_table[nibble], 0, 88);
169 static inline unsigned char adpcm_ima_qt_compress_sample(ADPCMChannelStatus *c, short sample)
171 int delta = sample - c->prev_sample;
172 int mask, step = ff_adpcm_step_table[c->step_index];
173 int diff = step >> 3;
181 for (mask = 4; mask;) {
192 c->prev_sample -= diff;
194 c->prev_sample += diff;
196 c->prev_sample = av_clip_int16(c->prev_sample);
197 c->step_index = av_clip(c->step_index + ff_adpcm_index_table[nibble], 0, 88);
202 static inline unsigned char adpcm_ms_compress_sample(ADPCMChannelStatus *c, short sample)
204 int predictor, nibble, bias;
206 predictor = (((c->sample1) * (c->coeff1)) + ((c->sample2) * (c->coeff2))) / 64;
208 nibble= sample - predictor;
209 if(nibble>=0) bias= c->idelta/2;
210 else bias=-c->idelta/2;
212 nibble= (nibble + bias) / c->idelta;
213 nibble= av_clip(nibble, -8, 7)&0x0F;
215 predictor += (signed)((nibble & 0x08)?(nibble - 0x10):(nibble)) * c->idelta;
217 c->sample2 = c->sample1;
218 c->sample1 = av_clip_int16(predictor);
220 c->idelta = (ff_adpcm_AdaptationTable[(int)nibble] * c->idelta) >> 8;
221 if (c->idelta < 16) c->idelta = 16;
226 static inline unsigned char adpcm_yamaha_compress_sample(ADPCMChannelStatus *c, short sample)
235 delta = sample - c->predictor;
237 nibble = FFMIN(7, abs(delta)*4/c->step) + (delta<0)*8;
239 c->predictor += ((c->step * ff_adpcm_yamaha_difflookup[nibble]) / 8);
240 c->predictor = av_clip_int16(c->predictor);
241 c->step = (c->step * ff_adpcm_yamaha_indexscale[nibble]) >> 8;
242 c->step = av_clip(c->step, 127, 24567);
247 static void adpcm_compress_trellis(AVCodecContext *avctx, const short *samples,
248 uint8_t *dst, ADPCMChannelStatus *c, int n)
250 //FIXME 6% faster if frontier is a compile-time constant
251 ADPCMEncodeContext *s = avctx->priv_data;
252 const int frontier = 1 << avctx->trellis;
253 const int stride = avctx->channels;
254 const int version = avctx->codec->id;
255 TrellisPath *paths = s->paths, *p;
256 TrellisNode *node_buf = s->node_buf;
257 TrellisNode **nodep_buf = s->nodep_buf;
258 TrellisNode **nodes = nodep_buf; // nodes[] is always sorted by .ssd
259 TrellisNode **nodes_next = nodep_buf + frontier;
260 int pathn = 0, froze = -1, i, j, k, generation = 0;
261 uint8_t *hash = s->trellis_hash;
262 memset(hash, 0xff, 65536 * sizeof(*hash));
264 memset(nodep_buf, 0, 2 * frontier * sizeof(*nodep_buf));
265 nodes[0] = node_buf + frontier;
268 nodes[0]->step = c->step_index;
269 nodes[0]->sample1 = c->sample1;
270 nodes[0]->sample2 = c->sample2;
271 if((version == CODEC_ID_ADPCM_IMA_WAV) || (version == CODEC_ID_ADPCM_IMA_QT) || (version == CODEC_ID_ADPCM_SWF))
272 nodes[0]->sample1 = c->prev_sample;
273 if(version == CODEC_ID_ADPCM_MS)
274 nodes[0]->step = c->idelta;
275 if(version == CODEC_ID_ADPCM_YAMAHA) {
277 nodes[0]->step = 127;
278 nodes[0]->sample1 = 0;
280 nodes[0]->step = c->step;
281 nodes[0]->sample1 = c->predictor;
286 TrellisNode *t = node_buf + frontier*(i&1);
288 int sample = samples[i*stride];
290 memset(nodes_next, 0, frontier*sizeof(TrellisNode*));
291 for(j=0; j<frontier && nodes[j]; j++) {
292 // higher j have higher ssd already, so they're likely to yield a suboptimal next sample too
293 const int range = (j < frontier/2) ? 1 : 0;
294 const int step = nodes[j]->step;
296 if(version == CODEC_ID_ADPCM_MS) {
297 const int predictor = ((nodes[j]->sample1 * c->coeff1) + (nodes[j]->sample2 * c->coeff2)) / 64;
298 const int div = (sample - predictor) / step;
299 const int nmin = av_clip(div-range, -8, 6);
300 const int nmax = av_clip(div+range, -7, 7);
301 for(nidx=nmin; nidx<=nmax; nidx++) {
302 const int nibble = nidx & 0xf;
303 int dec_sample = predictor + nidx * step;
304 #define STORE_NODE(NAME, STEP_INDEX)\
310 dec_sample = av_clip_int16(dec_sample);\
311 d = sample - dec_sample;\
312 ssd = nodes[j]->ssd + d*d;\
313 /* Check for wraparound, skip such samples completely. \
314 * Note, changing ssd to a 64 bit variable would be \
315 * simpler, avoiding this check, but it's slower on \
316 * x86 32 bit at the moment. */\
317 if (ssd < nodes[j]->ssd)\
319 /* Collapse any two states with the same previous sample value. \
320 * One could also distinguish states by step and by 2nd to last
321 * sample, but the effects of that are negligible.
322 * Since nodes in the previous generation are iterated
323 * through a heap, they're roughly ordered from better to
324 * worse, but not strictly ordered. Therefore, an earlier
325 * node with the same sample value is better in most cases
326 * (and thus the current is skipped), but not strictly
327 * in all cases. Only skipping samples where ssd >=
328 * ssd of the earlier node with the same sample gives
329 * slightly worse quality, though, for some reason. */ \
330 h = &hash[(uint16_t) dec_sample];\
331 if (*h == generation)\
333 if (heap_pos < frontier) {\
336 /* Try to replace one of the leaf nodes with the new \
337 * one, but try a different slot each time. */\
338 pos = (frontier >> 1) + (heap_pos & ((frontier >> 1) - 1));\
339 if (ssd > nodes_next[pos]->ssd)\
344 u = nodes_next[pos];\
346 assert(pathn < FREEZE_INTERVAL<<avctx->trellis);\
348 nodes_next[pos] = u;\
352 u->step = STEP_INDEX;\
353 u->sample2 = nodes[j]->sample1;\
354 u->sample1 = dec_sample;\
355 paths[u->path].nibble = nibble;\
356 paths[u->path].prev = nodes[j]->path;\
357 /* Sift the newly inserted node up in the heap to \
358 * restore the heap property. */\
360 int parent = (pos - 1) >> 1;\
361 if (nodes_next[parent]->ssd <= ssd)\
363 FFSWAP(TrellisNode*, nodes_next[parent], nodes_next[pos]);\
367 STORE_NODE(ms, FFMAX(16, (ff_adpcm_AdaptationTable[nibble] * step) >> 8));
369 } else if((version == CODEC_ID_ADPCM_IMA_WAV)|| (version == CODEC_ID_ADPCM_IMA_QT)|| (version == CODEC_ID_ADPCM_SWF)) {
370 #define LOOP_NODES(NAME, STEP_TABLE, STEP_INDEX)\
371 const int predictor = nodes[j]->sample1;\
372 const int div = (sample - predictor) * 4 / STEP_TABLE;\
373 int nmin = av_clip(div-range, -7, 6);\
374 int nmax = av_clip(div+range, -6, 7);\
375 if(nmin<=0) nmin--; /* distinguish -0 from +0 */\
377 for(nidx=nmin; nidx<=nmax; nidx++) {\
378 const int nibble = nidx<0 ? 7-nidx : nidx;\
379 int dec_sample = predictor + (STEP_TABLE * ff_adpcm_yamaha_difflookup[nibble]) / 8;\
380 STORE_NODE(NAME, STEP_INDEX);\
382 LOOP_NODES(ima, ff_adpcm_step_table[step], av_clip(step + ff_adpcm_index_table[nibble], 0, 88));
383 } else { //CODEC_ID_ADPCM_YAMAHA
384 LOOP_NODES(yamaha, step, av_clip((step * ff_adpcm_yamaha_indexscale[nibble]) >> 8, 127, 24567));
395 if (generation == 255) {
396 memset(hash, 0xff, 65536 * sizeof(*hash));
401 if(nodes[0]->ssd > (1<<28)) {
402 for(j=1; j<frontier && nodes[j]; j++)
403 nodes[j]->ssd -= nodes[0]->ssd;
407 // merge old paths to save memory
408 if(i == froze + FREEZE_INTERVAL) {
409 p = &paths[nodes[0]->path];
410 for(k=i; k>froze; k--) {
416 // other nodes might use paths that don't coincide with the frozen one.
417 // checking which nodes do so is too slow, so just kill them all.
418 // this also slightly improves quality, but I don't know why.
419 memset(nodes+1, 0, (frontier-1)*sizeof(TrellisNode*));
423 p = &paths[nodes[0]->path];
424 for(i=n-1; i>froze; i--) {
429 c->predictor = nodes[0]->sample1;
430 c->sample1 = nodes[0]->sample1;
431 c->sample2 = nodes[0]->sample2;
432 c->step_index = nodes[0]->step;
433 c->step = nodes[0]->step;
434 c->idelta = nodes[0]->step;
437 static int adpcm_encode_frame(AVCodecContext *avctx,
438 unsigned char *frame, int buf_size, void *data)
443 ADPCMEncodeContext *c = avctx->priv_data;
447 samples = (short *)data;
448 st= avctx->channels == 2;
449 /* n = (BLKSIZE - 4 * avctx->channels) / (2 * 8 * avctx->channels); */
451 switch(avctx->codec->id) {
452 case CODEC_ID_ADPCM_IMA_WAV:
453 n = avctx->frame_size / 8;
454 c->status[0].prev_sample = (signed short)samples[0]; /* XXX */
455 /* c->status[0].step_index = 0; *//* XXX: not sure how to init the state machine */
456 bytestream_put_le16(&dst, c->status[0].prev_sample);
457 *dst++ = (unsigned char)c->status[0].step_index;
458 *dst++ = 0; /* unknown */
460 if (avctx->channels == 2) {
461 c->status[1].prev_sample = (signed short)samples[0];
462 /* c->status[1].step_index = 0; */
463 bytestream_put_le16(&dst, c->status[1].prev_sample);
464 *dst++ = (unsigned char)c->status[1].step_index;
469 /* stereo: 4 bytes (8 samples) for left, 4 bytes for right, 4 bytes left, ... */
470 if(avctx->trellis > 0) {
471 FF_ALLOC_OR_GOTO(avctx, buf, 2*n*8, error);
472 adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n*8);
473 if(avctx->channels == 2)
474 adpcm_compress_trellis(avctx, samples+1, buf + n*8, &c->status[1], n*8);
476 *dst++ = buf[8*i+0] | (buf[8*i+1] << 4);
477 *dst++ = buf[8*i+2] | (buf[8*i+3] << 4);
478 *dst++ = buf[8*i+4] | (buf[8*i+5] << 4);
479 *dst++ = buf[8*i+6] | (buf[8*i+7] << 4);
480 if (avctx->channels == 2) {
481 uint8_t *buf1 = buf + n*8;
482 *dst++ = buf1[8*i+0] | (buf1[8*i+1] << 4);
483 *dst++ = buf1[8*i+2] | (buf1[8*i+3] << 4);
484 *dst++ = buf1[8*i+4] | (buf1[8*i+5] << 4);
485 *dst++ = buf1[8*i+6] | (buf1[8*i+7] << 4);
491 *dst = adpcm_ima_compress_sample(&c->status[0], samples[0]);
492 *dst |= adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels]) << 4;
494 *dst = adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 2]);
495 *dst |= adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 3]) << 4;
497 *dst = adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 4]);
498 *dst |= adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 5]) << 4;
500 *dst = adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 6]);
501 *dst |= adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 7]) << 4;
504 if (avctx->channels == 2) {
505 *dst = adpcm_ima_compress_sample(&c->status[1], samples[1]);
506 *dst |= adpcm_ima_compress_sample(&c->status[1], samples[3]) << 4;
508 *dst = adpcm_ima_compress_sample(&c->status[1], samples[5]);
509 *dst |= adpcm_ima_compress_sample(&c->status[1], samples[7]) << 4;
511 *dst = adpcm_ima_compress_sample(&c->status[1], samples[9]);
512 *dst |= adpcm_ima_compress_sample(&c->status[1], samples[11]) << 4;
514 *dst = adpcm_ima_compress_sample(&c->status[1], samples[13]);
515 *dst |= adpcm_ima_compress_sample(&c->status[1], samples[15]) << 4;
518 samples += 8 * avctx->channels;
521 case CODEC_ID_ADPCM_IMA_QT:
525 init_put_bits(&pb, dst, buf_size*8);
527 for(ch=0; ch<avctx->channels; ch++){
528 put_bits(&pb, 9, (c->status[ch].prev_sample + 0x10000) >> 7);
529 put_bits(&pb, 7, c->status[ch].step_index);
530 if(avctx->trellis > 0) {
532 adpcm_compress_trellis(avctx, samples+ch, buf, &c->status[ch], 64);
534 put_bits(&pb, 4, buf[i^1]);
536 for (i=0; i<64; i+=2){
538 t1 = adpcm_ima_qt_compress_sample(&c->status[ch], samples[avctx->channels*(i+0)+ch]);
539 t2 = adpcm_ima_qt_compress_sample(&c->status[ch], samples[avctx->channels*(i+1)+ch]);
540 put_bits(&pb, 4, t2);
541 put_bits(&pb, 4, t1);
547 dst += put_bits_count(&pb)>>3;
550 case CODEC_ID_ADPCM_SWF:
554 init_put_bits(&pb, dst, buf_size*8);
556 n = avctx->frame_size-1;
558 //Store AdpcmCodeSize
559 put_bits(&pb, 2, 2); //Set 4bits flash adpcm format
561 //Init the encoder state
562 for(i=0; i<avctx->channels; i++){
563 c->status[i].step_index = av_clip(c->status[i].step_index, 0, 63); // clip step so it fits 6 bits
564 put_sbits(&pb, 16, samples[i]);
565 put_bits(&pb, 6, c->status[i].step_index);
566 c->status[i].prev_sample = (signed short)samples[i];
569 if(avctx->trellis > 0) {
570 FF_ALLOC_OR_GOTO(avctx, buf, 2*n, error);
571 adpcm_compress_trellis(avctx, samples+2, buf, &c->status[0], n);
572 if (avctx->channels == 2)
573 adpcm_compress_trellis(avctx, samples+3, buf+n, &c->status[1], n);
575 put_bits(&pb, 4, buf[i]);
576 if (avctx->channels == 2)
577 put_bits(&pb, 4, buf[n+i]);
581 for (i=1; i<avctx->frame_size; i++) {
582 put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels*i]));
583 if (avctx->channels == 2)
584 put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[1], samples[2*i+1]));
588 dst += put_bits_count(&pb)>>3;
591 case CODEC_ID_ADPCM_MS:
592 for(i=0; i<avctx->channels; i++){
596 c->status[i].coeff1 = ff_adpcm_AdaptCoeff1[predictor];
597 c->status[i].coeff2 = ff_adpcm_AdaptCoeff2[predictor];
599 for(i=0; i<avctx->channels; i++){
600 if (c->status[i].idelta < 16)
601 c->status[i].idelta = 16;
603 bytestream_put_le16(&dst, c->status[i].idelta);
605 for(i=0; i<avctx->channels; i++){
606 c->status[i].sample2= *samples++;
608 for(i=0; i<avctx->channels; i++){
609 c->status[i].sample1= *samples++;
611 bytestream_put_le16(&dst, c->status[i].sample1);
613 for(i=0; i<avctx->channels; i++)
614 bytestream_put_le16(&dst, c->status[i].sample2);
616 if(avctx->trellis > 0) {
617 int n = avctx->block_align - 7*avctx->channels;
618 FF_ALLOC_OR_GOTO(avctx, buf, 2*n, error);
619 if(avctx->channels == 1) {
620 adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n);
622 *dst++ = (buf[i] << 4) | buf[i+1];
624 adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n);
625 adpcm_compress_trellis(avctx, samples+1, buf+n, &c->status[1], n);
627 *dst++ = (buf[i] << 4) | buf[n+i];
631 for(i=7*avctx->channels; i<avctx->block_align; i++) {
633 nibble = adpcm_ms_compress_sample(&c->status[ 0], *samples++)<<4;
634 nibble|= adpcm_ms_compress_sample(&c->status[st], *samples++);
638 case CODEC_ID_ADPCM_YAMAHA:
639 n = avctx->frame_size / 2;
640 if(avctx->trellis > 0) {
641 FF_ALLOC_OR_GOTO(avctx, buf, 2*n*2, error);
643 if(avctx->channels == 1) {
644 adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n);
646 *dst++ = buf[i] | (buf[i+1] << 4);
648 adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n);
649 adpcm_compress_trellis(avctx, samples+1, buf+n, &c->status[1], n);
651 *dst++ = buf[i] | (buf[n+i] << 4);
655 for (n *= avctx->channels; n>0; n--) {
657 nibble = adpcm_yamaha_compress_sample(&c->status[ 0], *samples++);
658 nibble |= adpcm_yamaha_compress_sample(&c->status[st], *samples++) << 4;
670 #define ADPCM_ENCODER(id,name,long_name_) \
671 AVCodec ff_ ## name ## _encoder = { \
673 AVMEDIA_TYPE_AUDIO, \
675 sizeof(ADPCMEncodeContext), \
677 adpcm_encode_frame, \
678 adpcm_encode_close, \
680 .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, \
681 .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
684 ADPCM_ENCODER(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt, "ADPCM IMA QuickTime");
685 ADPCM_ENCODER(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav, "ADPCM IMA WAV");
686 ADPCM_ENCODER(CODEC_ID_ADPCM_MS, adpcm_ms, "ADPCM Microsoft");
687 ADPCM_ENCODER(CODEC_ID_ADPCM_SWF, adpcm_swf, "ADPCM Shockwave Flash");
688 ADPCM_ENCODER(CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha, "ADPCM Yamaha");