diff options
author | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-07-14 17:14:16 +0000 |
---|---|---|
committer | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-07-14 17:14:16 +0000 |
commit | f89a7da6043d51f97e8c8c9d7cae64d205b21866 (patch) | |
tree | dfb2920478c3c297ee68a0a5aaed33c9d3072fd9 /libmpcodecs | |
parent | cb2e693d2246c450842810b1e49452a49489938a (diff) | |
download | mpv-f89a7da6043d51f97e8c8c9d7cae64d205b21866.tar.bz2 mpv-f89a7da6043d51f97e8c8c9d7cae64d205b21866.tar.xz |
Remove support for obsolete and non-free divx4/odivx libraries.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19087 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r-- | libmpcodecs/Makefile | 9 | ||||
-rw-r--r-- | libmpcodecs/vd.c | 8 | ||||
-rw-r--r-- | libmpcodecs/vd_divx4.c | 327 | ||||
-rw-r--r-- | libmpcodecs/vd_odivx.c | 296 | ||||
-rw-r--r-- | libmpcodecs/ve.c | 4 | ||||
-rw-r--r-- | libmpcodecs/ve_divx4.c | 488 |
6 files changed, 0 insertions, 1132 deletions
diff --git a/libmpcodecs/Makefile b/libmpcodecs/Makefile index 4ba58764a3..a34ddca630 100644 --- a/libmpcodecs/Makefile +++ b/libmpcodecs/Makefile @@ -104,12 +104,6 @@ endif ifeq ($(LIBTHEORA),yes) VIDEO_SRCS+=vd_theora.c endif -ifeq ($(DIVX),yes) -VIDEO_SRCS+=vd_odivx.c - ifneq ($(OPENDIVX),yes) - VIDEO_SRCS+=vd_divx4.c - endif -endif ifeq ($(XVID4),yes) VIDEO_SRCS+=vd_xvid4.c else @@ -244,9 +238,6 @@ else ENCODER_SRCS+=ve_xvid.c endif endif -ifeq ($(DIVX4ENCORE),yes) -ENCODER_SRCS+=ve_divx4.c -endif ifeq ($(X264),yes) ENCODER_SRCS+=ve_x264.c endif diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c index 8c11c4e015..c6c2f5437b 100644 --- a/libmpcodecs/vd.c +++ b/libmpcodecs/vd.c @@ -34,8 +34,6 @@ extern vd_functions_t mpcodecs_vd_dshow; extern vd_functions_t mpcodecs_vd_dmo; extern vd_functions_t mpcodecs_vd_vfw; extern vd_functions_t mpcodecs_vd_vfwex; -extern vd_functions_t mpcodecs_vd_odivx; -extern vd_functions_t mpcodecs_vd_divx4; extern vd_functions_t mpcodecs_vd_raw; extern vd_functions_t mpcodecs_vd_hmblck; extern vd_functions_t mpcodecs_vd_xanim; @@ -67,12 +65,6 @@ vd_functions_t* mpcodecs_vd_drivers[] = { &mpcodecs_vd_vfw, &mpcodecs_vd_vfwex, #endif -#ifdef USE_DIVX - &mpcodecs_vd_odivx, -#ifdef NEW_DECORE - &mpcodecs_vd_divx4, -#endif -#endif &mpcodecs_vd_lzo, &mpcodecs_vd_raw, &mpcodecs_vd_hmblck, diff --git a/libmpcodecs/vd_divx4.c b/libmpcodecs/vd_divx4.c deleted file mode 100644 index a06a7d955e..0000000000 --- a/libmpcodecs/vd_divx4.c +++ /dev/null @@ -1,327 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <assert.h> - -#include "config.h" -#include "mp_msg.h" -#include "help_mp.h" - -#include "vd_internal.h" - -static vd_info_t info = { -#ifdef DECORE_DIVX5 - "DivX5Linux lib", -#else -#ifdef DECORE_XVID - "XviD lib (divx4 compat.)", -#else - "DivX4Linux lib", -#endif /* #ifdef DECORE_XVID */ -#endif /* #ifdef DECORE_DIVX5 */ - "divx4", - "A'rpi", -#ifdef DECORE_XVID - "http://www.xvid.com", -#else - "http://www.divx.com", -#endif /* #ifdef DECORE_XVID */ - "native binary codec" -}; - -LIBVD_EXTERN(divx4) - -#ifdef DECORE_XVID -#include <divx4.h> -#else -#include <decore.h> -#endif /* #ifdef DECORE_XVID */ - -#define USE_DIVX_BUILTIN_PP - -#ifndef DECORE_VERSION -#define DECORE_VERSION 0 -#endif - -#if DECORE_VERSION >= 20021112 -static void* dec_handle = NULL; -#endif - -// to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,void* arg,...){ - switch(cmd){ -#ifdef USE_DIVX_BUILTIN_PP - case VDCTRL_QUERY_MAX_PP_LEVEL: -#if DECORE_VERSION >= 20021112 - return 6; // divx4linux >= 5.0.5 -> 0..60 -#else - return 10; // divx4linux < 5.0.5 -> 0..100 -#endif /* #if DECORE_VERSION >= 20021112 */ - case VDCTRL_SET_PP_LEVEL: { - int quality=*((int*)arg); -#if DECORE_VERSION >= 20021112 - int32_t iInstruction, iPostproc; - if(quality<0 || quality>6) quality=6; - iInstruction = DEC_ADJ_POSTPROCESSING | DEC_ADJ_SET; - iPostproc = quality*10; - decore(dec_handle, DEC_OPT_ADJUST, &iInstruction, &iPostproc); -#else - DEC_SET dec_set; - if(quality<0 || quality>10) quality=10; - dec_set.postproc_level=quality*10; - decore(0x123,DEC_OPT_SETPP,&dec_set,NULL); -#endif /* #if DECORE_VERSION >= 20021112 */ - return CONTROL_OK; - } -#endif /* #ifdef USE_DIVX_BUILTIN_PP */ -#if DECORE_VERSION >= 20011010 - case VDCTRL_SET_EQUALIZER: { - va_list ap; - int value; - int option; - va_start(ap, arg); - value=va_arg(ap, int); - va_end(ap); - - if(!strcasecmp(arg,"Brightness")) -#if DECORE_VERSION >= 20021112 - option=DEC_ADJ_BRIGHTNESS | DEC_ADJ_SET; -#else - option=DEC_GAMMA_BRIGHTNESS; -#endif /* #if DECORE_VERSION >= 20021112 */ - else if(!strcasecmp(arg, "Contrast")) -#if DECORE_VERSION >= 20021112 - option=DEC_ADJ_CONTRAST | DEC_ADJ_SET; -#else - option=DEC_GAMMA_CONTRAST; -#endif /* #if DECORE_VERSION >= 20021112 */ - else if(!strcasecmp(arg,"Saturation")) -#if DECORE_VERSION >= 20021112 - option=DEC_ADJ_SATURATION | DEC_ADJ_SET; -#else - option=DEC_GAMMA_SATURATION; -#endif /* #if DECORE_VERSION >= 20021112 */ - else return CONTROL_FALSE; - - value = (value * 128) / 100; -#if DECORE_VERSION >= 20021112 - decore(dec_handle, DEC_OPT_ADJUST, &option, &value); -#else - decore(0x123, DEC_OPT_GAMMA, (void *)option, (void *) value); -#endif /* #if DECORE_VERSION >= 20021112 */ - return CONTROL_OK; - } -#endif /* #if DECORE_VERSION >= 20011010 */ - - } - - return CONTROL_UNKNOWN; -} - -// init driver -static int init(sh_video_t *sh){ -#if DECORE_VERSION >= 20021112 - DEC_INIT dec_init; - int iSize=sizeof(DivXBitmapInfoHeader); - DivXBitmapInfoHeader* pbi=malloc(iSize); - int32_t iInstruction; - - if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0; - - memset(&dec_init, 0, sizeof(dec_init)); - memset(pbi, 0, iSize); - - switch(sh->format) { - case mmioFOURCC('D','I','V','3'): - dec_init.codec_version = 311; - break; - case mmioFOURCC('D','I','V','X'): - dec_init.codec_version = 412; - break; - case mmioFOURCC('D','X','5','0'): - default: // Fallback to DivX 5 behaviour - dec_init.codec_version = 500; - } - - // no smoothing of the CPU load - dec_init.smooth_playback = 0; - - pbi->biSize=iSize; - - switch(sh->codec->outfmt[sh->outfmtidx]){ - case IMGFMT_YV12: { - pbi->biCompression=mmioFOURCC('Y','V','1','2'); - break; - } - case IMGFMT_YUY2: { - pbi->biCompression=mmioFOURCC('Y','U','Y','2'); - break; - } - case IMGFMT_UYVY: { - pbi->biCompression=mmioFOURCC('U','Y','V','Y'); - break; - } - case IMGFMT_I420: { - pbi->biCompression=mmioFOURCC('I','4','2','0'); - break; - } - case IMGFMT_BGR15: { - pbi->biCompression=0; - pbi->biBitCount=16; - break; - } - case IMGFMT_BGR16: { - pbi->biCompression=3; - pbi->biBitCount=16; - break; - } - case IMGFMT_BGR24: { - pbi->biCompression=0; - pbi->biBitCount=24; - break; - } - case IMGFMT_BGR32: { - pbi->biCompression=0; - pbi->biBitCount=32; - break; - } - default: - mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Unsupported out_fmt: 0x%X\n",sh->codec->outfmt[sh->outfmtidx]); - return 0; - } - - pbi->biWidth = sh->disp_w; - pbi->biHeight = sh->disp_h; - - decore(&dec_handle, DEC_OPT_INIT, &dec_init, NULL); - decore(dec_handle, DEC_OPT_SETOUT, pbi, NULL); - -#ifdef USE_DIVX_BUILTIN_PP - iInstruction = DEC_ADJ_POSTPROCESSING | DEC_ADJ_SET; - decore(dec_handle, DEC_OPT_ADJUST, &iInstruction, &divx_quality); -#endif - - free(pbi); -#else /* DECORE_VERSION >= 20021112 */ - DEC_PARAM dec_param; - DEC_SET dec_set; - int bits=16; - -#ifndef NEW_DECORE - if(sh->format==mmioFOURCC('D','I','V','3')){ - mp_msg(MSGT_DECVIDEO,MSGL_INFO,"DivX 3.x not supported by opendivx decore - it requires divx4linux\n"); - return 0; // not supported - } -#endif -#ifndef DECORE_DIVX5 - if(sh->format==mmioFOURCC('D','X','5','0')){ - mp_msg(MSGT_DECVIDEO,MSGL_INFO,"DivX 5.00 not supported by divx4linux decore - it requires divx5linux\n"); - return 0; // not supported - } -#endif - - if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0; - - memset(&dec_param,0,sizeof(dec_param)); - - switch(sh->codec->outfmt[sh->outfmtidx]){ - case IMGFMT_YV12: dec_param.output_format=DEC_YV12;bits=12;break; - case IMGFMT_YUY2: dec_param.output_format=DEC_YUY2;break; - case IMGFMT_UYVY: dec_param.output_format=DEC_UYVY;break; - case IMGFMT_I420: dec_param.output_format=DEC_420;bits=12;break; - case IMGFMT_BGR15: dec_param.output_format=DEC_RGB555_INV;break; - case IMGFMT_BGR16: dec_param.output_format=DEC_RGB565_INV;break; - case IMGFMT_BGR24: dec_param.output_format=DEC_RGB24_INV;bits=24;break; - case IMGFMT_BGR32: dec_param.output_format=DEC_RGB32_INV;bits=32;break; - default: - mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Unsupported out_fmt: 0x%X\n",sh->codec->outfmt[sh->outfmtidx]); - return 0; - } -#ifdef DECORE_DIVX5 - switch(sh->format) { - case mmioFOURCC('D','I','V','3'): - dec_param.codec_version = 311; - break; - case mmioFOURCC('D','I','V','X'): - dec_param.codec_version = 400; - break; - case mmioFOURCC('D','X','5','0'): - default: // Fallback to DivX 5 behaviour - dec_param.codec_version = 500; - } - dec_param.build_number = 0; -#endif - dec_param.x_dim = sh->disp_w; - dec_param.y_dim = sh->disp_h; - decore(0x123, DEC_OPT_INIT, &dec_param, NULL); - -#ifdef USE_DIVX_BUILTIN_PP - dec_set.postproc_level = divx_quality; - decore(0x123, DEC_OPT_SETPP, &dec_set, NULL); -#endif -#endif /* DECORE_VERSION >= 20021112 */ - - mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: DivX4Linux video codec init OK!\n"); - - return 1; -} - -// uninit driver -static void uninit(sh_video_t *sh){ -#if DECORE_VERSION >= 20021112 - decore(dec_handle, DEC_OPT_RELEASE, NULL, NULL); - dec_handle = NULL; -#else - decore(0x123,DEC_OPT_RELEASE,NULL,NULL); -#endif -} - -//mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); - -// decode a frame -static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ - mp_image_t* mpi; - DEC_FRAME dec_frame; -#ifndef USE_DIVX_BUILTIN_PP - DEC_FRAME_INFO frameinfo; -#endif - - if(len<=0) return NULL; // skipped frame - - dec_frame.length = len; - dec_frame.bitstream = data; - dec_frame.render_flag = (flags&VDFLAGS_DROPFRAME)?0:1; - - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_PRESERVE | MP_IMGFLAG_ACCEPT_WIDTH, - sh->disp_w, sh->disp_h); - if(!mpi) return NULL; - - dec_frame.bmp=mpi->planes[0]; - dec_frame.stride=mpi->width; - - decore( -#if DECORE_VERSION >= 20021112 - dec_handle, -#else - 0x123, -#endif -#ifndef DEC_OPT_FRAME_311 - DEC_OPT_FRAME, -#else - (sh->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME, -#endif - &dec_frame, -#ifndef USE_DIVX_BUILTIN_PP - &frameinfo -#else - NULL -#endif - ); - -#ifndef USE_DIVX_BUILTIN_PP - mpi->qscale = frameinfo.quant_store; - mpi->qstride = frameinfo.quant_stride; -#endif - - return mpi; -} diff --git a/libmpcodecs/vd_odivx.c b/libmpcodecs/vd_odivx.c deleted file mode 100644 index 5f9962ed50..0000000000 --- a/libmpcodecs/vd_odivx.c +++ /dev/null @@ -1,296 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <assert.h> - -#include "config.h" -#include "mp_msg.h" -#include "help_mp.h" - -#include "vd_internal.h" - -static vd_info_t info = { -#ifdef NEW_DECORE -#ifdef DECORE_DIVX5 - "DivX5Linux lib (odivx compat.)", -#else -#ifdef DECORE_XVID - "XviD lib (odivx compat.)", -#else - "DivX4Linux lib (odivx compat.)", -#endif -#endif -#else - "Opendivx 0.48 codec", -#endif - "odivx", - "A'rpi", -#ifdef NEW_DECORE -#ifdef DECORE_XVID - "http://www.xvid.com", -#else - "http://www.divx.com", -#endif -#else - "http://www.projectmayo.org", -#endif -#ifdef NEW_DECORE - "native binary codec" -#else - "native codec" -#endif -}; - -LIBVD_EXTERN(odivx) - -#ifndef NEW_DECORE -#include "opendivx/decore.h" -#include "libpostproc/postprocess.h" -#elif DECORE_XVID -#include <divx4.h> -#else -#include <decore.h> -#endif - -#ifndef DECORE_VERSION -#define DECORE_VERSION 0 -#endif - -#if DECORE_VERSION >= 20021112 -static void* dec_handle = NULL; -#endif - -//**************************************************************************// -// The OpenDivX stuff: -//**************************************************************************// - -#ifndef NEW_DECORE - -static unsigned char *opendivx_src[3]; -static int opendivx_stride[3]; - -// callback, the opendivx decoder calls this for each frame: -void convert_linux(unsigned char *puc_y, int stride_y, - unsigned char *puc_u, unsigned char *puc_v, int stride_uv, - unsigned char *bmp, int width_y, int height_y){ - -// printf("convert_yuv called %dx%d stride: %d,%d\n",width_y,height_y,stride_y,stride_uv); - - opendivx_src[0]=puc_y; - opendivx_src[1]=puc_u; - opendivx_src[2]=puc_v; - - opendivx_stride[0]=stride_y; - opendivx_stride[1]=stride_uv; - opendivx_stride[2]=stride_uv; -} -#endif - - -// to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,void* arg,...){ - switch(cmd){ - case VDCTRL_QUERY_MAX_PP_LEVEL: -#ifdef NEW_DECORE -#if DECORE_VERSION >= 20021112 - return 6; // divx4linux >= 5.0.5 -> 0..60 -#else - return 10; // divx4linux < 5.0.5 -> 0..100 -#endif -#else - return PP_QUALITY_MAX; // for opendivx -#endif - case VDCTRL_SET_PP_LEVEL: { - int quality=*((int*)arg); -#if DECORE_VERSION >= 20021112 - int32_t iInstruction, iPostproc; - if(quality<0 || quality>6) quality=6; - iInstruction = DEC_ADJ_POSTPROCESSING | DEC_ADJ_SET; - iPostproc = quality*10; - decore(dec_handle, DEC_OPT_ADJUST, &iInstruction, &iPostproc); -#else - DEC_SET dec_set; -#ifdef NEW_DECORE - if(quality<0 || quality>10) quality=10; - dec_set.postproc_level=quality*10; -#else - if(quality<0 || quality>PP_QUALITY_MAX) quality=PP_QUALITY_MAX; - dec_set.postproc_level=getPpModeForQuality(quality); -#endif - decore(0x123,DEC_OPT_SETPP,&dec_set,NULL); -#endif - return CONTROL_OK; - } - - } - - return CONTROL_UNKNOWN; -} - -// init driver -static int init(sh_video_t *sh){ -#if DECORE_VERSION >= 20021112 - DEC_INIT dec_init; - int iSize=sizeof(DivXBitmapInfoHeader); - DivXBitmapInfoHeader* pbi=malloc(iSize); - int32_t iInstruction; - - memset(&dec_init, 0, sizeof(dec_init)); - memset(pbi, 0, iSize); - - switch(sh->format) { - case mmioFOURCC('D','I','V','3'): - dec_init.codec_version = 311; - break; - case mmioFOURCC('D','I','V','X'): - dec_init.codec_version = 412; - break; - case mmioFOURCC('D','X','5','0'): - default: // Fallback to DivX 5 behaviour - dec_init.codec_version = 500; - } - - // no smoothing of the CPU load - dec_init.smooth_playback = 0; - - pbi->biSize=iSize; - - pbi->biCompression=mmioFOURCC('U','S','E','R'); - - pbi->biWidth = sh->disp_w; - pbi->biHeight = sh->disp_h; - - decore(&dec_handle, DEC_OPT_INIT, &dec_init, NULL); - decore(dec_handle, DEC_OPT_SETOUT, pbi, NULL); - - iInstruction = DEC_ADJ_POSTPROCESSING | DEC_ADJ_SET; - decore(dec_handle, DEC_OPT_ADJUST, &iInstruction, &divx_quality); - - free(pbi); -#else // DECORE_VERSION < 20021112 - DEC_PARAM dec_param; - DEC_SET dec_set; - -#ifndef NEW_DECORE - if(sh->format==mmioFOURCC('D','I','V','3')){ - mp_msg(MSGT_DECVIDEO,MSGL_INFO,"DivX 3.x not supported by opendivx decore - it requires divx4linux\n"); - return 0; // not supported - } -#endif -#ifndef DECORE_DIVX5 - if(sh->format==mmioFOURCC('D','X','5','0')){ - mp_msg(MSGT_DECVIDEO,MSGL_INFO,"DivX 5.00 not supported by divx4linux decore - it requires divx5linux\n"); - return 0; // not supported - } -#endif - - memset(&dec_param,0,sizeof(dec_param)); -#ifdef NEW_DECORE - dec_param.output_format=DEC_USER; -#else - dec_param.color_depth = 32; -#endif -#ifdef DECORE_DIVX5 - switch(sh->format) { - case mmioFOURCC('D','I','V','3'): - dec_param.codec_version = 311; - break; - case mmioFOURCC('D','I','V','X'): - dec_param.codec_version = 400; - break; - case mmioFOURCC('D','X','5','0'): - default: // Fallback to DivX 5 behaviour - dec_param.codec_version = 500; - } - dec_param.build_number = 0; -#endif - dec_param.x_dim = sh->disp_w; - dec_param.y_dim = sh->disp_h; - decore(0x123, DEC_OPT_INIT, &dec_param, NULL); - - dec_set.postproc_level = divx_quality; - decore(0x123, DEC_OPT_SETPP, &dec_set, NULL); -#endif // DECORE_VERSION - - mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: OpenDivX video codec init OK!\n"); - - return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12); -} - -// uninit driver -static void uninit(sh_video_t *sh){ -#if DECORE_VERSION >= 20021112 - decore(dec_handle, DEC_OPT_RELEASE, NULL, NULL); - dec_handle = NULL; -#else - decore(0x123,DEC_OPT_RELEASE,NULL,NULL); -#endif -} - -//mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); - -// decode a frame -static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ - mp_image_t* mpi; - DEC_FRAME dec_frame; -#ifdef NEW_DECORE -#if DECORE_VERSION >= 20021112 - DEC_FRAME_INFO dec_pic; -#else - DEC_PICTURE dec_pic; -#endif -#endif - - if(len<=0) return NULL; // skipped frame - - dec_frame.length = len; - dec_frame.bitstream = data; - dec_frame.render_flag = (flags&3)?0:1; - -#ifdef NEW_DECORE -#if DECORE_VERSION >= 20021112 - dec_frame.stride=sh->disp_w; - decore(dec_handle, DEC_OPT_FRAME, &dec_frame, &dec_pic); -#else - dec_frame.bmp=&dec_pic; - dec_pic.y=dec_pic.u=dec_pic.v=NULL; -#ifndef DEC_OPT_FRAME_311 - decore(0x123, DEC_OPT_FRAME, &dec_frame, NULL); -#else - decore(0x123, (sh->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME, &dec_frame, NULL); -#endif -#endif -#else - // opendivx: - opendivx_src[0]=NULL; - decore(0x123, 0, &dec_frame, NULL); -#endif - - if(flags&3) return NULL; // framedrop - -#ifdef NEW_DECORE - if(!dec_pic.y) return NULL; // bad frame -#else - if(!opendivx_src[0]) return NULL; // bad frame -#endif - - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE, - sh->disp_w, sh->disp_h); - if(!mpi) return NULL; - -#ifdef NEW_DECORE - mpi->planes[0]=dec_pic.y; - mpi->planes[1]=dec_pic.u; - mpi->planes[2]=dec_pic.v; - mpi->stride[0]=dec_pic.stride_y; - mpi->stride[1]=mpi->stride[2]=dec_pic.stride_uv; -#else - mpi->planes[0]=opendivx_src[0]; - mpi->planes[1]=opendivx_src[1]; - mpi->planes[2]=opendivx_src[2]; - mpi->stride[0]=opendivx_stride[0]; - mpi->stride[1]=opendivx_stride[1]; - mpi->stride[2]=opendivx_stride[2]; -#endif - - return mpi; -} diff --git a/libmpcodecs/ve.c b/libmpcodecs/ve.c index 5856c8e651..d9a6b7bf90 100644 --- a/libmpcodecs/ve.c +++ b/libmpcodecs/ve.c @@ -9,7 +9,6 @@ #include "mp_image.h" #include "vf.h" -extern vf_info_t ve_info_divx4; extern vf_info_t ve_info_lavc; extern vf_info_t ve_info_vfw; extern vf_info_t ve_info_raw; @@ -20,9 +19,6 @@ extern vf_info_t ve_info_nuv; extern vf_info_t ve_info_x264; static vf_info_t* encoder_list[]={ -#ifdef HAVE_DIVX4ENCORE - &ve_info_divx4, -#endif #ifdef USE_LIBAVCODEC &ve_info_lavc, #endif diff --git a/libmpcodecs/ve_divx4.c b/libmpcodecs/ve_divx4.c deleted file mode 100644 index 50feba6ff2..0000000000 --- a/libmpcodecs/ve_divx4.c +++ /dev/null @@ -1,488 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "config.h" -#include "mp_msg.h" - -#include "codec-cfg.h" -#include "stream.h" -#include "demuxer.h" -#include "stheader.h" - -#include "muxer.h" - -#include "img_format.h" -#include "mp_image.h" -#include "vf.h" - -/* About XviD VBR Library, Edouard Gomez (GomGom) said: - <GomGom> header bytes == frame header bytes :-) - <GomGom> total bytes = frame bytes == texture + header - <GomGom> quant = quant returned by xvidcore - <GomGom> it's possible that xvid lowers or increases the passed quant because of lumimasking - <GomGom> kblks = blocks coded as intra blocks - <GomGom> mblks = blocks coded as predicted blocks - <GomGom> ublks = skipped blocks - <GomGom> at the moemnt le vbr lib uses total bytes, and quant - <GomGom> so it's easy to use it with divx5 (wo bframes) - <klOUg> bframes breaks what assumptions? - <GomGom> quant estimation for next frame - <GomGom> because of the bframe quant multiplier given to divx5 - <GomGom> that the vbr lib does not "know" -*/ - -//===========================================================================// - -static int pass; -extern char* passtmpfile; - -#ifdef ENCORE_XVID -#include <divx4.h> -#else -#include <encore2.h> -#endif - -#ifndef ENCORE_MAJOR_VERSION -#define ENCORE_MAJOR_VERSION 4000 -#endif - -#if ENCORE_MAJOR_VERSION < 5200 -#include "divx4_vbr.h" -#define HAVE_XVID_VBR -#ifdef HAVE_XVID_VBR -#include "xvid_vbr.h" -#endif -#endif - -#if ENCORE_MAJOR_VERSION >= 5200 -SETTINGS divx4_param; -#else -ENC_PARAM divx4_param; -#endif -int divx4_crispness; -#ifdef HAVE_XVID_VBR -static int vbrpass = -1; -static int vbrdebug = 0; -#endif - -#include "m_option.h" - -m_option_t divx4opts_conf[]={ - {"pass", &pass, CONF_TYPE_INT, CONF_RANGE,0,2, NULL}, - {"br", &divx4_param.bitrate, CONF_TYPE_INT, CONF_RANGE, 4, 24000000, NULL}, -#if ENCORE_MAJOR_VERSION < 5200 - {"rc_period", &divx4_param.rc_period, CONF_TYPE_INT, 0,0,0, NULL}, - {"rc_reaction_period", &divx4_param.rc_reaction_period, CONF_TYPE_INT, 0,0,0, NULL}, - {"rc_reaction_ratio", &divx4_param.rc_reaction_ratio, CONF_TYPE_INT, 0,0,0, NULL}, - {"min_quant", &divx4_param.min_quantizer, CONF_TYPE_INT, CONF_RANGE,0,32, NULL}, - {"max_quant", &divx4_param.max_quantizer, CONF_TYPE_INT, CONF_RANGE,0,32, NULL}, -#endif - {"key", &divx4_param.max_key_interval, CONF_TYPE_INT, CONF_MIN,0,0, NULL}, - {"deinterlace", &divx4_param.deinterlace, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"q", &divx4_param.quality, CONF_TYPE_INT, CONF_RANGE, 1, 5, NULL}, - {"crispness", &divx4_crispness, CONF_TYPE_INT, CONF_RANGE,0,100, NULL}, -#if ENCORE_MAJOR_VERSION >= 5010 -#if ENCORE_MAJOR_VERSION >= 5200 -/* rate control modes: - 0 (VBV 1-pass) - 1 (1-pass constant quality) - 2 (VBV multipass 1st-pass) - 3 (VBV multipass nth-pass) - 4 (original 1-pass) - 5 (original 1st pass) - 6 (original 2nd pass) - 7 (1-pass constant frame size) -*/ - {"vbr", &divx4_param.vbr_mode, CONF_TYPE_INT, CONF_RANGE,0,7, NULL}, - {"bidirect", &divx4_param.use_bidirect, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"key_frame_threshold", &divx4_param.key_frame_threshold, CONF_TYPE_INT, CONF_RANGE,1,100, NULL}, -/* default values from the DivX Help Guide: - bitrate size occupancy - 128000 262144 196608 (Handheld) - 768000 1048576 786432 (Portable) - 4000000 3145728 2359296 (Home Theatre) - 8000000 6291456 4718592 (High Definition) -Do not mess with these values unless you are absolutely sure of what you are doing! -*/ - {"vbv_bitrate", &divx4_param.vbv_bitrate, CONF_TYPE_INT, 0,0,0, NULL}, - {"vbv_size", &divx4_param.vbv_size, CONF_TYPE_INT, 0,0,0, NULL}, - {"vbv_occupancy", &divx4_param.vbv_occupancy, CONF_TYPE_INT, 0,0,0, NULL}, - {"complexity", &divx4_param.complexity_modulation, CONF_TYPE_FLOAT, CONF_RANGE,0.0,1.0, NULL}, - {"readlog", &divx4_param.log_file_read, CONF_TYPE_STRING, 0,0,1, NULL}, - {"writelog", &divx4_param.log_file_write, CONF_TYPE_STRING, 0,0,1, NULL}, - {"mv_file", &divx4_param.mv_file, CONF_TYPE_STRING, 0,0,1, NULL}, - {"data_partitioning", &divx4_param.data_partitioning, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"qpel", &divx4_param.quarter_pel, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"gmc", &divx4_param.use_gmc, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"pv", &divx4_param.psychovisual, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"pv_strength_frame", &divx4_param.pv_strength_frame, CONF_TYPE_FLOAT, CONF_RANGE,0.0,1.0, NULL}, - {"pv_strength_MB", &divx4_param.pv_strength_MB, CONF_TYPE_FLOAT, CONF_RANGE,0.0,1.0, NULL}, - {"interlace_mode", &divx4_param.interlace_mode, CONF_TYPE_INT, CONF_RANGE,0,3, NULL}, - {"crop", &divx4_param.enable_crop, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"resize", &divx4_param.enable_resize, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"width", &divx4_param.resize_width, CONF_TYPE_INT, 0,0,0, NULL}, - {"height", &divx4_param.resize_height, CONF_TYPE_INT, 0,0,0, NULL}, - {"left", &divx4_param.crop_left, CONF_TYPE_INT, 0,0,0, NULL}, - {"right", &divx4_param.crop_right, CONF_TYPE_INT, 0,0,0, NULL}, - {"top", &divx4_param.crop_top, CONF_TYPE_INT, 0,0,0, NULL}, - {"bottom", &divx4_param.crop_bottom, CONF_TYPE_INT, 0,0,0, NULL}, - {"resize_mode", &divx4_param.resize_mode, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"temporal", &divx4_param.temporal_enable, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"spatial", &divx4_param.spatial_passes, CONF_TYPE_INT, CONF_RANGE,0,3, NULL}, - {"temporal_level", &divx4_param.temporal_level, CONF_TYPE_FLOAT, CONF_RANGE,0.0,1.0, NULL}, - {"spatial_level", &divx4_param.spatial_level, CONF_TYPE_FLOAT, CONF_RANGE,0.0,1.0, NULL}, -#else - {"bidirect", &divx4_param.extensions.use_bidirect, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"obmc", &divx4_param.extensions.obmc, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"data_partitioning", &divx4_param.extensions.data_partitioning, CONF_TYPE_FLAG, 0,0,1, NULL}, -// {"mpeg2", &divx4_param.extensions.mpeg2_quant, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"qpel", &divx4_param.extensions.quarter_pel, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"intra_frame_threshold", &divx4_param.extensions.intra_frame_threshold, CONF_TYPE_INT, CONF_RANGE,1,100, NULL}, - {"psychovisual", &divx4_param.extensions.psychovisual, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"pv", &divx4_param.extensions.psychovisual, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"pv_strength_frame", &divx4_param.extensions.pv_strength_frame, CONF_TYPE_FLOAT, CONF_RANGE,0.0,1.0, NULL}, - {"pv_strength_MB", &divx4_param.extensions.pv_strength_MB, CONF_TYPE_FLOAT, CONF_RANGE,0.0,1.0, NULL}, - {"testing_param", &divx4_param.extensions.testing_param, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"gmc", &divx4_param.extensions.use_gmc, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"interlace_mode", &divx4_param.extensions.interlace_mode, CONF_TYPE_INT, CONF_RANGE,0,2, NULL}, - {"crop", &divx4_param.extensions.enable_crop, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"resize", &divx4_param.extensions.enable_resize, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"width", &divx4_param.extensions.resize_width, CONF_TYPE_INT, 0,0,0, NULL}, - {"height", &divx4_param.extensions.resize_height, CONF_TYPE_INT, 0,0,0, NULL}, - {"left", &divx4_param.extensions.crop_left, CONF_TYPE_INT, 0,0,0, NULL}, - {"right", &divx4_param.extensions.crop_right, CONF_TYPE_INT, 0,0,0, NULL}, - {"top", &divx4_param.extensions.crop_top, CONF_TYPE_INT, 0,0,0, NULL}, - {"bottom", &divx4_param.extensions.crop_bottom, CONF_TYPE_INT, 0,0,0, NULL}, - {"resize_mode", &divx4_param.extensions.resize_mode, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"temporal", &divx4_param.extensions.temporal_enable, CONF_TYPE_FLAG, 0,0,1, NULL}, - {"spatial", &divx4_param.extensions.spatial_passes, CONF_TYPE_INT, CONF_RANGE,0,3, NULL}, - {"temporal_level", &divx4_param.extensions.temporal_level, CONF_TYPE_FLOAT, CONF_RANGE,0.0,1.0, NULL}, - {"spatial_level", &divx4_param.extensions.spatial_level, CONF_TYPE_FLOAT, CONF_RANGE,0.0,1.0, NULL}, - {"mv_file", &divx4_param.extensions.mv_file, CONF_TYPE_STRING, 0,0,1, NULL}, -#endif -#endif -#ifdef HAVE_XVID_VBR - {"vbrpass", &vbrpass, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL}, - {"vbrdebug", &vbrdebug, CONF_TYPE_INT, CONF_RANGE, 0, 1, NULL}, -#endif - {"help", "TODO: divx4opts help!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, - {NULL, NULL, 0, 0, 0, 0, NULL} -}; - -struct vf_priv_s { - muxer_stream_t* mux; - ENC_RESULT enc_result; - ENC_FRAME enc_frame; - void* enc_handle; -#ifdef HAVE_XVID_VBR - vbr_control_t vbr_state; -#endif -}; - -#define mux_v (vf->priv->mux) - -static int config(struct vf_instance_s* vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ - -#if ENCORE_MAJOR_VERSION >= 5200 - DivXBitmapInfoHeader format; - char profile = (char) encore(0, ENC_OPT_PROFILE, 0, 0); - - mp_msg(MSGT_MENCODER, MSGL_INFO, "encoder binary profile: %c\n", profile); - - if((pass <= 1 && (divx4_param.vbr_mode == RCMODE_VBV_MULTIPASS_NTH || - divx4_param.vbr_mode == RCMODE_502_2PASS_2ND)) || - (pass == 2 && (divx4_param.vbr_mode == RCMODE_VBV_1PASS || - divx4_param.vbr_mode == RCMODE_1PASS_CONSTANT_Q || - divx4_param.vbr_mode == RCMODE_VBV_MULTIPASS_1ST || - divx4_param.vbr_mode == RCMODE_502_1PASS || - divx4_param.vbr_mode == RCMODE_502_2PASS_1ST || - divx4_param.vbr_mode == RCMODE_IMAGE_COMPRESS))) { - mp_msg(MSGT_MENCODER, MSGL_ERR, "pass (%i) and rate control mode (%i) doesn't match, please consult encore2.h\n", - pass, divx4_param.vbr_mode); - abort(); - } -#endif - - mux_v->bih->biWidth=width; - mux_v->bih->biHeight=height; - mux_v->bih->biSizeImage=width*height*3; - mux_v->aspect = (float)d_width/d_height; - - if(!divx4_param.bitrate) divx4_param.bitrate=800000; - else if(divx4_param.bitrate<=16000) divx4_param.bitrate*=1000; - if(!divx4_param.quality) divx4_param.quality=5; // the quality of compression ( 1 - fastest, 5 - best ) - -#if ENCORE_MAJOR_VERSION >= 5200 - format.biSize=sizeof(DivXBitmapInfoHeader); - format.biWidth=width; - format.biHeight=height; - format.biSizeImage=mux_v->bih->biSizeImage; - if(divx4_param.vbv_bitrate > 0) { - divx4_param.vbv_bitrate = ((divx4_param.vbv_bitrate - 1) / 400 + 1) * 400; - divx4_param.vbv_size = ((divx4_param.vbv_size - 1) / 16384 + 1) * 16384; - divx4_param.vbv_occupancy = ((divx4_param.vbv_occupancy - 1) / 64 + 1) * 64; - } -#else - divx4_param.x_dim=width; - divx4_param.y_dim=height; - divx4_param.framerate=(float)mux_v->h.dwRate/mux_v->h.dwScale; - // set some usefull defaults: - if(!divx4_param.min_quantizer) divx4_param.min_quantizer=2; - if(!divx4_param.max_quantizer) divx4_param.max_quantizer=31; - if(!divx4_param.rc_period) divx4_param.rc_period=2000; - if(!divx4_param.rc_reaction_period) divx4_param.rc_reaction_period=10; - if(!divx4_param.rc_reaction_ratio) divx4_param.rc_reaction_ratio=20; -#endif - -#ifdef HAVE_XVID_VBR - if (vbrpass >= 0) { - vbrSetDefaults(&vf->priv->vbr_state); - vf->priv->vbr_state.desired_bitrate = divx4_param.bitrate; - switch (vbrpass) { - case 0: - vf->priv->vbr_state.mode = VBR_MODE_1PASS; - break; - case 1: - vf->priv->vbr_state.mode = VBR_MODE_2PASS_1; - break; - case 2: - vf->priv->vbr_state.mode = VBR_MODE_2PASS_2; - break; - default: - abort(); - } - vf->priv->vbr_state.debug = vbrdebug; - if (vbrInit(&vf->priv->vbr_state) == -1) - abort(); - /* XXX - kludge to workaround some DivX encoder limitations */ - if (vf->priv->vbr_state.mode != VBR_MODE_2PASS_2) - divx4_param.min_quantizer = divx4_param.max_quantizer = vbrGetQuant(&vf->priv->vbr_state); - } -#endif - -#if ENCORE_MAJOR_VERSION >= 5200 - switch(outfmt){ - case IMGFMT_YV12: { - format.biCompression=mmioFOURCC('Y','V','1','2'); |