Mercurial > libavutil.hg
comparison lzo.c @ 724:0a1867c7ec5e libavutil
Give liblzo benchmark conditionals more descriptive names and add convenience
definitions along with instructions for changing them.
author | diego |
---|---|
date | Thu, 09 Apr 2009 15:11:48 +0000 |
parents | a44606418c82 |
children |
comparison
equal
deleted
inserted
replaced
723:db9e213fcc5b | 724:0a1867c7ec5e |
---|---|
237 #ifdef TEST | 237 #ifdef TEST |
238 #include <stdio.h> | 238 #include <stdio.h> |
239 #include <lzo/lzo1x.h> | 239 #include <lzo/lzo1x.h> |
240 #include "log.h" | 240 #include "log.h" |
241 #define MAXSZ (10*1024*1024) | 241 #define MAXSZ (10*1024*1024) |
242 | |
243 /* Define one of these to 1 if you wish to benchmark liblzo | |
244 * instead of our native implementation. */ | |
245 #define BENCHMARK_LIBLZO_SAFE 0 | |
246 #define BENCHMARK_LIBLZO_UNSAFE 0 | |
247 | |
242 int main(int argc, char *argv[]) { | 248 int main(int argc, char *argv[]) { |
243 FILE *in = fopen(argv[1], "rb"); | 249 FILE *in = fopen(argv[1], "rb"); |
244 uint8_t *orig = av_malloc(MAXSZ + 16); | 250 uint8_t *orig = av_malloc(MAXSZ + 16); |
245 uint8_t *comp = av_malloc(2*MAXSZ + 16); | 251 uint8_t *comp = av_malloc(2*MAXSZ + 16); |
246 uint8_t *decomp = av_malloc(MAXSZ + 16); | 252 uint8_t *decomp = av_malloc(MAXSZ + 16); |
252 av_log_set_level(AV_LOG_DEBUG); | 258 av_log_set_level(AV_LOG_DEBUG); |
253 lzo1x_999_compress(orig, s, comp, &clen, tmp); | 259 lzo1x_999_compress(orig, s, comp, &clen, tmp); |
254 for (i = 0; i < 300; i++) { | 260 for (i = 0; i < 300; i++) { |
255 START_TIMER | 261 START_TIMER |
256 inlen = clen; outlen = MAXSZ; | 262 inlen = clen; outlen = MAXSZ; |
257 #ifdef LIBLZO | 263 #if BENCHMARK_LIBLZO_SAFE |
258 if (lzo1x_decompress_safe(comp, inlen, decomp, &outlen, NULL)) | 264 if (lzo1x_decompress_safe(comp, inlen, decomp, &outlen, NULL)) |
259 #elif defined(LIBLZO_UNSAFE) | 265 #elif BENCHMARK_LIBLZO_UNSAFE |
260 if (lzo1x_decompress(comp, inlen, decomp, &outlen, NULL)) | 266 if (lzo1x_decompress(comp, inlen, decomp, &outlen, NULL)) |
261 #else | 267 #else |
262 if (av_lzo1x_decode(decomp, &outlen, comp, &inlen)) | 268 if (av_lzo1x_decode(decomp, &outlen, comp, &inlen)) |
263 #endif | 269 #endif |
264 av_log(NULL, AV_LOG_ERROR, "decompression error\n"); | 270 av_log(NULL, AV_LOG_ERROR, "decompression error\n"); |