diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2009-05-31 11:32:03 +0000 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2009-05-31 11:32:03 +0000 |
commit | 7a15b25827980281a061041ebf83d9a1ed6de9be (patch) | |
tree | aa4e1aa6475fd656bc780eb076b836a8cc2ea460 /libavcodec/lcldec.c | |
parent | a5d2745d8efa9e2f4a5269e665add85a2e9be4f7 (diff) | |
download | ffmpeg-7a15b25827980281a061041ebf83d9a1ed6de9be.tar.gz |
Take advantage of available input padding to optimize mszh_decomp
Originally committed as revision 19059 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/lcldec.c')
-rw-r--r-- | libavcodec/lcldec.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c index 9589b93b8d..66d1878045 100644 --- a/libavcodec/lcldec.c +++ b/libavcodec/lcldec.c @@ -73,7 +73,7 @@ typedef struct LclDecContext { /** - * \param srcptr compressed source buffer, must be padded with at least 4 extra bytes + * \param srcptr compressed source buffer, must be padded with at least 5 extra bytes * \param destptr must be padded sufficiently for av_memcpy_backptr */ static unsigned int mszh_decomp(const unsigned char * srcptr, int srclen, unsigned char * destptr, unsigned int destsize) @@ -81,16 +81,11 @@ static unsigned int mszh_decomp(const unsigned char * srcptr, int srclen, unsign unsigned char *destptr_bak = destptr; unsigned char *destptr_end = destptr + destsize; const unsigned char *srcptr_end = srcptr + srclen; - unsigned char mask = 0; - unsigned char maskbit = 0; + unsigned char mask = *srcptr++; + unsigned char maskbit = 0x80; unsigned int ofs, cnt; while (srcptr < srcptr_end && destptr < destptr_end) { - if (maskbit == 0) { - mask = *srcptr++; - maskbit = 0x80; - continue; - } if (!(mask & maskbit)) { memcpy(destptr, srcptr, 4); destptr += 4; @@ -105,6 +100,10 @@ static unsigned int mszh_decomp(const unsigned char * srcptr, int srclen, unsign destptr += cnt; } maskbit >>= 1; + if (!maskbit) { + mask = *srcptr++; + maskbit = 0x80; + } } return destptr - destptr_bak; |