# HG changeset patch # User reimar # Date 1170284660 0 # Node ID d018c5b9e0e6b7f8d6276f2a4f574e2129be5cfa # Parent 9fd2145ddb430de249ee27ffa6c7de09cdf75f5c use ffmpeg's LZO diff -r 9fd2145ddb43 -r d018c5b9e0e6 libmpcodecs/vd_lzo.c --- a/libmpcodecs/vd_lzo.c Wed Jan 31 22:17:52 2007 +0000 +++ b/libmpcodecs/vd_lzo.c Wed Jan 31 23:04:20 2007 +0000 @@ -6,12 +6,10 @@ #include "vd_internal.h" -#ifdef USE_LIBLZO -#include +#ifdef USE_LIBAVUTIL_SO +#include #else -#include "native/minilzo.h" -#define lzo_malloc malloc -#define lzo_free free +#include "libavutil/lzo.h" #endif #define MOD_NAME "DecLZO" @@ -27,7 +25,6 @@ LIBVD_EXTERN(lzo) typedef struct { - lzo_byte *wrkmem; uint8_t *buffer; int bufsz; int codec; @@ -51,8 +48,8 @@ { lzo_context_t *priv; - if (lzo_init() != LZO_E_OK) { - mp_msg (MSGT_DECVIDEO, MSGL_ERR, "[%s] lzo_init() failed\n", MOD_NAME); + if (sh->bih->biSizeImage <= 0) { + mp_msg (MSGT_DECVIDEO, MSGL_ERR, "[%s] Invalid frame size\n", MOD_NAME); return 0; } @@ -63,17 +60,10 @@ return 0; } priv->bufsz = sh->bih->biSizeImage; - priv->buffer = malloc(priv->bufsz); + priv->buffer = malloc(priv->bufsz + LZO_OUTPUT_PADDING); priv->codec = -1; sh->context = priv; - priv->wrkmem = (lzo_bytep) lzo_malloc(LZO1X_1_MEM_COMPRESS); - - if (priv->wrkmem == NULL) { - mp_msg (MSGT_DECVIDEO, MSGL_ERR, "[%s] Cannot alloc work memory\n", MOD_NAME); - return 0; - } - return 1; } @@ -84,8 +74,6 @@ if (priv) { - if (priv->wrkmem) - lzo_free(priv->wrkmem); free(priv->buffer); free(priv); } @@ -105,8 +93,8 @@ return NULL; // skipped frame } - r = lzo1x_decompress_safe (data, len, priv->buffer, &w, priv->wrkmem); - if (r != LZO_E_OK) { + r = lzo1x_decode(priv->buffer, &w, data, &len); + if (r) { /* this should NEVER happen */ mp_msg (MSGT_DECVIDEO, MSGL_ERR, "[%s] internal error - decompression failed: %d\n", MOD_NAME, r); @@ -119,7 +107,7 @@ MOD_NAME, sh->bih->biBitCount, sh->format, data, len, sh->bih->biSizeImage ); - if (w == (sh->bih->biSizeImage)) { + if (w == 0) { priv->codec = IMGFMT_BGR24; mp_msg (MSGT_DECVIDEO, MSGL_V, "[%s] codec choosen is BGR24\n", MOD_NAME); } else if (w == (sh->bih->biSizeImage)/2) {