[Mplayer-cvslog] CVS: main nuppelvideo.c,NONE,1.1 Makefile,1.129,1.130 codec-cfg.c,1.56,1.57 codec-cfg.h,1.31,1.32 dec_video.c,1.79,1.80
Alex Beregszaszi
alex at mplayer.dev.hu
Thu Dec 27 22:32:21 CET 2001
Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv24217
Modified Files:
Makefile codec-cfg.c codec-cfg.h dec_video.c
Added Files:
nuppelvideo.c
Log Message:
NuppelVideo decoder added, based on Panagiotis Issaris' patch
--- NEW FILE ---
/*
* NuppelVideo 0.05 file parser
* for MPlayer
* by Panagiotis Issaris <takis at lumumba.luc.ac.be>
*
* Reworked by alex
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "config.h"
#include "mp_msg.h"
#include "libmpdemux/nuppelvideo.h"
#include "RTjpegN.h"
#include "minilzo.h"
#define KEEP_BUFFER
void decode_nuv( unsigned char *encoded, int encoded_size,
unsigned char *decoded, int width, int height)
{
int r;
unsigned int out_len;
struct rtframeheader *encodedh = ( struct rtframeheader* ) encoded;
static unsigned char *buffer = 0;
static unsigned char *previous_buffer = 0;
static is_lzo_inited = 0;
// printf("NUV packet: frametype: %c comptype: %c\n",
// encodedh->frametype, encodedh->comptype);
switch(encodedh->frametype)
{
case 'D': /* additional data for compressors */
{
/* tables are in encoded */
if (encodedh->comptype == 'R')
{
RTjpeg_init_decompress ( encoded, width, height );
printf("Found RTjpeg tables\n");
}
break;
}
case 'V':
{
/* do the buffer stuffs */
if ( buffer == NULL )
{
buffer = ( unsigned char * ) malloc ( width * height + ( width * height ) / 2 );
#if 0
printf ( "Allocated for %dx%d image %d bytes\n", width, height,
width * height + ( width * height ) / 2 );
#endif
}
#ifdef KEEP_BUFFER
if ( previous_buffer == NULL )
{
previous_buffer = ( unsigned char * ) malloc ( width * height + ( width * height ) / 2 );
#if 0
printf ( "Allocated for %dx%d image %d bytes\n", width, height,
width * height + ( width * height ) / 2 );
#endif
}
#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 )
{
fprintf ( stderr, "%s\n", "lzo_init() failed !!!" );
return NULL;
}
is_lzo_inited = 1;
}
switch(encodedh->comptype)
{
case '0': /* raw YUV420 */
memcpy(decoded, encoded + 12, width*height*3/2);
break;
case '1': /* RTJpeg */
RTjpeg_decompressYUV420 ( ( __s8 * ) encoded + 12, decoded );
break;
case '2': /* RTJpeg with LZO */
r = lzo1x_decompress ( encoded + 12, encodedh->packetlength, buffer, &out_len, NULL );
if ( r != LZO_E_OK )
{
printf ( "Error decompressing\n" );
}
RTjpeg_decompressYUV420 ( ( __s8 * ) buffer, decoded );
break;
case '3': /* raw YUV420 with LZO */
r = lzo1x_decompress ( encoded + 12, encodedh->packetlength, buffer, &out_len, NULL );
if ( r != LZO_E_OK )
{
printf ( "Error decompressing\n" );
}
memcpy(decoded, buffer, width*height*3/2);
break;
case 'N': /* black frame */
memset ( decoded, 0, width * height );
memset ( decoded + width * height, 127, width * height / 2);
break;
case 'L': /* copy last frame */
#ifdef KEEP_BUFFER
memcpy ( decoded, previous_buffer, width*height*3/2);
#endif
break;
}
#ifdef KEEP_BUFFER
memcpy(previous_buffer, decoded, width*height*3/2);
#endif
break;
}
default:
printf("Unknown chunk: %c\n", encodedh->frametype);
}
}
Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/Makefile,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -r1.129 -r1.130
--- Makefile 27 Dec 2001 14:31:33 -0000 1.129
+++ Makefile 27 Dec 2001 21:32:17 -0000 1.130
@@ -22,7 +22,7 @@
# a BSD compatible 'install' program
INSTALL = install
-SRCS_COMMON = adpcm.c xacodec.c cpudetect.c mp_msg.c ac3-iec958.c dec_audio.c dec_video.c msvidc.c cinepak.c fli.c qtrle.c codec-cfg.c cfgparser.c my_profile.c
+SRCS_COMMON = adpcm.c xacodec.c cpudetect.c mp_msg.c ac3-iec958.c dec_audio.c dec_video.c msvidc.c cinepak.c fli.c qtrle.c codec-cfg.c cfgparser.c my_profile.c RTjpegN.c minilzo.c nuppelvideo.c
SRCS_MENCODER = mencoder.c $(SRCS_COMMON) libao2/afmt.c divx4_vbr.c libvo/aclib.c libvo/img_format.c
SRCS_MPLAYER = mplayer.c $(SRCS_COMMON) find_sub.c subreader.c lirc_mp.c mixer.c spudec.c
Index: codec-cfg.c
===================================================================
RCS file: /cvsroot/mplayer/main/codec-cfg.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- codec-cfg.c 27 Dec 2001 18:38:10 -0000 1.56
+++ codec-cfg.c 27 Dec 2001 21:32:17 -0000 1.57
@@ -237,6 +237,7 @@
"fli",
"cinepak",
"qtrle",
+ "nuv",
NULL
};
char **drv=audioflag?audiodrv:videodrv;
Index: codec-cfg.h
===================================================================
RCS file: /cvsroot/mplayer/main/codec-cfg.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- codec-cfg.h 27 Dec 2001 18:38:10 -0000 1.31
+++ codec-cfg.h 27 Dec 2001 21:32:17 -0000 1.32
@@ -49,6 +49,7 @@
#define VFM_FLI 12
#define VFM_CINEPAK 13
#define VFM_QTRLE 14
+#define VFM_NUV 15
#ifndef GUID_TYPE
#define GUID_TYPE
Index: dec_video.c
===================================================================
RCS file: /cvsroot/mplayer/main/dec_video.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- dec_video.c 25 Dec 2001 20:36:40 -0000 1.79
+++ dec_video.c 27 Dec 2001 21:32:17 -0000 1.80
@@ -128,6 +128,13 @@
int encoded_bpp,
int bytes_per_pixel);
+void decode_nuv(
+ unsigned char *encoded,
+ int encoded_size,
+ unsigned char *decoded,
+ int width,
+ int height);
+
//**************************************************************************//
// The OpenDivX stuff:
//**************************************************************************//
@@ -544,7 +551,10 @@
" this Quicktime file to the MPlayer FTP, the team could look at it.\n",
sh_video->bih->biBitCount);
+ break;
}
+ case VFM_NUV:
+ sh_video->our_out_buffer = (char *)memalign(64, sh_video->disp_w*sh_video->disp_h*3/2);
break;
}
}
@@ -803,6 +813,12 @@
start, in_size, sh_video->our_out_buffer,
sh_video->disp_w, sh_video->disp_h,
((out_fmt&255)+7)/8);
+ blit_frame = 3;
+ break;
+ case VFM_NUV:
+ decode_nuv(
+ start, in_size, sh_video->our_out_buffer,
+ sh_video->disp_w, sh_video->disp_h);
blit_frame = 3;
break;
case VFM_QTRLE:
More information about the MPlayer-cvslog
mailing list