[MPlayer-cvslog] r22097 - trunk/libmpcodecs/vd_lzo.c

reimar subversion at mplayerhq.hu
Thu Feb 1 00:04:20 CET 2007


Author: reimar
Date: Thu Feb  1 00:04:20 2007
New Revision: 22097

Modified:
   trunk/libmpcodecs/vd_lzo.c

Log:
use ffmpeg's LZO


Modified: trunk/libmpcodecs/vd_lzo.c
==============================================================================
--- trunk/libmpcodecs/vd_lzo.c	(original)
+++ trunk/libmpcodecs/vd_lzo.c	Thu Feb  1 00:04:20 2007
@@ -6,12 +6,10 @@
 
 #include "vd_internal.h"
 
-#ifdef USE_LIBLZO
-#include <lzo1x.h>
+#ifdef USE_LIBAVUTIL_SO
+#include <ffmpeg/lzo.h>
 #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) {



More information about the MPlayer-cvslog mailing list