fix Interplay DPCM (frames are intracoded, predictors do not carry

forward to next block, initial predictors go to the output)

Originally committed as revision 2294 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Mike Melanson 2003-09-19 04:41:02 +00:00
parent 42e96409d3
commit b10529b4c4

View File

@ -39,7 +39,6 @@
typedef struct DPCMContext {
int channels;
short roq_square_array[256];
int last_delta[2];
} DPCMContext;
#define SATURATE_S16(x) if (x < -32768) x = -32768; \
@ -119,11 +118,9 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
{
DPCMContext *s = avctx->priv_data;
int in, out = 0;
int i;
int predictor[2];
int channel_number = 0;
short *output_samples = data;
int sequence_number;
int shift[2];
unsigned char byte;
short diff;
@ -152,21 +149,16 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
break;
case CODEC_ID_INTERPLAY_DPCM:
in = 0;
sequence_number = LE_16(&buf[in]);
in += 6; /* skip over the stream mask and stream length */
if (sequence_number == 1) {
predictor[0] = LE_16(&buf[in]);
in = 6; /* skip over the stream mask and stream length */
predictor[0] = LE_16(&buf[in]);
in += 2;
SE_16BIT(predictor[0])
output_samples[out++] = predictor[0];
if (s->channels == 2) {
predictor[1] = LE_16(&buf[in]);
in += 2;
SE_16BIT(predictor[0])
if (s->channels == 2) {
predictor[1] = LE_16(&buf[in]);
SE_16BIT(predictor[1])
in += 2;
}
} else {
for (i = 0; i < s->channels; i++)
predictor[i] = s->last_delta[i];
SE_16BIT(predictor[1])
output_samples[out++] = predictor[1];
}
while (in < buf_size) {
@ -178,10 +170,6 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
channel_number ^= s->channels - 1;
}
/* save predictors for next round */
for (i = 0; i < s->channels; i++)
s->last_delta[i] = predictor[i];
break;
case CODEC_ID_XAN_DPCM: