changeset 1477:afc7baa19b62 libavcodec

fix Interplay DPCM (frames are intracoded, predictors do not carry forward to next block, initial predictors go to the output)
author tmmm
date Fri, 19 Sep 2003 04:41:02 +0000
parents 72e115e94673
children e0402982c1a0
files dpcm.c
diffstat 1 files changed, 9 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/dpcm.c	Fri Sep 19 04:00:32 2003 +0000
+++ b/dpcm.c	Fri Sep 19 04:41:02 2003 +0000
@@ -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 @@
 {
     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 @@
         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 @@
             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: