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
This commit is contained in:
whiterandrek 2018-05-14 14:32:41 +03:00 committed by Adrian Frühwirth
parent 0aed2452c6
commit ff1b7ff89d

View file

@ -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;
}
}