-static const int16_t fibonacci[16] = { -34<<8, -21<<8, -13<<8, -8<<8, -5<<8, -3<<8, -2<<8, -1<<8,
- 0, 1<<8, 2<<8, 3<<8, 5<<8, 8<<8, 13<<8, 21<<8 };
-static const int16_t exponential[16] = { -128<<8, -64<<8, -32<<8, -16<<8, -8<<8, -4<<8, -2<<8, -1<<8,
- 0, 1<<8, 2<<8, 4<<8, 8<<8, 16<<8, 32<<8, 64<<8 };
+static const int8_t fibonacci[16] = { -34, -21, -13, -8, -5, -3, -2, -1,
+ 0, 1, 2, 3, 5, 8, 13, 21 };
+static const int8_t exponential[16] = { -128, -64, -32, -16, -8, -4, -2, -1,
+ 0, 1, 2, 4, 8, 16, 32, 64 };
+
+#define MAX_FRAME_SIZE 32768
+
+/**
+ * Delta decode the compressed values in src, and put the resulting
+ * decoded samples in dst.
+ *
+ * @param[in,out] state starting value. it is saved for use in the next call.
+ */
+static void delta_decode(uint8_t *dst, const uint8_t *src, int src_size,
+ uint8_t *state, const int8_t *table)
+{
+ uint8_t val = *state;
+
+ while (src_size--) {
+ uint8_t d = *src++;
+ val = av_clip_uint8(val + table[d & 0xF]);
+ *dst++ = val;
+ val = av_clip_uint8(val + table[d >> 4]);
+ *dst++ = val;
+ }
+
+ *state = val;
+}
+
+static void raw_decode(uint8_t *dst, const int8_t *src, int src_size)
+{
+ while (src_size--)
+ *dst++ = *src++ + 128;
+}