From 79183d3c3ef509543b47acc1b5e48e4285734f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Sun, 31 May 2009 18:17:33 +0000 Subject: [PATCH] mszh decompression: add a special case for an all-0 mask, i.e. 32 uncompressed bytes in a row. About 15% faster mszh_decomp on an Atom N270 for http://samples.mplayerhq.hu/V-codecs/mszh-zlib/avimzsh_sample.avi Originally committed as revision 19068 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/lcldec.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c index bc7e11d267..a6e348bd8e 100644 --- a/libavcodec/lcldec.c +++ b/libavcodec/lcldec.c @@ -102,6 +102,13 @@ static unsigned int mszh_decomp(const unsigned char * srcptr, int srclen, unsign maskbit >>= 1; if (!maskbit) { mask = *srcptr++; + while (!mask) { + if (destptr_end - destptr < 32 || srcptr_end - srcptr < 32) break; + memcpy(destptr, srcptr, 32); + destptr += 32; + srcptr += 32; + mask = *srcptr++; + } maskbit = 0x80; } }