mirror of
https://github.com/mpv-player/mpv
synced 2025-01-24 19:37:30 +01:00
Remove internal NuppelVideo decoder, the code in libavcodec can decode
those files and some more and is far more maintainable. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28888 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
624d8ff171
commit
276a73e2f2
2
Makefile
2
Makefile
@ -92,7 +92,6 @@ SRCS_COMMON = asxparser.c \
|
||||
libmpcodecs/dec_video.c \
|
||||
libmpcodecs/img_format.c \
|
||||
libmpcodecs/mp_image.c \
|
||||
libmpcodecs/native/nuppelvideo.c \
|
||||
libmpcodecs/native/rtjpegn.c \
|
||||
libmpcodecs/native/xa_gsm.c \
|
||||
libmpcodecs/pullup.c \
|
||||
@ -102,7 +101,6 @@ SRCS_COMMON = asxparser.c \
|
||||
libmpcodecs/vd_mpegpes.c \
|
||||
libmpcodecs/vd_mtga.c \
|
||||
libmpcodecs/vd_null.c \
|
||||
libmpcodecs/vd_nuv.c \
|
||||
libmpcodecs/vd_raw.c \
|
||||
libmpcodecs/vd_sgi.c \
|
||||
libmpcodecs/vf.c \
|
||||
|
@ -319,14 +319,6 @@ videocodec ffnuv
|
||||
dll nuv
|
||||
out I420
|
||||
|
||||
videocodec nuv
|
||||
info "NuppelVideo"
|
||||
status working
|
||||
fourcc NUV1 ; NUV1 is an internal MPlayer FOURCC
|
||||
fourcc RJPG
|
||||
driver nuv
|
||||
out I420,IYUV
|
||||
|
||||
videocodec ffbmp
|
||||
info "FFmpeg BMP"
|
||||
status working
|
||||
|
@ -1,114 +0,0 @@
|
||||
/*
|
||||
* NuppelVideo 0.05 file parser
|
||||
* for MPlayer
|
||||
* by Panagiotis Issaris <takis@lumumba.luc.ac.be>
|
||||
*
|
||||
* Reworked by alex
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "mp_msg.h"
|
||||
#include "mpbswap.h"
|
||||
|
||||
#include "libvo/fastmemcpy.h"
|
||||
|
||||
#include "libmpdemux/nuppelvideo.h"
|
||||
#include "rtjpegn.h"
|
||||
#include "libavutil/lzo.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 = width * height + ( width * height ) / 2;
|
||||
struct rtframeheader *encodedh = ( struct rtframeheader* ) encoded;
|
||||
static unsigned char *buffer = 0; /* for RTJpeg with LZO decompress */
|
||||
#ifdef KEEP_BUFFER
|
||||
static unsigned char *previous_buffer = 0; /* to support Last-frame-copy */
|
||||
#endif
|
||||
|
||||
// printf("frametype: %c, comtype: %c, encoded_size: %d, width: %d, height: %d\n",
|
||||
// encodedh->frametype, encodedh->comptype, encoded_size, width, height);
|
||||
|
||||
le2me_rtframeheader(encodedh);
|
||||
switch(encodedh->frametype)
|
||||
{
|
||||
case 'D': /* additional data for compressors */
|
||||
{
|
||||
/* tables are in encoded */
|
||||
if (encodedh->comptype == 'R')
|
||||
{
|
||||
RTjpeg_init_decompress ( (unsigned long *)(encoded+12), width, height );
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_V, "Found RTjpeg tables (size: %d, width: %d, height: %d)\n",
|
||||
encoded_size-12, width, height);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'V':
|
||||
{
|
||||
int in_len = encodedh->packetlength;
|
||||
#ifdef KEEP_BUFFER
|
||||
if (!previous_buffer)
|
||||
previous_buffer = ( unsigned char * ) malloc ( out_len + AV_LZO_OUTPUT_PADDING );
|
||||
#endif
|
||||
|
||||
switch(encodedh->comptype)
|
||||
{
|
||||
case '0': /* raw YUV420 */
|
||||
fast_memcpy(decoded, encoded + 12, out_len);
|
||||
break;
|
||||
case '1': /* RTJpeg */
|
||||
RTjpeg_decompressYUV420 ( ( __s8 * ) encoded + 12, decoded );
|
||||
break;
|
||||
case '2': /* RTJpeg with LZO */
|
||||
if (!buffer)
|
||||
buffer = ( unsigned char * ) malloc ( out_len + AV_LZO_OUTPUT_PADDING );
|
||||
if (!buffer)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Nuppelvideo: error decompressing\n");
|
||||
break;
|
||||
}
|
||||
r = av_lzo1x_decode ( buffer, &out_len, encoded + 12, &in_len );
|
||||
if ( r )
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Nuppelvideo: error decompressing\n");
|
||||
break;
|
||||
}
|
||||
RTjpeg_decompressYUV420 ( ( __s8 * ) buffer, decoded );
|
||||
break;
|
||||
case '3': /* raw YUV420 with LZO */
|
||||
r = av_lzo1x_decode ( decoded, &out_len, encoded + 12, &in_len );
|
||||
if ( r )
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Nuppelvideo: error decompressing\n");
|
||||
break;
|
||||
}
|
||||
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
|
||||
fast_memcpy ( decoded, previous_buffer, width*height*3/2);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef KEEP_BUFFER
|
||||
fast_memcpy(previous_buffer, decoded, width*height*3/2);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default:
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_V, "Nuppelvideo: unknwon frametype: %c\n",
|
||||
encodedh->frametype);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -36,9 +36,7 @@
|
||||
#define __s64 int64_t
|
||||
|
||||
void RTjpeg_init_compress(__u32 *buf, int width, int height, __u8 Q);
|
||||
void RTjpeg_init_decompress(__u32 *buf, int width, int height);
|
||||
int RTjpeg_compressYUV420(__s8 *sp, unsigned char *bp);
|
||||
void RTjpeg_decompressYUV420(__s8 *sp, __u8 *bp);
|
||||
|
||||
void RTjpeg_init_mcompress(void);
|
||||
int RTjpeg_mcompressYUV420(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask);
|
||||
|
@ -35,7 +35,6 @@ extern vd_functions_t mpcodecs_vd_vfwex;
|
||||
extern vd_functions_t mpcodecs_vd_raw;
|
||||
extern vd_functions_t mpcodecs_vd_hmblck;
|
||||
extern vd_functions_t mpcodecs_vd_xanim;
|
||||
extern vd_functions_t mpcodecs_vd_nuv;
|
||||
extern vd_functions_t mpcodecs_vd_mpng;
|
||||
extern vd_functions_t mpcodecs_vd_ijpg;
|
||||
extern vd_functions_t mpcodecs_vd_mtga;
|
||||
@ -70,7 +69,6 @@ const vd_functions_t * const mpcodecs_vd_drivers[] = {
|
||||
&mpcodecs_vd_lzo,
|
||||
&mpcodecs_vd_raw,
|
||||
&mpcodecs_vd_hmblck,
|
||||
&mpcodecs_vd_nuv,
|
||||
#ifdef CONFIG_XANIM
|
||||
&mpcodecs_vd_xanim,
|
||||
#endif
|
||||
|
@ -1,54 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "mp_msg.h"
|
||||
|
||||
#include "vd_internal.h"
|
||||
|
||||
static vd_info_t info = {
|
||||
"NuppelVideo decoder",
|
||||
"nuv",
|
||||
"A'rpi",
|
||||
"Alex & Panagiotis Issaris <takis@lumumba.luc.ac.be>",
|
||||
"native codecs"
|
||||
};
|
||||
|
||||
LIBVD_EXTERN(nuv)
|
||||
|
||||
// to set/get/query special features/parameters
|
||||
static int control(sh_video_t *sh,int cmd,void* arg,...){
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
|
||||
// init driver
|
||||
static int init(sh_video_t *sh){
|
||||
return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_I420);
|
||||
}
|
||||
|
||||
// uninit driver
|
||||
static void uninit(sh_video_t *sh){
|
||||
}
|
||||
|
||||
//mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
||||
|
||||
void decode_nuv(
|
||||
unsigned char *encoded,
|
||||
int encoded_size,
|
||||
unsigned char *decoded,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// decode a frame
|
||||
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
||||
mp_image_t* mpi;
|
||||
if(len<=0) return NULL; // skipped frame
|
||||
|
||||
mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0,
|
||||
sh->disp_w, sh->disp_h);
|
||||
if(!mpi) return NULL;
|
||||
|
||||
decode_nuv(data, len, mpi->planes[0], sh->disp_w, sh->disp_h);
|
||||
|
||||
return mpi;
|
||||
}
|
Loading…
Reference in New Issue
Block a user