+ /* Get the control byte and decode the samples, 2 at a time. */
+ control = bytestream2_get_byteu(&gb);
+ shift = (control >> 4) + 2;
+
+ for (n = 0; n < nb_samples / 2; n++) {
+ int sample = bytestream2_get_byteu(&gb);
+ *samples++ = adpcm_argo_expand_nibble(cs, sign_extend(sample >> 4, 4), control, shift);
+ *samples++ = adpcm_argo_expand_nibble(cs, sign_extend(sample >> 0, 4), control, shift);
+ }
+ }
+ break;
+ case AV_CODEC_ID_ADPCM_ZORK:
+ if (!c->has_status) {
+ for (channel = 0; channel < avctx->channels; channel++) {
+ c->status[channel].predictor = 0;
+ c->status[channel].step_index = 0;
+ }
+ c->has_status = 1;
+ }
+ for (n = 0; n < nb_samples * avctx->channels; n++) {
+ int v = bytestream2_get_byteu(&gb);
+ *samples++ = adpcm_zork_expand_nibble(&c->status[n % avctx->channels], v);
+ }
+ break;
+ case AV_CODEC_ID_ADPCM_IMA_MTF:
+ for (n = nb_samples / 2; n > 0; n--) {
+ for (channel = 0; channel < avctx->channels; channel++) {
+ int v = bytestream2_get_byteu(&gb);
+ *samples++ = adpcm_ima_mtf_expand_nibble(&c->status[channel], v >> 4);
+ samples[st] = adpcm_ima_mtf_expand_nibble(&c->status[channel], v & 0x0F);
+ }
+ samples += avctx->channels;
+ }
+ break;