- block_predictor = bytestream2_get_byteu(&gb);
- if (block_predictor > 6) {
- av_log(avctx, AV_LOG_ERROR, "ERROR: block_predictor[0] = %d\n",
- block_predictor);
- return AVERROR_INVALIDDATA;
- }
- c->status[0].coeff1 = ff_adpcm_AdaptCoeff1[block_predictor];
- c->status[0].coeff2 = ff_adpcm_AdaptCoeff2[block_predictor];
- if (st) {
+ if (avctx->channels > 2) {
+ for (channel = 0; channel < avctx->channels; channel++) {
+ samples = samples_p[channel];
+ block_predictor = bytestream2_get_byteu(&gb);
+ if (block_predictor > 6) {
+ av_log(avctx, AV_LOG_ERROR, "ERROR: block_predictor[%d] = %d\n",
+ channel, block_predictor);
+ return AVERROR_INVALIDDATA;
+ }
+ c->status[channel].coeff1 = ff_adpcm_AdaptCoeff1[block_predictor];
+ c->status[channel].coeff2 = ff_adpcm_AdaptCoeff2[block_predictor];
+ c->status[channel].idelta = sign_extend(bytestream2_get_le16u(&gb), 16);
+ c->status[channel].sample1 = sign_extend(bytestream2_get_le16u(&gb), 16);
+ c->status[channel].sample2 = sign_extend(bytestream2_get_le16u(&gb), 16);
+ *samples++ = c->status[channel].sample2;
+ *samples++ = c->status[channel].sample1;
+ for(n = (nb_samples - 2) >> 1; n > 0; n--) {
+ int byte = bytestream2_get_byteu(&gb);
+ *samples++ = adpcm_ms_expand_nibble(&c->status[channel], byte >> 4 );
+ *samples++ = adpcm_ms_expand_nibble(&c->status[channel], byte & 0x0F);
+ }
+ }
+ } else {