Mercurial > mplayer.hg
changeset 19082:a2f20562aac3
Remove support for obsolete and non-free divx4/odivx libraries.
author | diego |
---|---|
date | Fri, 14 Jul 2006 17:14:16 +0000 |
parents | 273bdef43012 |
children | 5660be9dfd64 |
files | ChangeLog DOCS/man/en/mplayer.1 DOCS/xml/en/codecs.xml DOCS/xml/en/install.xml cfg-common.h cfg-mencoder.h cfg-mplayer.h codec-cfg.c configure divx4_vbr.c divx4_vbr.h etc/codecs.conf help/help_mp-en.h libmpcodecs/Makefile libmpcodecs/vd.c libmpcodecs/vd_divx4.c libmpcodecs/vd_odivx.c libmpcodecs/ve.c libmpcodecs/ve_divx4.c libmpdemux/video.c libvo/video_out.c mencoder.c |
diffstat | 22 files changed, 9 insertions(+), 1954 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Jul 14 16:57:24 2006 +0000 +++ b/ChangeLog Fri Jul 14 17:14:16 2006 +0000 @@ -8,6 +8,7 @@ Decoders: * liba52 updated to 0.7.4 (slightly faster) * SSE optimizations for mp3lib + * removed support for obsolete and non-free divx4 libraries Demuxers: * support for audio stream switching in MPEG-TS/PS, Matroska and @@ -20,6 +21,7 @@ MEncoder: * support of x264 encoding over lavc + * removed support for obsolete and non-free divx4 libraries Others: * SSA/ASS subtitle renderer
--- a/DOCS/man/en/mplayer.1 Fri Jul 14 16:57:24 2006 +0000 +++ b/DOCS/man/en/mplayer.1 Fri Jul 14 17:14:16 2006 +0000 @@ -3870,14 +3870,6 @@ In many cases this will not work, use \-vc null \-vo null instead. . .TP -.B \-oldpp <quality> (OpenDivX only) (OBSOLETE) -Use the OpenDivX postprocessing code instead of the internal one. -Superseded by \-pp, the internal postprocessing offers better -quality and performance. -The valid range of \-oldpp values varies by codec, it is mostly -0\-6, where 0=disable, 6=slowest/\:best. -. -.TP .B \-pp <quality> (also see \-vf pp) Set the DLL postprocess level. This option is no longer usable with \-vf pp. @@ -3987,8 +3979,6 @@ .RSs .IPs "\-vc divx" Force Win32/\:VfW DivX codec, no fallback. -.IPs "\-vc divx4," -Try divx4linux codec first, then fall back on others. .IPs "\-vc -divxds,-divx," Skip Win32 DivX codecs. .IPs "\-vc ffmpeg12,mpeg12," @@ -6484,8 +6474,6 @@ .RSs .IPs "\-ovc copy" no encoding, just streamcopy -.IPs "\-ovc divx4" -Encode to DivX4/\:DivX5. .IPs "\-ovc raw" Encode to an arbitrary uncompressed format (use '\-vf format' to select). .IPs "\-ovc lavc" @@ -6528,89 +6516,10 @@ .B \-<codec>opts <option1[=value],option2,...> . .PP -Where <codec> may be: lavc, xvidenc, divx4, lame, toolame, twolame, +Where <codec> may be: lavc, xvidenc, lame, toolame, twolame, nuv, xvfw, faac, x264enc, mpeg, lavf. . . -.SS divx4 (\-divx4opts) -. -DivX4 is obsolete and only supported for completeness. -For details about DivX4 options, read the source, most options are not -described here. -. -.TP -.B help\ \ \ -get help -. -.TP -.B br=<value> -Specify bitrate. -.RSs -.IPs 4\-16000 -(in kbit) -.IPs 16001\-24000000 -(in bit) -.RE -. -.TP -.B key=<value> -maximum keyframe interval (in frames) -. -.TP -.B deinterlace -Enable deinterlacing (avoid it, DivX4 is buggy). -. -.TP -.B q=<1\-5> -quality (1\-fastest, 5\-best) -. -.TP -.B min_quant=<1\-31> -minimum quantizer -. -.TP -.B max_quant=<1\-31> -maximum quantizer -. -.TP -.B rc_period=<value> -rate control period -. -.TP -.B rc_reaction_period=<value> -rate control reaction period -. -.TP -.B rc_reaction_ratio=<value> -rate control reaction ratio -. -.TP -.B crispness=<0\-100> -Specify crispness/\:smoothness. -. -.TP -.B pass=<1\-2> -With this you can encode two pass DivX4 files. -First encode with pass=1, then do another encode with the -same parameters and pass=2. -. -.TP -.B vbrpass=<0\-2> -Override the pass argument and use the XviD VBR library instead of DivX4 VBR. -Available options are: -.PD 0 -.RSs -.IPs 0 -one pass encoding (as in not putting pass on the command line) -.IPs 1 -Analysis (first) pass of two pass encoding. -The resulting AVI file can be directed to /dev/\:null. -.IPs 2 -Final (second) pass of two pass encoding. -.RE -.PD 1 -. -. .SS lame (\-lameopts) . .TP
--- a/DOCS/xml/en/codecs.xml Fri Jul 14 16:57:24 2006 +0000 +++ b/DOCS/xml/en/codecs.xml Fri Jul 14 17:14:16 2006 +0000 @@ -76,77 +76,6 @@ </para> -<sect2 id="divx4-5"> -<title>DivX4/DivX5</title> - -<para> -This section contains information about the DivX4 and DivX5 codecs of -<ulink url="http://www.projectmayo.com">Project Mayo</ulink>. -Their first available alpha version was OpenDivX 4.0 alpha 47 and 48. -Support for this was included in <application>MPlayer</application> in the -past, and built by default. We also used its postprocessing code to -optionally enhance visual quality of MPEG-1/2 movies. Now we use our own, -for all file types. -</para> - -<para> -The new generation of this codec is called DivX4 and can even decode -movies made with the infamous DivX codec! In addition it is much faster -than the native Win32 DivX DLLs but slower than -<systemitem class="library">libavcodec</systemitem>. -Hence its usage as a decoder is -<emphasis role="bold">discouraged</emphasis>. However, it is useful for -encoding. One disadvantage of this codec is that it is not available under an -Open Source license. -</para> - -<para> -DivX4 works in two modes: -<variablelist> -<varlistentry><term><option>-vc odivx</option></term> -<listitem><simpara> - Uses the codec in OpenDivX fashion. In this case it produces YV12 images - in its own buffer, and <application>MPlayer</application> does colorspace - conversion via libvo. (<emphasis role="bold">Fast, recommended!</emphasis>) - </simpara></listitem> -</varlistentry> -<varlistentry><term><option>-vc divx4</option></term> -<listitem><simpara> - Uses the colorspace conversion of the codec. In this mode you can use - YUY2/UYVY, too. (<emphasis role="bold">SLOW</emphasis>) - </simpara></listitem> -</varlistentry> -</variablelist> -</para> - -<para> -The <option>-vc odivx</option> method is usually faster, due to the fact -that it transfers image data in YV12 (planar YUV 4:2:0) format, thus -requiring much less bandwidth on the bus. For packed YUV modes (YUY2, UYVY) -use the <option>-vc divx4</option> method. For RGB modes the speed is the -same, differing at best according to your current color depth. -If your video output driver supports direct rendering, then <option>-vc -divx4</option> may be faster, or even the fastest solution. -</para> - -<para> -The DivX4/5 binary codec library can be downloaded from -<ulink url="http://avifile.sf.net">avifile</ulink> or -<ulink url="http://www.divx.com">divx.com</ulink> -Unpack it, run <filename>./install.sh</filename> as root and do not forget to add -<filename class="directory">/usr/local/lib</filename> to your -<filename>/etc/ld.so.conf</filename> and running <command>ldconfig</command>. -</para> - -<para> -<application>MPlayer</application> autodetects DivX4/DivX5 if it is -properly installed, just compile as usual. If it does not detect it, you -did not install or configure it correctly. -</para> - -</sect2> - - <sect2 id="ffmpeg" xreflabel="FFmpeg/libavcodec"> <title>FFmpeg/libavcodec</title>
--- a/DOCS/xml/en/install.xml Fri Jul 14 16:57:24 2006 +0000 +++ b/DOCS/xml/en/install.xml Fri Jul 14 17:14:16 2006 +0000 @@ -196,28 +196,6 @@ <link linkend="sorenson">Sorenson video codec</link> section. </para></listitem> <listitem><para> - <emphasis role="bold">DivX4/DivX5</emphasis>: information about this codec is - available in the <link linkend="divx4-5">DivX4/DivX5</link> section. You possibly - don't want this codec as - <emphasis role="bold"><systemitem class="library">libavcodec</systemitem></emphasis> - (see above) is much faster and has better quality than this, for both decoding - and encoding. Features: - <itemizedlist> - <listitem><simpara> - one pass or two pass encoding with - <link linkend="mencoder"><application>MEncoder</application></link> - </simpara></listitem> - <listitem><simpara> - can play old <emphasis role="bold">DivX3</emphasis> movies much faster than - the Win32 DLL but slower than - <emphasis role="bold"><systemitem class="library">libavcodec</systemitem></emphasis>! - </simpara></listitem> - <listitem><simpara> - it's closed-source, and only a x86 version is available. - </simpara></listitem> - </itemizedlist> - </para></listitem> -<listitem><para> <emphasis role="bold">XviD</emphasis>: Open source encoding alternative to DivX4Linux. Features: <itemizedlist>
--- a/cfg-common.h Fri Jul 14 16:57:24 2006 +0000 +++ b/cfg-common.h Fri Jul 14 17:14:16 2006 +0000 @@ -202,17 +202,9 @@ {"vc", &video_codec_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL}, // postprocessing: - {"divxq", "-divxq has been renamed to -pp (postprocessing), use -pp.\n", - CONF_TYPE_PRINT, 0, 0, 0, NULL}, #ifdef USE_LIBAVCODEC {"pp", &divx_quality, CONF_TYPE_INT, 0, 0, 0, NULL}, #endif -#ifdef HAVE_ODIVX_POSTPROCESS - {"oldpp", &use_old_pp, CONF_TYPE_FLAG, 0, 0, 1, NULL}, -#else - {"oldpp", "MPlayer was compiled without the OpenDivX library.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, -#endif - {"npp", "-npp has been removed, use -vf pp and read the fine manual.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, #if defined(USE_LIBPOSTPROC) || defined(USE_LIBPOSTPROC_SO) {"pphelp", &pp_help, CONF_TYPE_PRINT_INDIRECT, CONF_NOCFG, 0, 0, NULL}, #endif
--- a/cfg-mencoder.h Fri Jul 14 16:57:24 2006 +0000 +++ b/cfg-mencoder.h Fri Jul 14 17:14:16 2006 +0000 @@ -8,19 +8,12 @@ #ifdef USE_FAKE_MONO extern int fakemono; // defined in dec_audio.c #endif -#ifdef HAVE_ODIVX_POSTPROCESS -extern int use_old_pp; -#endif extern int sws_flags; extern int readPPOpt(void *, char *arg); extern void revertPPOpt(void *conf, char* opt); extern char *pp_help; -#ifdef HAVE_DIVX4ENCORE -extern m_option_t divx4opts_conf[]; -#endif - #ifdef HAVE_MP3LAME extern m_option_t lameopts_conf[]; #endif @@ -62,7 +55,6 @@ m_option_t ovc_conf[]={ {"copy", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_COPY, NULL}, {"frameno", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_FRAMENO, NULL}, - {"divx4", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_DIVX4, NULL}, {"lavc", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_LIBAVCODEC, NULL}, // {"null", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_NULL, NULL}, {"raw", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_RAW, NULL}, @@ -77,13 +69,6 @@ " frameno - special audio-only file for 3-pass encoding, see DOCS.\n" " raw - uncompressed video. Use fourcc option to set format explicitly.\n" " nuv - nuppel video\n" -#ifdef HAVE_DIVX4ENCORE -#ifdef ENCORE_XVID - " divx4 - XviD (divx4linux compatibility mode)\n" -#else - " divx4 - divx4linux/divx5linux library (depends on configuration)\n" -#endif -#endif #ifdef USE_LIBAVCODEC " lavc - libavcodec codecs - best quality!\n" #endif @@ -239,7 +224,7 @@ // override avi aspect autodetection {"force-avi-aspect", &avi_aspect_override, CONF_TYPE_FLOAT, CONF_RANGE|CONF_GLOBAL, 0.2, 3.0, NULL}, - {"pass", "-pass is obsolete, use -lavcopts vpass=n, -xvidencopts pass=n, -divx4opts pass=n\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, + {"pass", "-pass is obsolete, use -lavcopts vpass=n, -xvidencopts pass=n\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, {"passlogfile", &passtmpfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, {"vobsubout", &vobsub_out, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, @@ -258,9 +243,6 @@ // info header strings {"info", info_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, -#ifdef HAVE_DIVX4ENCORE - {"divx4opts", divx4opts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, -#endif #ifdef HAVE_MP3LAME {"lameopts", lameopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, #endif
--- a/cfg-mplayer.h Fri Jul 14 16:57:24 2006 +0000 +++ b/cfg-mplayer.h Fri Jul 14 17:14:16 2006 +0000 @@ -89,10 +89,6 @@ extern int guiWinID; #endif -#ifdef HAVE_ODIVX_POSTPROCESS -extern int use_old_pp; -#endif - #ifdef HAVE_XINERAMA extern int xinerama_screen; #endif
--- a/codec-cfg.c Fri Jul 14 16:57:24 2006 +0000 +++ b/codec-cfg.c Fri Jul 14 17:14:16 2006 +0000 @@ -284,11 +284,9 @@ "null", "libmpeg2", "vfw", - "odivx", "dshow", "ffmpeg", "vfwex", - "divx4", "raw", "msrle", "xanim",
--- a/configure Fri Jul 14 16:57:24 2006 +0000 +++ b/configure Fri Jul 14 17:14:16 2006 +0000 @@ -260,8 +260,6 @@ --disable-real disable RealPlayer DLL support [autodetect] --disable-xvid disable XviD codec [autodetect] --disable-x264 disable H.264 encoder [autodetect] - --disable-divx4linux disable DivX4linux/Divx5linux codec [autodetect] - --enable-opendivx enable _old_ OpenDivx codec [disable] --disable-libavutil disable libavutil [autodetect] --disable-libavcodec disable libavcodec [autodetect] --disable-libavformat disable libavformat [autodetect] @@ -1661,8 +1659,6 @@ _joystick=no _xvid=auto _x264=auto -_divx4linux=auto -_opendivx=no _lirc=auto _lircc=auto _gui=no @@ -1908,10 +1904,6 @@ --disable-xvid) _xvid=no ;; --enable-x264) _x264=yes ;; --disable-x264) _x264=no ;; - --enable-divx4linux) _divx4linux=yes ;; - --disable-divx4linux) _divx4linux=no ;; - --enable-opendivx) _opendivx=yes ;; - --disable-opendivx) _opendivx=no ;; --enable-libavutil) _libavutil=yes ;; --disable-libavutil) _libavutil=no ;; --enable-libavutil_so) _libavutil_so=yes ;; @@ -6559,81 +6551,8 @@ fi echores "$_x264" -echocheck "DivX4linux/DivX5linux/OpenDivX decore" -# DivX5: DEC_OPT_MEMORY_REQS - DivX4: DEC_OPT_FRAME_311 -cat > $TMPC << EOF -#include <decore.h> -int main(void) { (void) decore(0, 0, 0, 0); return DEC_OPT_FRAME_311; } -EOF -if test "$_divx4linux" != no && cc_check $_ld_lm -ldivxdecore ; then - _divx=yes - _opendivx=no - _ld_decore='-ldivxdecore' - _def_decore='#define NEW_DECORE 1' - _def_divx='#define USE_DIVX' - _def_divx5='#undef DECORE_DIVX5' - _def_odivx_postprocess='#undef HAVE_ODIVX_POSTPROCESS' - _codecmodules="divx4linux $_codecmodules" - _res_comment="DivX4linux - with libdivxdecore.so" -else -# if test "$_divx4linux" != no ; then -# DivX5 check -# OdivxPP disabled because of: -# ld: Warning: type of symbol `dering' changed from 1 to 2 in opendivx/postprocess.o -cat > $TMPC << EOF -#include <decore.h> -int main(void) { (void) decore(0, 0, 0, 0); return DEC_OPT_INIT; } -EOF -if test "$_divx4linux" != no && cc_check $_ld_lm -ldivxdecore ; then - _divx=yes - _opendivx=no -# _ld_decore='-ldivxdecore opendivx/postprocess.o' - _ld_decore='-ldivxdecore' - _def_decore='#define NEW_DECORE 1' - _def_divx='#define USE_DIVX' - _def_divx5='#define DECORE_DIVX5 1' -# _def_odivx_postprocess='#define HAVE_ODIVX_POSTPROCESS 1' - _def_odivx_postprocess='#undef HAVE_ODIVX_POSTPROCESS' - _codecmodules="divx5linux $_codecmodules" - _nocodecmodules="divx4linux $_nocodecmodules" - _res_comment="DivX5linux - with libdivxdecore.so" -elif test "$_opendivx" != no ; then - _divx=yes - _opendivx=yes - _ld_decore='opendivx/libdecore.a' - _def_decore='#undef NEW_DECORE' - _def_divx='#define USE_DIVX' - _def_divx5='#undef DECORE_DIVX5' - _def_odivx_postprocess='#define HAVE_ODIVX_POSTPROCESS 1' - _codecmodules="opendivx $_codecmodules" - _nocodecmodules="divx5linux $_nocodecmodules" - _res_comment="OpenDivX" -elif test "$_xvidcompat" = yes ; then - _divx=yes - _opendivx=no - _ld_decore='' - _def_decore='#define NEW_DECORE 1' - _def_divx='#define USE_DIVX 1' - _def_divx5='#undef DECORE_DIVX5' - _def_decore_xvid='#define DECORE_XVID 1' - _def_odivx_postprocess='#undef HAVE_ODIVX_POSTPROCESS' - _nocodecmodules="opendivx divx5linux divx4linux $_nocodecmodules" - _res_comment="XviD compat." -else - _divx=no - _opendivx=no - _ld_decore='' - _def_decore='#undef NEW_DECORE' - _def_divx='#undef USE_DIVX' - _def_divx5='#undef DECORE_DIVX5' - _def_odivx_postprocess='#undef HAVE_ODIVX_POSTPROCESS' - _nocodecmodules="opendivx $_nocodecmodules" -fi # DivX5 check -fi -echores "$_divx" - - -# mencoder requires (optional) those libs: libmp3lame and divx4linux encore + +# mencoder requires (optional) those libs: libmp3lame if test "$_mencoder" != no ; then echocheck "libmp3lame (for mencoder)" @@ -6665,29 +6584,6 @@ fi echores "$_mp3lame" - - echocheck "DivX4linux encore (for mencoder)" - cat > $TMPC << EOF -#include <encore2.h> -int main(void) { (void) encore(0, 0, 0, 0); return 0; } -EOF - if test "$_divx4linux" != no && cc_check -ldivxencore $_ld_lm ; then - _divx_encore=yes - _def_encore='#define HAVE_DIVX4ENCORE 1' - _ld_encore='-ldivxencore' - _res_comment="DivX4linux - with libdivxencore.so" - elif test "$_xvidcompat" = yes ; then - _divx_encore=yes - _def_encore='#define HAVE_DIVX4ENCORE 1' - _ld_encore='' - _def_encore_xvid='#define ENCORE_XVID 1' - _res_comment="XviD compatibility" - else - _divx_encore=no - _def_encore='#undef HAVE_DIVX4ENCORE' - fi - echores "$_divx_encore" - fi echocheck "mencoder" @@ -7435,10 +7331,6 @@ CONFIG_MP3LAME = $_mp3lame LIBMENU = $_menu -DIVX = $_divx -OPENDIVX = $_opendivx -DIVX4ENCORE = $_divx_encore - MP3LIB = $_mp3lib LIBA52 = $_liba52 LIBMPEG2 = $_libmpeg2 @@ -7558,9 +7450,9 @@ X264_LIB = $_ld_x264 CONFIG_DTS = $_libdts DTS_LIB = $_ld_libdts -DECORE_LIB = $_ld_decore $_ld_mp3lame +DECORE_LIB = $_ld_mp3lame MENCODER = $_mencoder -ENCORE_LIB = $_ld_encore $_ld_mp3lame +ENCORE_LIB = $_ld_mp3lame DIRECTFB_INC = $_inc_directfb DIRECTFB_LIB = $_ld_directfb CDDA = $_cdda @@ -7743,16 +7635,6 @@ -cache <kilobytes> */ #define USE_STREAM_CACHE 1 -/* Define to include support for XviD/Divx4Linux/OpenDivx */ -$_def_divx - -/* Define to use the new XviD/DivX4Linux library instead of open source OpenDivX */ -/* You have to change DECORE_LIBS in config.mak, too! */ -$_def_decore - -/* Define if you are using DivX5Linux Decore library */ -$_def_divx5 - /* Define if you are using XviD library */ $_def_xvid3 $_def_xvid4 @@ -7768,10 +7650,6 @@ /* If build mencoder */ $_mencoder_flag -/* Indicates if XviD/Divx4linux encore is available - Note: for mencoder */ -$_def_encore - /* Indicates if libmp3lame is available Note: for mencoder */ $_def_mp3lame @@ -7941,9 +7819,6 @@ $_def_libpostproc $_def_libpostproc_so -/* Define to include support for OpenDivx postprocessing */ -$_def_odivx_postprocess - /* Win32 DLL support */ $_def_win32 #define WIN32_PATH "$_win32libdir"
--- a/divx4_vbr.c Fri Jul 14 16:57:24 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,406 +0,0 @@ -/* - * divx4_vbr.c - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of the Linux - * distribution for more details. - * - * 2-pass code OpenDivX port: - * Copyright (C) 2001 Christoph Lampert <gruel@gmx.de> - * - * Large parts of this code were taken from VbrControl() from the OpenDivX - * project, (C) divxnetworks, written by Eugene Kuznetsov <ekuznetsov@divxnetworks.com> - * with the permission of Darrius "Junto" Thompson, Director DivX - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <math.h> -#include <inttypes.h> - -#include "divx4_vbr.h" - -#include "mp_msg.h" -#include "help_mp.h" - -//#include "transcode.h" - -#define FALSE 0 -#define TRUE 1 - -/* Absolute maximum and minimum quantizers used in VBR modes */ -static const int min_quantizer=1; -static const int max_quantizer=31; - -/* Limits on frame-level deviation of quantizer ( higher values - correspond to frames with more changes and vice versa ) */ -static const float min_quant_delta=-10.f; -static const float max_quant_delta=5.f; -/* Limits on stream-level deviation of quantizer ( used to make - overall bitrate of stream close to requested value ) */ -static const float min_rc_quant_delta=.6f; -static const float max_rc_quant_delta=1.5f; - -/* Crispness parameter controls threshold for decision whether - to skip the frame or to code it. */ -//static const float max_crispness=100.f; -/* Maximum allowed number of skipped frames in a line. */ -//static const int max_drops_line=0; // CHL We don't drop frames at the moment! - - -typedef struct entry_s - /* max 28 bytes/frame or 5 Mb for 2-hour movie */ - { - int quant; - int text_bits; - int motion_bits; - int total_bits; - float mult; - short is_key_frame; - short drop; - } entry; - -static int m_iCount; -static int m_iQuant; -/*static int m_iCrispness;*/ -static short m_bDrop; -static float m_fQuant; - -static int64_t m_lEncodedBits; -static int64_t m_lExpectedBits; - -static FILE *m_pFile; - -static entry vFrame; -static entry *m_vFrames; -static long lFrameStart; - -static int iNumFrames; -static int dummy; - - -void VbrControl_init_1pass_vbr(int quality, int crispness) -{ - m_fQuant=min_quantizer+((max_quantizer-min_quantizer)/6.)*(6-quality); - m_iCount=0; - m_bDrop=FALSE; - VbrControl_update_1pass_vbr(); -} - -int VbrControl_init_2pass_vbr_analysis(const char *filename, int quality) -{ - m_pFile=fopen(filename, "wb"); - if(m_pFile==0) - return -1; - m_iCount=0; - m_bDrop=FALSE; - fprintf(m_pFile, "##version 1\n"); - fprintf(m_pFile, "quality %d\n", quality); - return 0; -} - -int VbrControl_init_2pass_vbr_encoding(const char *filename, int bitrate, double framerate, int crispness, int quality) -{ - int i; - - int64_t text_bits=0; - int64_t total_bits=0; - int64_t complexity=0; - int64_t new_complexity=0; - int64_t motion_bits=0; - int64_t denominator=0; - float qual_multiplier=1.; - char head[20]; - - int64_t desired_bits; - int64_t non_text_bits; - - float average_complexity; - - m_pFile=fopen(filename, "rb"); - if(m_pFile==0) - return -1; - m_bDrop=FALSE; - m_iCount=0; - - fread(head, 10, 1, m_pFile); - if(!strncmp("##version ", head, 10)) - { - int version; - int iOldQual; - float old_qual, new_qual; - fscanf(m_pFile, "%d\n", &version); - fscanf(m_pFile, "quality %d\n", &iOldQual); - switch(iOldQual) - { - case 5: - old_qual=1.f; - break; - case 4: - old_qual=1.1f; - break; - case 3: - old_qual=1.25f; - break; - case 2: - old_qual=1.4f; - break; - case 1: - old_qual=2.f; - break; - } - switch(quality) - { - case 5: - new_qual=1.f; - break; - case 4: - new_qual=1.1f; - break; - case 3: - new_qual=1.25f; - break; - case 2: - new_qual=1.4f; - break; - case 1: - new_qual=2.f; - break; - } - qual_multiplier=new_qual/old_qual; - } - else - fseek(m_pFile, 0, SEEK_SET); - - lFrameStart=ftell(m_pFile); // save current position - -/* removed C++ dependencies, now read file twice :-( */ - - - while(!feof(m_pFile)) - { fscanf(m_pFile, "Frame %d: intra %hd, quant %d, texture %d, motion %d, total %d\n", - &iNumFrames, &(vFrame.is_key_frame), &(vFrame.quant), &(vFrame.text_bits), &(vFrame.motion_bits), &(vFrame.total_bits)); - - vFrame.total_bits+=vFrame.text_bits*(qual_multiplier-1); - vFrame.text_bits*=qual_multiplier; - text_bits +=(int64_t)vFrame.text_bits; - motion_bits += (int64_t)vFrame.motion_bits; - total_bits +=(int64_t)vFrame.total_bits; - complexity +=(int64_t)vFrame.text_bits*vFrame.quant; - -// printf("Frames %d, texture %d, motion %d, quant %d total %d ", -// iNumFrames, vFrame.text_bits, vFrame.motion_bits, vFrame.quant, vFrame.total_bits); -// printf("texture %d, total %d, complexity %lld \n",vFrame.text_bits,vFrame.total_bits, complexity); - } - iNumFrames++; - average_complexity=complexity/iNumFrames; - -// if (verbose & TC_DEBUG) { -// fprintf(stderr, "(%s) frames %d, texture %lld, motion %lld, total %lld, complexity %lld\n", __FILE__, iNumFrames, text_bits, motion_bits, total_bits, complexity); -// } - - m_vFrames = malloc(iNumFrames*sizeof(entry)); - if (!m_vFrames) - { mp_msg(MSGT_FIXME, MSGL_FIXME,MSGTR_OutOfMemory); - return -2; //TC_EXPORT_ERROR; - } - - fseek(m_pFile, lFrameStart, SEEK_SET); // start again - - for (i=0;i<iNumFrames;i++) - { fscanf(m_pFile, "Frame %d: intra %hd, quant %d, texture %d, motion %d, total %d\n", - &dummy, &(m_vFrames[i].is_key_frame), &(m_vFrames[i].quant), - &(m_vFrames[i].text_bits), &(m_vFrames[i].motion_bits), - &(m_vFrames[i].total_bits)); - - m_vFrames[i].total_bits += m_vFrames[i].text_bits*(qual_multiplier-1); - m_vFrames[i].text_bits *= qual_multiplier; - } - - if (m_pFile) - { fclose(m_pFile); - m_pFile=NULL; - } - - desired_bits=(int64_t)bitrate*(int64_t)iNumFrames/framerate; - non_text_bits=total_bits-text_bits; - - if(desired_bits<=non_text_bits) - { -/* char s[200];*/ - mp_msg(MSGT_FIXME, MSGL_FIXME, MSGTR_OverridingTooLowBitrate, - (float)(non_text_bits*framerate/(int64_t)iNumFrames)); - - desired_bits=non_text_bits*3/2; -/* - m_fQuant=max_quantizer; - for(int i=0; i<iNumFrames; i++) - { - m_vFrames[i].drop=0; - m_vFrames[i].mult=1; - } - VbrControl_set_quant(m_fQuant); - return 0; -*/ - } - - desired_bits -= non_text_bits; - /** - BRIEF EXPLANATION OF WHAT'S GOING ON HERE. - We assume that - text_bits=complexity / quantizer - total_bits-text_bits = const(complexity) - where 'complexity' is a characteristic of the frame - and does not depend much on quantizer dynamics. - Using this equation, we calculate 'average' quantizer - to be used for encoding ( 1st order effect ). - Having constant quantizer for the entire stream is not - very convenient - reconstruction errors are - more noticeable in low-motion scenes. To compensate - this effect, we multiply quantizer for each frame by - (complexity/average_complexity)^k, - ( k - parameter of adjustment ). k=0 means 'no compensation' - and k=1 is 'constant bitrate mode'. We choose something in - between, like 0.5 ( 2nd order effect ). - **/ - - average_complexity=complexity/iNumFrames; - - for(i=0; i<iNumFrames; i++) - { - float mult; - if(m_vFrames[i].is_key_frame) - { - if((i+1<iNumFrames) && (m_vFrames[i+1].is_key_frame)) - mult=1.25; - else - mult=.75; - } - else - { - mult=m_vFrames[i].text_bits*m_vFrames[i].quant; - mult=(float)sqrt(mult/average_complexity); - -// if(i && m_vFrames[i-1].is_key_frame) -// mult *= 0.75; - if(mult<0.5) - mult=0.5; - if(mult>1.5) - mult=1.5; - } - - m_vFrames[i].mult=mult; - m_vFrames[i].drop=FALSE; - new_complexity+=m_vFrames[i].text_bits*m_vFrames[i].quant; - - denominator+=desired_bits*m_vFrames[i].mult/iNumFrames; - } - - m_fQuant=((double)new_complexity)/(double)denominator; - - if(m_fQuant<min_quantizer) m_fQuant=min_quantizer; - if(m_fQuant>max_quantizer) m_fQuant=max_quantizer; - m_pFile=fopen("analyse.log", "wb"); - if(m_pFile) - { - fprintf(m_pFile, "Total frames: %d Avg quantizer: %f\n", - iNumFrames, m_fQuant); - fprintf(m_pFile, "Expecting %12lld bits\n", desired_bits+non_text_bits); - fflush(m_pFile); - } - VbrControl_set_quant(m_fQuant*m_vFrames[0].mult); - m_lEncodedBits=m_lExpectedBits=0; - return 0; -} - -int VbrControl_get_intra(void) -{ - return m_vFrames[m_iCount].is_key_frame; -} - -short VbrControl_get_drop(void) -{ - return m_bDrop; -} - -int VbrControl_get_quant(void) -{ - return m_iQuant; -} - -void VbrControl_set_quant(float quant) -{ - m_iQuant=quant; - if((rand() % 10)<((quant-m_iQuant) * 10)) - m_iQuant++; - if(m_iQuant<min_quantizer) m_iQuant=min_quantizer; - if(m_iQuant>max_quantizer) m_iQuant=max_quantizer; -} - -void VbrControl_update_1pass_vbr(void) -{ - VbrControl_set_quant(m_fQuant); - m_iCount++; -} - -void VbrControl_update_2pass_vbr_analysis(int is_key_frame, int motion_bits, int texture_bits, int total_bits, int quant) -{ - if(!m_pFile) - return; - fprintf(m_pFile, "Frame %d: intra %d, quant %d, texture %d, motion %d, total %d\n", - m_iCount, is_key_frame, quant, texture_bits, motion_bits, total_bits); - m_iCount++; -} - -void VbrControl_update_2pass_vbr_encoding(int motion_bits, int texture_bits, int total_bits) -{ - double q; - double dq; - - if(m_iCount>=iNumFrames) - return; - - m_lExpectedBits+=(m_vFrames[m_iCount].total_bits-m_vFrames[m_iCount].text_bits) - + m_vFrames[m_iCount].text_bits*m_vFrames[m_iCount].quant/m_fQuant; - m_lEncodedBits+=(int64_t)total_bits; - - if(m_pFile) - fprintf(m_pFile, "Frame %d: PRESENT, complexity %d, quant multiplier %f, texture %d, total %d ", - m_iCount, m_vFrames[m_iCount].text_bits*m_vFrames[m_iCount].quant, - m_vFrames[m_iCount].mult, texture_bits, total_bits); - - m_iCount++; - - q = m_fQuant * m_vFrames[m_iCount].mult; - if(q<m_fQuant+min_quant_delta) q=m_fQuant+min_quant_delta; - if(q>m_fQuant+max_quant_delta) q=m_fQuant+max_quant_delta; - - dq = (double)m_lEncodedBits/(double)m_lExpectedBits; - dq*=dq; - if(dq<min_rc_quant_delta) - dq=min_rc_quant_delta; - if(dq>max_rc_quant_delta) - dq=max_rc_quant_delta; - if(m_iCount<20) // no framerate corrections in first frames - dq=1; - if(m_pFile) - fprintf(m_pFile, "Progress: expected %12lld, achieved %12lld, dq %f", - m_lExpectedBits, m_lEncodedBits, dq); - q *= dq; - VbrControl_set_quant(q); - if(m_pFile) - fprintf(m_pFile, ", new quant %d\n", m_iQuant); -} - -void VbrControl_close(void) -{ - if(m_pFile) - { - fclose(m_pFile); - m_pFile=NULL; - } - free(m_vFrames); -}
--- a/divx4_vbr.h Fri Jul 14 16:57:24 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - -// methods from class VbrControl - - void VbrControl_init_1pass_vbr(int quality, int crispness); - int VbrControl_init_2pass_vbr_encoding(const char* filename, int bitrate, double framerate, int crispness, int quality); - int VbrControl_init_2pass_vbr_analysis(const char* filename, int quality); - - void VbrControl_update_1pass_vbr(void); - void VbrControl_update_2pass_vbr_encoding(int motion_bits, int texture_bits, int total_bits); - void VbrControl_update_2pass_vbr_analysis(int is_key_frame, int motion_bits, int texture_bits, int total_bits, int quant); - - int VbrControl_get_quant(void); - void VbrControl_set_quant(float q); - int VbrControl_get_intra(void); - short VbrControl_get_drop(void); - void VbrControl_close(void); -
--- a/etc/codecs.conf Fri Jul 14 16:57:24 2006 +0000 +++ b/etc/codecs.conf Fri Jul 14 17:14:16 2006 +0000 @@ -612,45 +612,6 @@ out BGR32,BGR24,BGR16,BGR15 dll "libxvidcore.a" -; divx4 does direct render, and is native on Linux - -videocodec odivx - info "OpenDivX API (ODIVX,DIVX4,DIVX5,XVID)" - comment "with postprocessing" - status working - fourcc mp4v - fourcc DIVX,divx - fourcc DIV1,div1 divx -; fourcc MP4S,mp4s ; ISO MPEG-4 Video V1 - fourcc MP43,mp43,DIV3,div3,DIV4,div4 DIV3 ; for DivX4Linux only! - fourcc AP41 DIV3 ; AngelPotion stuff - fourcc xvid,XVID,XviD - fourcc DX50,BLZ0 DX50 - format 0x4 - driver odivx - dll "libdivxdecore.so" - out YV12,I420,IYUV - -videocodec divx4 - info "DivX4Linux API (DIVX4,DIVX5,XVID)" - comment "with postprocessing" - status working - fourcc mp4v - fourcc DIVX,divx - fourcc DIV1,div1 divx -; fourcc MP4S,mp4s ; ISO MPEG-4 Video V1 - fourcc MP43,mp43,DIV3,div3,DIV4,div4 DIV3 ; for DivX4Linux only! - fourcc AP41 DIV3 ; AngelPotion stuff - fourcc xvid,XVID,XviD - fourcc DX50,BLZ0 DX50 - format 0x4 - driver divx4 - dll "libdivxdecore.so" -; out I420 ; planar direct rendering - out YUY2 - out UYVY - out BGR32,BGR24,BGR16,BGR15 - ; is divx4vfw stable enough, working everywhere and faster than divxds? videocodec divx4vfw
--- a/help/help_mp-en.h Fri Jul 14 16:57:24 2006 +0000 +++ b/help/help_mp-en.h Fri Jul 14 17:14:16 2006 +0000 @@ -486,12 +486,6 @@ #define MSGTR_CodecDefinitionIncorrect "Codec is not defined correctly." #define MSGTR_OutdatedCodecsConf "This codecs.conf is too old and incompatible with this MPlayer release!" -// divx4_vbr.c: -#define MSGTR_OutOfMemory "out of memory" -#define MSGTR_OverridingTooLowBitrate "Specified bitrate is too low for this clip.\n"\ -"Minimum possible bitrate for the clip is %.0f kbps. Overriding\n"\ -"user-specified value.\n" - // fifo.c #define MSGTR_CannotMakePipe "Cannot make PIPE!\n"
--- a/libmpcodecs/Makefile Fri Jul 14 16:57:24 2006 +0000 +++ b/libmpcodecs/Makefile Fri Jul 14 17:14:16 2006 +0000 @@ -104,12 +104,6 @@ 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 @@ 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
--- a/libmpcodecs/vd.c Fri Jul 14 16:57:24 2006 +0000 +++ b/libmpcodecs/vd.c Fri Jul 14 17:14:16 2006 +0000 @@ -34,8 +34,6 @@ 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 @@ &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,
--- a/libmpcodecs/vd_divx4.c Fri Jul 14 16:57:24 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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; -}
--- a/libmpcodecs/vd_odivx.c Fri Jul 14 16:57:24 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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; -}
--- a/libmpcodecs/ve.c Fri Jul 14 16:57:24 2006 +0000 +++ b/libmpcodecs/ve.c Fri Jul 14 17:14:16 2006 +0000 @@ -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_x264; static vf_info_t* encoder_list[]={ -#ifdef HAVE_DIVX4ENCORE - &ve_info_divx4, -#endif #ifdef USE_LIBAVCODEC &ve_info_lavc, #endif
--- a/libmpcodecs/ve_divx4.c Fri Jul 14 16:57:24 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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'); - break; - } - case IMGFMT_IYUV: { - format.biCompression=mmioFOURCC('I','Y','U','V'); - break; - } - case IMGFMT_I420: { - format.biCompression=mmioFOURCC('I','4','2','0'); - break; - } - case IMGFMT_YUY2: { - format.biCompression=mmioFOURCC('Y','U','Y','2'); - break; - } - case IMGFMT_V422: { - format.biCompression=mmioFOURCC('V','4','2','2'); - break; - } - case IMGFMT_UYVY: { - format.biCompression=mmioFOURCC('U','Y','V','Y'); - break; - } - case IMGFMT_YVYU: { - format.biCompression=mmioFOURCC('Y','V','Y','U'); - break; - } - case IMGFMT_BGR24: { - format.biCompression=0; - format.biBitCount=24; - break; - } - case IMGFMT_BGR32: { - format.biCompression=0; - format.biBitCount=32; - break; - } - default: - mp_msg(MSGT_MENCODER,MSGL_ERR,"divx4: unsupported picture format (%s)!\n", - vo_format_name(outfmt)); - return 0; - } - - encore(&vf->priv->enc_handle, ENC_OPT_INIT, &format, &divx4_param); -#else - divx4_param.handle=NULL; - encore(NULL,ENC_OPT_INIT,&divx4_param,NULL); - vf->priv->enc_handle=divx4_param.handle; - switch(outfmt){ - case IMGFMT_YV12: vf->priv->enc_frame.colorspace=ENC_CSP_YV12; break; - case IMGFMT_IYUV: - case IMGFMT_I420: vf->priv->enc_frame.colorspace=ENC_CSP_I420; break; - case IMGFMT_YUY2: vf->priv->enc_frame.colorspace=ENC_CSP_YUY2; break; - case IMGFMT_UYVY: vf->priv->enc_frame.colorspace=ENC_CSP_UYVY; break; - case IMGFMT_RGB24: - case IMGFMT_BGR24: - vf->priv->enc_frame.colorspace=ENC_CSP_RGB24; break; - default: - mp_msg(MSGT_MENCODER,MSGL_ERR,"divx4: unsupported picture format (%s)!\n", - vo_format_name(outfmt)); - return 0; - } - - switch(pass){ - case 1: - if (VbrControl_init_2pass_vbr_analysis(passtmpfile, divx4_param.quality) == -1){ - mp_msg(MSGT_MENCODER,MSGL_ERR,"2pass failed: filename=%s\n", passtmpfile); - pass=0; - } - break; - case 2: - if (VbrControl_init_2pass_vbr_encoding(passtmpfile, - divx4_param.bitrate, - divx4_param.framerate, - divx4_crispness, - divx4_param.quality) == -1){ - mp_msg(MSGT_MENCODER,MSGL_ERR,"2pass failed: filename=%s\n", passtmpfile); - pass=0; - } - break; - } -#endif - - return 1; -} - -#ifdef HAVE_XVID_VBR -static void uninit(struct vf_instance_s* vf){ - if (vbrpass >= 0 && vbrFinish(&vf->priv->vbr_state) == -1) - abort(); -} -#else -static void uninit(struct vf_instance_s* vf){ - encore(vf->priv->enc_handle, ENC_OPT_RELEASE, 0, 0); - vf->priv->enc_handle = NULL; -} -#endif - -static int control(struct vf_instance_s* vf, int request, void* data){ - - return CONTROL_UNKNOWN; -} - -static int query_format(struct vf_instance_s* vf, unsigned int fmt){ - switch(fmt){ - case IMGFMT_YV12: - case IMGFMT_IYUV: - case IMGFMT_I420: - return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; // no conversion - case IMGFMT_YUY2: - case IMGFMT_UYVY: - return VFCAP_CSP_SUPPORTED; // conversion - case IMGFMT_RGB24: - case IMGFMT_BGR24: - return VFCAP_CSP_SUPPORTED | VFCAP_FLIPPED; // conversion+flipped - } - return 0; -} - -static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ - ENC_RESULT enc_result; - vf->priv->enc_frame.image=mpi->planes[0]; - vf->priv->enc_frame.bitstream=mux_v->buffer; - vf->priv->enc_frame.length=mux_v->buffer_size; -#if ENCORE_MAJOR_VERSION >= 5200 - vf->priv->enc_frame.produce_empty_frame = 0; - encore(vf->priv->enc_handle, ENC_OPT_ENCODE, &vf->priv->enc_frame, &enc_result); - if(enc_result.cType == 'I') - muxer_write_chunk(mux_v,vf->priv->enc_frame.length,0x10, MP_NOPTS_VALUE, MP_NOPTS_VALUE); - else - muxer_write_chunk(mux_v,vf->priv->enc_frame.length,0, MP_NOPTS_VALUE, MP_NOPTS_VALUE); -#else - vf->priv->enc_frame.mvs=NULL; -#ifdef HAVE_XVID_VBR - if (vbrpass >= 0) { - int quant = vbrGetQuant(&vf->priv->vbr_state); - int intra = vbrGetIntra(&vf->priv->vbr_state); - vf->priv->enc_frame.quant = quant ? quant : 1; - vf->priv->enc_frame.intra = intra; - /* XXX - kludge to workaround some DivX encoder limitations: - only pass 2 needs to call encore with VBR, and then it does - not report quantizer and intra*/ - if (vf->priv->vbr_state.mode != VBR_MODE_2PASS_2) - encore(vf->priv->enc_handle, ENC_OPT_ENCODE, &vf->priv->enc_frame, &enc_result); - else { - encore(vf->priv->enc_handle, ENC_OPT_ENCODE_VBR, &vf->priv->enc_frame, &enc_result); - enc_result.quantizer = quant; - if (intra >= 0) - enc_result.is_key_frame = intra; - } - if (vbrUpdate(&vf->priv->vbr_state, enc_result.quantizer, enc_result.is_key_frame, - (enc_result.total_bits - enc_result.texture_bits) / 8, enc_result.total_bits / 8, - 0, 0, 0) == -1) - abort(); - } - else -#endif - if(pass==2){ // handle 2-pass: - vf->priv->enc_frame.quant = VbrControl_get_quant(); - vf->priv->enc_frame.intra = VbrControl_get_intra(); - encore(vf->priv->enc_handle,ENC_OPT_ENCODE_VBR,&vf->priv->enc_frame,&enc_result); - VbrControl_update_2pass_vbr_encoding(enc_result.motion_bits, - enc_result.texture_bits, - enc_result.total_bits); - } else { - vf->priv->enc_frame.quant=0; - vf->priv->enc_frame.intra=0; - encore(vf->priv->enc_handle,ENC_OPT_ENCODE,&vf->priv->enc_frame,&enc_result); - if(pass==1){ - VbrControl_update_2pass_vbr_analysis(enc_result.is_key_frame, - enc_result.motion_bits, - enc_result.texture_bits, - enc_result.total_bits, - enc_result.quantizer); - } - } - muxer_write_chunk(mux_v,vf->priv->enc_frame.length,enc_result.is_key_frame?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE); -#endif - return 1; -} - -//===========================================================================// - -static int vf_open(vf_instance_t *vf, char* args){ - vf->config=config; - vf->default_caps=VFCAP_CONSTANT; - vf->control=control; - vf->query_format=query_format; - vf->put_image=put_image; -//#ifdef HAVE_XVID_VBR - vf->uninit = uninit; -//#endif - vf->priv=malloc(sizeof(struct vf_priv_s)); - memset(vf->priv,0,sizeof(struct vf_priv_s)); - vf->priv->mux=(muxer_stream_t*)args; - - mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)); - mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); - mux_v->bih->biWidth=0; - mux_v->bih->biHeight=0; - mux_v->bih->biPlanes=1; - mux_v->bih->biBitCount=24; -#if ENCORE_MAJOR_VERSION >= 5010 - mux_v->bih->biCompression=mmioFOURCC('D','X','5','0'); -#else - mux_v->bih->biCompression=mmioFOURCC('d','i','v','x'); -#endif - - return 1; -} - -vf_info_t ve_info_divx4 = { - "divx4 encoder", - "divx4", - "A'rpi", - "for internal use by mencoder", - vf_open -}; - -//===========================================================================//
--- a/libmpdemux/video.c Fri Jul 14 16:57:24 2006 +0000 +++ b/libmpdemux/video.c Fri Jul 14 17:14:16 2006 +0000 @@ -579,14 +579,12 @@ case DEMUXER_TYPE_MOV: case DEMUXER_TYPE_FILM: case DEMUXER_TYPE_VIVO: - case DEMUXER_TYPE_OGG: case DEMUXER_TYPE_ASF: { float next_pts = ds_get_next_pts(d_video); float d= next_pts > 0 ? next_pts - d_video->pts : d_video->pts-pts1; if(d>=0){ if(d>0){ - /* 10000 is used for OGM only */ - if((int)sh_video->fps==1000||(int)sh_video->fps==10000) + if((int)sh_video->fps==1000) mp_msg(MSGT_CPLAYER,MSGL_V,"\navg. framerate: %d fps \n",(int)(1.0f/d)); sh_video->frametime=d; // 1ms sh_video->fps=1.0f/d;
--- a/libvo/video_out.c Fri Jul 14 16:57:24 2006 +0000 +++ b/libvo/video_out.c Fri Jul 14 17:14:16 2006 +0000 @@ -79,7 +79,6 @@ extern vo_functions_t video_out_tdfxfb; extern vo_functions_t video_out_s3fb; extern vo_functions_t video_out_null; -//extern vo_functions_t video_out_odivx; extern vo_functions_t video_out_zr; extern vo_functions_t video_out_zr2; extern vo_functions_t video_out_bl;
--- a/mencoder.c Fri Jul 14 16:57:24 2006 +0000 +++ b/mencoder.c Fri Jul 14 17:14:16 2006 +0000 @@ -1,7 +1,6 @@ #define VCODEC_COPY 0 #define VCODEC_FRAMENO 1 // real codecs: -#define VCODEC_DIVX4 2 #define VCODEC_LIBAVCODEC 4 #define VCODEC_VFW 7 #define VCODEC_LIBDV 8 @@ -831,8 +830,6 @@ static vf_instance_t * ve = NULL; if (!ve) { switch(mux_v->codec){ - case VCODEC_DIVX4: - sh_video->vfilter=vf_open_encoder(NULL,"divx4",(char *)mux_v); break; case VCODEC_LIBAVCODEC: sh_video->vfilter=vf_open_encoder(NULL,"lavc",(char *)mux_v); break; case VCODEC_RAW: