[MPlayer-cvslog] r22098 - trunk/libmpcodecs/native/nuppelvideo.c

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


Author: reimar
Date: Thu Feb  1 00:20:03 2007
New Revision: 22098

Modified:
   trunk/libmpcodecs/native/nuppelvideo.c

Log:
Use ffmpeg lzo instead of (also quite outdated) minlzo in nuppelvideo.


Modified: trunk/libmpcodecs/native/nuppelvideo.c
==============================================================================
--- trunk/libmpcodecs/native/nuppelvideo.c	(original)
+++ trunk/libmpcodecs/native/nuppelvideo.c	Thu Feb  1 00:20:03 2007
@@ -20,7 +20,11 @@
 
 #include "libmpdemux/nuppelvideo.h" 
 #include "RTjpegN.h"
-#include "minilzo.h"
+#ifdef USE_LIBAVUTIL_SO
+#include <ffmpeg/lzo.h>
+#else
+#include "libavutil/lzo.h"
+#endif
 
 #define KEEP_BUFFER
 
@@ -34,7 +38,6 @@
 #ifdef KEEP_BUFFER
 	static unsigned char *previous_buffer = 0; /* to support Last-frame-copy */
 #endif
-	static int is_lzo_inited = 0;
 
 //	printf("frametype: %c, comtype: %c, encoded_size: %d, width: %d, height: %d\n",
 //	    encodedh->frametype, encodedh->comptype, encoded_size, width, height);
@@ -55,23 +58,12 @@
 	    }
 	    case 'V':
 	    {
+		int in_len = encodedh->packetlength;
 #ifdef KEEP_BUFFER		
 		if (!previous_buffer) 
-			previous_buffer = ( unsigned char * ) malloc ( out_len );
+			previous_buffer = ( unsigned char * ) malloc ( out_len + LZO_OUTPUT_PADDING );
 #endif
 
-		if (((encodedh->comptype == '2') ||
-		    (encodedh->comptype == '3')) && !is_lzo_inited)
-		{
-		    /* frame using lzo, init lzo first if not inited */
-		    if ( lzo_init() != LZO_E_OK ) 
-		    {
-			mp_msg(MSGT_DECVIDEO, MSGL_ERR, "LZO init failed\n");
-			return;
-		    }
-		    is_lzo_inited = 1;
-		}
-
 		switch(encodedh->comptype)
 		{
 		    case '0': /* raw YUV420 */
@@ -82,14 +74,14 @@
 			break;
 		    case '2': /* RTJpeg with LZO */
 			if (!buffer) 
-			    buffer = ( unsigned char * ) malloc ( out_len );
+			    buffer = ( unsigned char * ) malloc ( out_len + LZO_OUTPUT_PADDING );
 			if (!buffer)
 			{
 			    mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Nuppelvideo: error decompressing\n");
 			    break;
 			}
-			r = lzo1x_decompress_safe ( encoded + 12, encodedh->packetlength, buffer, &out_len, NULL );
-			if ( r != LZO_E_OK ) 
+			r = lzo1x_decode ( buffer, &out_len, encoded + 12, &in_len );
+			if ( r ) 
 			{
 			    mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Nuppelvideo: error decompressing\n");
 			    break;
@@ -97,8 +89,8 @@
 			RTjpeg_decompressYUV420 ( ( __s8 * ) buffer, decoded );
 			break;
 		    case '3': /* raw YUV420 with LZO */
-			r = lzo1x_decompress_safe ( encoded + 12, encodedh->packetlength, decoded, &out_len, NULL );
-			if ( r != LZO_E_OK ) 
+			r = lzo1x_decode ( decoded, &out_len, encoded + 12, &in_len );
+			if ( r ) 
 			{
 			    mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Nuppelvideo: error decompressing\n");
 			    break;



More information about the MPlayer-cvslog mailing list