CXBTFFrame appendContent(CXBTFWriter &writer, int width, int height, unsigned char *data, unsigned int size, unsigned int format, unsigned int flags)
{
CXBTFFrame frame;
- lzo_uint compressedSize = size;
+ unsigned int packedSize = size;
+#ifdef USE_LZO_PACKING
if ((flags & FLAGS_USE_LZO) == FLAGS_USE_LZO)
{
// grab a temporary buffer for unpacking into
- squish::u8 *compressed = new squish::u8[size + size / 16 + 64 + 3]; // see simple.c in lzo
- squish::u8 *working = new squish::u8[LZO1X_999_MEM_COMPRESS];
- if (compressed && working)
+ unsigned char *packed = new unsigned char[size + size / 16 + 64 + 3]; // see simple.c in lzo
+ unsigned char *working = new unsigned char[LZO1X_999_MEM_COMPRESS];
+ if (packed && working)
{
- if (lzo1x_999_compress(data, size, compressed, (lzo_uint*)&compressedSize, working) != LZO_E_OK || compressedSize > size)
+ if (lzo1x_999_compress(data, size, packed, (lzo_uint*)&packedSize, working) != LZO_E_OK || packedSize > size)
{
// compression failed, or compressed size is bigger than uncompressed, so store as uncompressed
- compressedSize = size;
+ packedSize = size;
writer.AppendContent(data, size);
}
else
{ // success
lzo_uint optimSize = size;
- lzo1x_optimize(compressed, compressedSize, data, &optimSize, NULL);
- writer.AppendContent(compressed, compressedSize);
+ lzo1x_optimize(packed, packedSize, data, &optimSize, NULL);
+ writer.AppendContent(packed, packedSize);
}
delete[] working;
- delete[] compressed;
+ delete[] packed;
}
}
else
+#endif
{
writer.AppendContent(data, size);
}
- frame.SetPackedSize(compressedSize);
+ frame.SetPackedSize(packedSize);
frame.SetUnpackedSize(size);
frame.SetWidth(width);
frame.SetHeight(height);
@@ -225,16 +243,7 @@ CXBTFFrame createXBTFFrame(SDL_Surface* image, CXBTFWriter& writer, double maxMS
argbFormat.BytesPerPixel = 4;
http://sourceforge.net/mailarchive/forum.php?forum_name=xbmc-svn&style=nested&viewmonth=201104
lzo1x_999_compress函数参数问题
最新推荐文章于 2021-05-22 08:52:17 发布