summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2003-09-19 04:41:02 +0000
committerMike Melanson <mike@multimedia.cx>2003-09-19 04:41:02 +0000
commitb10529b4c47b3435faa4be85f344cffcb5d30896 (patch)
treed9d5ee9faf38540aadc2fff952d91d5e3afe3329
parent42e96409d3e9008cdb2516ff7ae2dcdd9f5a28d5 (diff)
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
-rw-r--r--libavcodec/dpcm.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c
index 958e46467d..ef4ccf8860 100644
--- a/libavcodec/dpcm.c
+++ b/libavcodec/dpcm.c
@@ -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: