From ff1b7ff89d03dce2e10bda136c954bb20c384c36 Mon Sep 17 00:00:00 2001 From: whiterandrek Date: Mon, 14 May 2018 14:32:41 +0300 Subject: VIDEO: FLIC: Fix decoding of BYTE_RUN/FLI_BRUN chunks Our decoder currently only supports the standard FLC format which does not rely on the stored packet count (which is part of the FLI format and limited to 255 packets per line). Instead, the image width should be used as criterion when decoding a frame which allows for more than 255 packets per line. See also https://www.compuphase.com/flic.htm --- video/flic_decoder.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'video/flic_decoder.cpp') diff --git a/video/flic_decoder.cpp b/video/flic_decoder.cpp index a1976e2729..57d8fb5585 100644 --- a/video/flic_decoder.cpp +++ b/video/flic_decoder.cpp @@ -265,9 +265,9 @@ void FlicDecoder::FlicVideoTrack::copyFrame(uint8 *data) { void FlicDecoder::FlicVideoTrack::decodeByteRun(uint8 *data) { byte *ptr = (byte *)_surface->getPixels(); - while ((int32)(ptr - (byte *)_surface->getPixels()) < (getWidth() * getHeight())) { - int chunks = *data++; - while (chunks--) { + for (int i = 0; i < getHeight(); ++i) { + data++; + for (int j = 0; j < getWidth();) { int count = (int8)*data++; if (count > 0) { memset(ptr, *data++, count); @@ -277,6 +277,7 @@ void FlicDecoder::FlicVideoTrack::decodeByteRun(uint8 *data) { data += count; } ptr += count; + j += count; } } -- cgit v1.2.3