30 #define OUTBUF_PADDED 1 32 #define INBUF_PADDED 1 53 #define GETB(c) (*(c).in++) 55 #define GETB(c) get_byte(&(c)) 83 if (cnt > c->
in_end - src) {
91 #if defined(INBUF_PADDED) && defined(OUTBUF_PADDED) 98 memcpy(dst, src, cnt);
131 if (*outlen <= 0 || *inlen <= 0) {
158 back = (
GETB(c) << 3) + ((x >> 2) & 7) + 1;
162 back = (
GETB(c) << 6) + (x >> 2) + 1;
165 back = (1 << 14) + ((x & 8) << 11);
167 back += (
GETB(c) << 6) + (x >> 2);
168 if (back == (1 << 14)) {
181 back = (1 << 11) + (
GETB(c) << 2) + (x >> 2) + 1;
184 back = (
GETB(c) << 2) + (x >> 2) + 1;
201 #include <lzo/lzo1x.h> 203 #define MAXSZ (10*1024*1024) 207 #define BENCHMARK_LIBLZO_SAFE 0 208 #define BENCHMARK_LIBLZO_UNSAFE 0 210 int main(
int argc,
char *argv[]) {
211 FILE *
in = fopen(argv[1],
"rb");
215 size_t s = fread(orig, 1, MAXSZ, in);
217 long tmp[LZO1X_MEM_COMPRESS];
221 lzo1x_999_compress(orig, s, comp, &clen, tmp);
222 for (i = 0; i < 300; i++) {
224 inlen = clen; outlen = MAXSZ;
225 #if BENCHMARK_LIBLZO_SAFE 226 if (lzo1x_decompress_safe(comp, inlen, decomp, &outlen,
NULL))
227 #elif BENCHMARK_LIBLZO_UNSAFE 228 if (lzo1x_decompress(comp, inlen, decomp, &outlen,
NULL))
235 if (memcmp(orig, decomp, s))
#define AV_LZO_ERROR
a non-specific error in the compressed bitstream
static int get_len(LZOContext *c, int x, int mask)
Decodes a length value in the coding used by lzo.
#define AV_LZO_OUTPUT_FULL
decoded data did not fit into output buffer
static void copy(LZOContext *c, int cnt)
Copies bytes from input to output buffer with checking.
static const uint16_t mask[17]
struct LZOContext LZOContext
void av_log(void *avcl, int level, const char *fmt,...)
void av_log_set_level(int level)
static void copy_backptr(LZOContext *c, int back, int cnt)
Copies previously decoded bytes to current position.
int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen)
Decodes LZO 1x compressed data.
#define AV_LZO_INPUT_DEPLETED
end of the input buffer reached before decoding finished
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
synthesis window for stochastic i
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
common internal and external API header
else dst[i][x+y *dst_stride[i]]
static void comp(unsigned char *dst, int dst_stride, unsigned char *src, int src_stride, int add)
void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
deliberately overlapping memcpy implementation
int main(int argc, char **argv)
#define AV_LZO_INVALID_BACKPTR
a reference to previously decoded data was wrong
static int get_byte(LZOContext *c)
Reads one byte from the input buffer, avoiding an overrun.