FFmpeg
Data Structures | Macros | Functions
lzo.c File Reference
#include <limits.h>
#include <stdint.h>
#include <string.h>
#include "avassert.h"
#include "intreadwrite.h"
#include "lzo.h"
#include "macros.h"
#include "mem.h"

Go to the source code of this file.

Data Structures

struct  LZOContext
 

Macros

#define OUTBUF_PADDED   1
 Define if we may write up to 12 bytes beyond the output buffer. More...
 
#define INBUF_PADDED   1
 Define if we may read up to 8 bytes beyond the input buffer. More...
 
#define GETB(c)   (*(c).in++)
 

Functions

static int get_byte (LZOContext *c)
 Reads one byte from the input buffer, avoiding an overrun. More...
 
static int get_len (LZOContext *c, int x, int mask)
 Decodes a length value in the coding used by lzo. More...
 
static void copy (LZOContext *c, int cnt)
 Copies bytes from input to output buffer with checking. More...
 
static void copy_backptr (LZOContext *c, int back, int cnt)
 Copies previously decoded bytes to current position. More...
 
int av_lzo1x_decode (void *out, int *outlen, const void *in, int *inlen)
 Decodes LZO 1x compressed data. More...
 

Macro Definition Documentation

◆ OUTBUF_PADDED

#define OUTBUF_PADDED   1

Define if we may write up to 12 bytes beyond the output buffer.

Definition at line 33 of file lzo.c.

◆ INBUF_PADDED

#define INBUF_PADDED   1

Define if we may read up to 8 bytes beyond the input buffer.

Definition at line 35 of file lzo.c.

◆ GETB

#define GETB (   c)    (*(c).in++)

Definition at line 56 of file lzo.c.

Function Documentation

◆ get_byte()

static int get_byte ( LZOContext c)
inlinestatic

Reads one byte from the input buffer, avoiding an overrun.

Returns
byte read

Definition at line 47 of file lzo.c.

Referenced by get_len().

◆ get_len()

static int get_len ( LZOContext c,
int  x,
int  mask 
)
inlinestatic

Decodes a length value in the coding used by lzo.

Parameters
xprevious byte value
maskbits used from x
Returns
decoded length value

Definition at line 67 of file lzo.c.

Referenced by av_lzo1x_decode().

◆ copy()

static void copy ( LZOContext c,
int  cnt 
)
inlinestatic

Copies bytes from input to output buffer with checking.

Parameters
cntnumber of bytes to copy, must be >= 0

Definition at line 87 of file lzo.c.

Referenced by av_lzo1x_decode().

◆ copy_backptr()

static void copy_backptr ( LZOContext c,
int  back,
int  cnt 
)
inlinestatic

Copies previously decoded bytes to current position.

Parameters
backhow many bytes back we start, must be > 0
cntnumber of bytes to copy, must be > 0

cnt > back is valid, this will copy the bytes we just copied, thus creating a repeating pattern with a period length of back.

Definition at line 120 of file lzo.c.

Referenced by av_lzo1x_decode().