summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2002-12-23 15:36:37 +0000
committerMike Melanson <mike@multimedia.cx>2002-12-23 15:36:37 +0000
commitd15276928e22160cdb606a0cf65ad48f1268f072 (patch)
tree90d39f2c3a2ba774bbb831acb57704533dd8367e
parent665d4ee14bee931df8a88416ff7c8b85e690a581 (diff)
downloadxine-lib-d15276928e22160cdb606a0cf65ad48f1268f072.tar.gz
xine-lib-d15276928e22160cdb606a0cf65ad48f1268f072.tar.bz2
move the palette wraparound to a better place
CVS patchset: 3650 CVS date: 2002/12/23 15:36:37
-rw-r--r--src/libxinevdec/fli.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libxinevdec/fli.c b/src/libxinevdec/fli.c
index 32148eba0..a8f23b319 100644
--- a/src/libxinevdec/fli.c
+++ b/src/libxinevdec/fli.c
@@ -23,7 +23,7 @@
* avoid when implementing a FLI decoder, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: fli.c,v 1.14 2002/12/22 23:15:17 tmmm Exp $
+ * $Id: fli.c,v 1.15 2002/12/23 15:36:37 tmmm Exp $
*/
#include <stdio.h>
@@ -146,15 +146,20 @@ void decode_fli_frame(fli_decoder_t *this) {
for (i = 0; i < color_packets; i++) {
/* first byte is how many colors to skip */
palette_ptr1 += (this->buf[stream_ptr++] * 4);
- /* wrap around, for good measure */
- if (palette_ptr1 >= PALETTE_SIZE)
- palette_ptr1 = 0;
+
/* next byte indicates how many entries to change */
color_changes = this->buf[stream_ptr++];
+
/* if there are 0 color changes, there are actually 256 */
if (color_changes == 0)
color_changes = 256;
+
for (j = 0; j < color_changes; j++) {
+
+ /* wrap around, for good measure */
+ if (palette_ptr1 >= PALETTE_SIZE)
+ palette_ptr1 = 0;
+
r = this->buf[stream_ptr + 0] << color_shift;
g = this->buf[stream_ptr + 1] << color_shift;
b = this->buf[stream_ptr + 2] << color_shift;