30#define MAXSZ (10*1024*1024)
34#define BENCHMARK_LIBLZO_SAFE 0
35#define BENCHMARK_LIBLZO_UNSAFE 0
37int main(
int argc,
char *argv[]) {
38 FILE *in = fopen(argv[1],
"rb");
39 int comp_level = argc > 2 ? atoi(argv[2]) : 0;
43 size_t s = fread(orig, 1,
MAXSZ, in);
45 long tmp[LZO1X_MEM_COMPRESS];
49 if (comp_level == 0) {
50 lzo1x_1_compress(orig,
s,
comp, &clen,
tmp);
51 }
else if (comp_level == 11) {
52 lzo1x_1_11_compress(orig,
s,
comp, &clen,
tmp);
53 }
else if (comp_level == 12) {
54 lzo1x_1_12_compress(orig,
s,
comp, &clen,
tmp);
55 }
else if (comp_level == 15) {
56 lzo1x_1_15_compress(orig,
s,
comp, &clen,
tmp);
58 lzo1x_999_compress(orig,
s,
comp, &clen,
tmp);
59 for (
i = 0;
i < 300;
i++) {
60 inlen = clen; outlen =
MAXSZ;
61#if BENCHMARK_LIBLZO_SAFE
62 if (lzo1x_decompress_safe(
comp, inlen, decomp, &outlen,
NULL))
63#elif BENCHMARK_LIBLZO_UNSAFE
64 if (lzo1x_decompress(
comp, inlen, decomp, &outlen,
NULL))
70 if (memcmp(orig, decomp,
s))
#define i(width, name, range_min, range_max)
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_log_set_level(int level)
Set the log level.
int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen)
Decodes LZO 1x compressed data.
Memory handling functions.