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
1 changed files with 9 additions and 21 deletions

View File

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