[FFmpeg-devel] 15-bit Westwood VQA3 decoding
Pekka Väänänen
pekka.vaananen at iki.fi
Mon Sep 20 22:13:04 EEST 2021
Hello,
This patch adds support for 15-bit VQA3 files that are used in Westwood
Studios' video games such as Command & Conquer: Tiberian Sun and Blade
Runner. I have tested this change with all VQA files available at
http://samples.mplayerhq.hu/game-formats/vqa/
and every video except those in kyrandia/ is now decoded correctly.
This patch is dependent on demuxer changes submitted as a separate
patch "avformat/westwood_vqa: Store VQFL codebook chunks":
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2021-September/285682.html
I noticed VQA3 support had been already submitted by Adam Iglewski as part
of Google Summer of Code 2009 but the patch set was never finished nor
merged:
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2009-May/074719.html
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2009-May/074958.html
I did some changes based on that 2009 thread but otherwise this is an
independent implementation.
The changes in the demuxer side in westwood_vqa.c are there to silence
log spam about ignored chunk types.
Anyway, as this is my first change, I have some questions.
1. Is it possible to preserve the pixels of a frame for easy delta updates?
In that 2009 patch set they used an old "FF_BUFFER_HINTS_PRESERVE" flag
that doesn't exist anymore.
2. Is it problematic to dereference 16-bit values like this:
uint16_t code = *(uint16_t*)stream;
stream += 2;
because the old code used
code = bytestream_get_le16(&src);
instead. Endianess shouldn't be a problem since the bytes are just
copied as-is. Does it make sense to create a 'bytestream' object just to
read from a statically allocated array (s->decode_buffer)?
3. I presume Adam Iglewski should be credited in the copyright headers
for the few lines I took from his patches? :)
More information about the ffmpeg-devel
mailing list