return 0;
}
-static inline short adpcm_ima_expand_nibble(ADPCMChannelStatus *c, char nibble, int shift)
+static inline int16_t adpcm_ima_expand_nibble(ADPCMChannelStatus *c, int8_t nibble, int shift)
{
int step_index;
int predictor;
c->predictor = av_clip_int16(predictor);
c->step_index = step_index;
- return (short)c->predictor;
+ return (int16_t)c->predictor;
}
static inline int16_t adpcm_ima_wav_expand_nibble(ADPCMChannelStatus *c, GetBitContext *gb, int bps)
return c->predictor;
}
-static inline short adpcm_ms_expand_nibble(ADPCMChannelStatus *c, int nibble)
+static inline int16_t adpcm_ms_expand_nibble(ADPCMChannelStatus *c, int nibble)
{
int predictor;
return c->sample1;
}
-static inline short adpcm_ima_oki_expand_nibble(ADPCMChannelStatus *c, int nibble)
+static inline int16_t adpcm_ima_oki_expand_nibble(ADPCMChannelStatus *c, int nibble)
{
int step_index, predictor, sign, delta, diff, step;
return c->predictor << 4;
}
-static inline short adpcm_ct_expand_nibble(ADPCMChannelStatus *c, char nibble)
+static inline int16_t adpcm_ct_expand_nibble(ADPCMChannelStatus *c, int8_t nibble)
{
int sign, delta, diff;
int new_step;
new_step = (ff_adpcm_AdaptationTable[nibble & 7] * c->step) >> 8;
c->step = av_clip(new_step, 511, 32767);
- return (short)c->predictor;
+ return (int16_t)c->predictor;
}
-static inline short adpcm_sbpro_expand_nibble(ADPCMChannelStatus *c, char nibble, int size, int shift)
+static inline int16_t adpcm_sbpro_expand_nibble(ADPCMChannelStatus *c, int8_t nibble, int size, int shift)
{
int sign, delta, diff;
else if (delta == 0 && c->step > 0)
c->step--;
- return (short) c->predictor;
+ return (int16_t) c->predictor;
}
-static inline short adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, unsigned char nibble)
+static inline int16_t adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, uint8_t nibble)
{
if(!c->step) {
c->predictor = 0;
// similar to IMA adpcm
int delta = get_bits(&gb, nb_bits);
int step = ff_adpcm_step_table[c->status[i].step_index];
- long vpdiff = 0; // vpdiff = (delta+0.5)*step/4
+ int vpdiff = 0; // vpdiff = (delta+0.5)*step/4
int k = k0;
do {
ADPCMDecodeContext *c = avctx->priv_data;
ADPCMChannelStatus *cs;
int n, m, channel, i;
- short *samples;
+ int16_t *samples;
int16_t **samples_p;
int st; /* stereo */
int count1, count2;
frame->nb_samples = nb_samples;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
- samples = (short *)frame->data[0];
+ samples = (int16_t *)frame->data[0];
samples_p = (int16_t **)frame->extended_data;
/* use coded_samples when applicable */
if (avctx->bits_per_coded_sample != 4) {
int samples_per_block = ff_adpcm_ima_block_samples[avctx->bits_per_coded_sample - 2];
+ int block_size = ff_adpcm_ima_block_sizes[avctx->bits_per_coded_sample - 2];
+ uint8_t temp[20] = { 0 };
GetBitContext g;
- ret = init_get_bits8(&g, gb.buffer, bytestream2_get_bytes_left(&gb));
- if (ret < 0)
- return ret;
for (n = 0; n < (nb_samples - 1) / samples_per_block; n++) {
for (i = 0; i < avctx->channels; i++) {
+ int j;
+
cs = &c->status[i];
samples = &samples_p[i][1 + n * samples_per_block];
+ for (j = 0; j < block_size; j++) {
+ temp[j] = buf[4 * avctx->channels + block_size * n * avctx->channels +
+ (j % 4) + (j / 4) * (avctx->channels * 4) + i * 4];
+ }
+ ret = init_get_bits8(&g, (const uint8_t *)&temp, block_size);
+ if (ret < 0)
+ return ret;
for (m = 0; m < samples_per_block; m++) {
samples[m] = adpcm_ima_wav_expand_nibble(cs, &g,
avctx->bits_per_coded_sample);