2002-09-21 12:34:02 +00:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
2002-11-03 12:43:30 +00:00
|
|
|
|
#include <errno.h>
|
2003-04-03 06:53:01 +00:00
|
|
|
|
#include <math.h>
|
2003-04-03 20:36:58 +00:00
|
|
|
|
#include <time.h>
|
2003-04-03 06:53:01 +00:00
|
|
|
|
|
|
|
|
|
#if !defined(INFINITY) && defined(HUGE_VAL)
|
|
|
|
|
#define INFINITY HUGE_VAL
|
|
|
|
|
#endif
|
2002-09-21 12:34:02 +00:00
|
|
|
|
|
2005-11-18 14:39:25 +00:00
|
|
|
|
#include "config.h"
|
|
|
|
|
#include "mp_msg.h"
|
2002-09-21 12:34:02 +00:00
|
|
|
|
|
2003-11-12 00:43:42 +00:00
|
|
|
|
#ifdef HAVE_XVID3
|
2002-09-21 12:34:02 +00:00
|
|
|
|
|
|
|
|
|
#include "codec-cfg.h"
|
|
|
|
|
#include "stream.h"
|
|
|
|
|
#include "demuxer.h"
|
|
|
|
|
#include "stheader.h"
|
|
|
|
|
|
2002-12-27 22:43:20 +00:00
|
|
|
|
#include "muxer.h"
|
2002-09-21 12:34:02 +00:00
|
|
|
|
|
|
|
|
|
#include "img_format.h"
|
|
|
|
|
#include "mp_image.h"
|
|
|
|
|
#include "vf.h"
|
|
|
|
|
|
|
|
|
|
#include <xvid.h>
|
|
|
|
|
#include "xvid_vbr.h"
|
|
|
|
|
|
2003-08-13 16:29:32 +00:00
|
|
|
|
#include "m_option.h"
|
2002-09-21 12:34:02 +00:00
|
|
|
|
|
2002-12-18 08:10:24 +00:00
|
|
|
|
|
|
|
|
|
#ifdef XVID_API_UNSTABLE
|
|
|
|
|
#warning *******************************************************************
|
|
|
|
|
#warning ** **
|
|
|
|
|
#warning ** Y O U '' R E U S I N G U N S T A B L E S O F T W A R E **
|
|
|
|
|
#warning ** **
|
2003-04-02 22:27:35 +00:00
|
|
|
|
#warning ** Streams produced by this version aren''t probably compatible **
|
2002-12-18 08:10:24 +00:00
|
|
|
|
#warning ** with anything else, even the xvid decoder itself. There are **
|
|
|
|
|
#warning ** bugs, this code could crash, could blow up your PC or the **
|
|
|
|
|
#warning ** whole building ! **
|
|
|
|
|
#warning ** If you want stable code and compatible streams, use stable **
|
|
|
|
|
#warning ** XViD releases (currently 0.9.x). **
|
|
|
|
|
#warning ** **
|
|
|
|
|
#warning *******************************************************************
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-09-21 12:34:02 +00:00
|
|
|
|
/**********************************************************************/
|
2002-12-15 18:35:11 +00:00
|
|
|
|
/* motion estimation quality presets */
|
|
|
|
|
static int const motion_presets[7] = {
|
2002-12-18 08:10:24 +00:00
|
|
|
|
#ifdef XVID_API_UNSTABLE
|
2002-12-15 18:35:11 +00:00
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
0,
|
2003-04-02 20:31:47 +00:00
|
|
|
|
0,
|
2003-04-03 20:36:58 +00:00
|
|
|
|
PMV_HALFPELREFINE16 | PMV_HALFPELDIAMOND8,
|
|
|
|
|
PMV_HALFPELREFINE16 | PMV_HALFPELDIAMOND8 | PMV_ADVANCEDDIAMOND16,
|
|
|
|
|
PMV_HALFPELREFINE16 | PMV_EXTSEARCH16 | PMV_HALFPELREFINE8 | PMV_HALFPELDIAMOND8 | PMV_USESQUARES16
|
2002-12-15 18:35:11 +00:00
|
|
|
|
#else
|
2002-11-03 12:43:30 +00:00
|
|
|
|
0,
|
|
|
|
|
PMV_QUICKSTOP16,
|
2002-09-21 12:34:02 +00:00
|
|
|
|
PMV_EARLYSTOP16,
|
2002-11-03 12:43:30 +00:00
|
|
|
|
PMV_EARLYSTOP16 | PMV_EARLYSTOP8,
|
|
|
|
|
PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EARLYSTOP8 | PMV_HALFPELDIAMOND8,
|
|
|
|
|
PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EARLYSTOP8 | PMV_HALFPELDIAMOND8 | PMV_ADVANCEDDIAMOND16,
|
|
|
|
|
PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EXTSEARCH16 | PMV_EARLYSTOP8 | PMV_HALFPELREFINE8 |
|
|
|
|
|
PMV_HALFPELDIAMOND8 | PMV_USESQUARES16
|
|
|
|
|
|
2002-12-15 18:35:11 +00:00
|
|
|
|
#endif
|
2002-09-21 12:34:02 +00:00
|
|
|
|
};
|
|
|
|
|
|
2002-11-03 12:43:30 +00:00
|
|
|
|
extern char* passtmpfile;
|
2002-09-21 12:34:02 +00:00
|
|
|
|
|
2002-11-03 12:43:30 +00:00
|
|
|
|
static int xvidenc_pass = 0;
|
2003-04-03 20:36:58 +00:00
|
|
|
|
static int xvidenc_quality = 6;
|
2002-12-15 18:35:11 +00:00
|
|
|
|
static int xvidenc_4mv = 0;
|
2002-11-03 12:43:30 +00:00
|
|
|
|
static int xvidenc_bitrate = -1;
|
|
|
|
|
static int xvidenc_rc_reaction_delay_factor = -1;
|
|
|
|
|
static int xvidenc_rc_averaging_period = -1;
|
|
|
|
|
static int xvidenc_rc_buffer = -1;
|
2002-11-22 08:19:08 +00:00
|
|
|
|
static char* xvidenc_quant_range = "2-31/2-31";
|
2002-11-17 13:01:06 +00:00
|
|
|
|
static int xvidenc_min_key_interval = -1;
|
2002-11-03 12:43:30 +00:00
|
|
|
|
static int xvidenc_max_key_interval = -1;
|
|
|
|
|
static int xvidenc_mpeg_quant = 0;
|
2002-11-14 21:46:36 +00:00
|
|
|
|
static int xvidenc_mod_quant = 0;
|
2002-11-17 13:01:06 +00:00
|
|
|
|
static int xvidenc_keyframe_boost = -1;
|
2002-11-14 21:46:36 +00:00
|
|
|
|
static int xvidenc_kfthreshold = -1;
|
|
|
|
|
static int xvidenc_kfreduction = -1;
|
2002-11-03 12:43:30 +00:00
|
|
|
|
static int xvidenc_fixed_quant = 0;
|
|
|
|
|
static int xvidenc_debug = 0;
|
2003-04-02 22:13:44 +00:00
|
|
|
|
static int xvidenc_interlacing = 0;
|
2003-04-02 22:27:35 +00:00
|
|
|
|
static int xvidenc_greyscale = 0;
|
2002-12-18 08:10:24 +00:00
|
|
|
|
#ifdef XVID_API_UNSTABLE
|
2003-04-02 22:13:44 +00:00
|
|
|
|
static int xvidenc_packed = 0;
|
|
|
|
|
static int xvidenc_divx5bvop = 1;
|
2003-04-02 21:33:19 +00:00
|
|
|
|
static int xvidenc_lumi_mask = 0;
|
2002-12-15 18:35:11 +00:00
|
|
|
|
static int xvidenc_qpel = 0;
|
|
|
|
|
static int xvidenc_max_bframes = 0;
|
2003-04-02 21:33:19 +00:00
|
|
|
|
static int xvidenc_bquant_ratio = 150;
|
|
|
|
|
static int xvidenc_bquant_offset = 100;
|
2003-04-06 15:46:05 +00:00
|
|
|
|
static int xvidenc_bf_threshold = 0;
|
2002-12-15 18:35:11 +00:00
|
|
|
|
static int xvidenc_gmc = 0;
|
2003-04-02 22:13:44 +00:00
|
|
|
|
static int xvidenc_chroma_me = 0;
|
2003-04-03 20:36:58 +00:00
|
|
|
|
static int xvidenc_chroma_opt = 0;
|
2002-12-15 18:35:11 +00:00
|
|
|
|
static int xvidenc_reduced = 0;
|
2003-04-03 20:36:58 +00:00
|
|
|
|
static int xvidenc_hqac = 0;
|
|
|
|
|
static int xvidenc_vhq = 0;
|
|
|
|
|
static int xvidenc_psnr = 0;
|
2003-04-03 06:53:01 +00:00
|
|
|
|
static uint64_t xvid_error[3];
|
2002-12-15 18:35:11 +00:00
|
|
|
|
#endif
|
2002-09-21 13:09:57 +00:00
|
|
|
|
|
2003-08-13 16:29:32 +00:00
|
|
|
|
m_option_t xvidencopts_conf[] = {
|
2002-11-03 12:43:30 +00:00
|
|
|
|
{ "pass", &xvidenc_pass, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
|
2002-12-15 18:35:11 +00:00
|
|
|
|
{ "me_quality", &xvidenc_quality, CONF_TYPE_INT, CONF_RANGE, 0,
|
|
|
|
|
sizeof(motion_presets) / sizeof(motion_presets[0]) - 1, NULL},
|
|
|
|
|
{ "4mv", &xvidenc_4mv, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
|
|
|
|
{ "bitrate", &xvidenc_bitrate, CONF_TYPE_INT, CONF_RANGE, 4, 24000000, NULL},
|
2002-11-03 12:43:30 +00:00
|
|
|
|
{ "rc_reaction_delay_factor", &xvidenc_rc_reaction_delay_factor, CONF_TYPE_INT, 0, 0, 0, NULL},
|
|
|
|
|
{ "rc_averaging_period", &xvidenc_rc_averaging_period, CONF_TYPE_INT, 0, 0, 0, NULL},
|
|
|
|
|
{ "rc_buffer", &xvidenc_rc_buffer, CONF_TYPE_INT, 0, 0, 0, NULL},
|
2002-11-22 08:19:08 +00:00
|
|
|
|
{ "quant_range", &xvidenc_quant_range, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
2002-11-03 12:43:30 +00:00
|
|
|
|
{ "min_key_interval", &xvidenc_min_key_interval, CONF_TYPE_INT, 0, 0, 0, NULL}, /* for XVID_MODE_2PASS_2 */
|
|
|
|
|
{ "max_key_interval", &xvidenc_max_key_interval, CONF_TYPE_INT, 0, 0, 0, NULL},
|
|
|
|
|
{ "mpeg_quant", &xvidenc_mpeg_quant, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
2002-11-14 21:46:36 +00:00
|
|
|
|
{ "mod_quant", &xvidenc_mod_quant, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
2002-11-14 21:57:34 +00:00
|
|
|
|
{ "keyframe_boost", &xvidenc_keyframe_boost, CONF_TYPE_INT, CONF_RANGE, 0, 1000, NULL}, /* for XVID_MODE_2PASS_2 */
|
2002-11-03 12:43:30 +00:00
|
|
|
|
{ "kfthreshold", &xvidenc_kfthreshold, CONF_TYPE_INT, 0, 0, 0, NULL}, /* for XVID_MODE_2PASS_2 */
|
2002-11-14 21:46:36 +00:00
|
|
|
|
{ "kfreduction", &xvidenc_kfreduction, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL}, /* for XVID_MODE_2PASS_2 */
|
2002-11-03 12:43:30 +00:00
|
|
|
|
{ "fixed_quant", &xvidenc_fixed_quant, CONF_TYPE_INT, CONF_RANGE, 1, 31, NULL}, /* for XVID_MODE_FIXED_QUANT */
|
|
|
|
|
{ "debug", &xvidenc_debug, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
2003-04-02 22:13:44 +00:00
|
|
|
|
{ "interlacing", &xvidenc_interlacing, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
2003-04-02 22:27:35 +00:00
|
|
|
|
{ "greyscale", &xvidenc_greyscale, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
2002-12-18 08:10:24 +00:00
|
|
|
|
#ifdef XVID_API_UNSTABLE
|
2003-04-02 22:13:44 +00:00
|
|
|
|
{ "packed", &xvidenc_packed, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
|
|
|
|
{ "divx5bvop", &xvidenc_divx5bvop, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
2003-04-02 21:33:19 +00:00
|
|
|
|
//{ "lumi_mask", &xvidenc_lumi_mask, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
2003-04-03 06:53:01 +00:00
|
|
|
|
{ "psnr", &xvidenc_psnr, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
2002-12-15 18:35:11 +00:00
|
|
|
|
{ "qpel", &xvidenc_qpel, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
|
|
|
|
{ "max_bframes", &xvidenc_max_bframes, CONF_TYPE_INT, CONF_RANGE, 0, 4, NULL},
|
|
|
|
|
{ "bquant_ratio", &xvidenc_bquant_ratio, CONF_TYPE_INT, CONF_RANGE, 0, 1000, NULL},
|
|
|
|
|
{ "bquant_offset", &xvidenc_bquant_offset, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL},
|
2003-04-06 15:46:05 +00:00
|
|
|
|
{ "bf_threshold", &xvidenc_bf_threshold, CONF_TYPE_INT, CONF_RANGE, -255, 255, NULL},
|
2002-12-15 18:35:11 +00:00
|
|
|
|
{ "reduced", &xvidenc_reduced, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
|
|
|
|
{ "gmc", &xvidenc_gmc, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
2003-04-02 22:13:44 +00:00
|
|
|
|
{ "chroma_me", &xvidenc_chroma_me, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
2003-04-02 20:31:47 +00:00
|
|
|
|
{ "hq_ac", &xvidenc_hqac, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
2003-04-04 05:47:27 +00:00
|
|
|
|
{ "vhq", &xvidenc_vhq, CONF_TYPE_INT, CONF_RANGE, 0, 4, NULL},
|
2003-04-03 20:36:58 +00:00
|
|
|
|
{ "chroma_opt", &xvidenc_chroma_opt, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
2002-12-15 18:35:11 +00:00
|
|
|
|
#endif
|
2002-09-21 12:34:02 +00:00
|
|
|
|
{ NULL, NULL, 0, 0, 0, 0, NULL}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct vf_priv_s {
|
2002-12-27 22:43:20 +00:00
|
|
|
|
muxer_stream_t* mux;
|
2002-09-21 12:34:02 +00:00
|
|
|
|
XVID_ENC_FRAME enc_frame;
|
|
|
|
|
void* enc_handle;
|
|
|
|
|
vbr_control_t vbr_state;
|
2003-04-03 06:53:01 +00:00
|
|
|
|
int pixels;
|
|
|
|
|
int nb_frames;
|
2002-09-21 12:34:02 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
config(struct vf_instance_s* vf,
|
|
|
|
|
int width, int height, int d_width, int d_height,
|
|
|
|
|
unsigned int flags, unsigned int outfmt)
|
|
|
|
|
{
|
|
|
|
|
XVID_ENC_PARAM enc_param;
|
2002-11-03 12:43:30 +00:00
|
|
|
|
struct vf_priv_s *fp = vf->priv;
|
2002-11-22 08:19:08 +00:00
|
|
|
|
unsigned int min_iq, max_iq, min_pq, max_pq;
|
2002-09-21 12:34:02 +00:00
|
|
|
|
|
2002-11-03 12:43:30 +00:00
|
|
|
|
fp->mux->bih->biWidth = width;
|
|
|
|
|
fp->mux->bih->biHeight = height;
|
|
|
|
|
fp->mux->bih->biSizeImage = fp->mux->bih->biWidth * fp->mux->bih->biHeight * 3;
|
2004-03-24 15:16:36 +00:00
|
|
|
|
fp->mux->aspect = (float)d_width/d_height;
|
2002-11-03 12:43:30 +00:00
|
|
|
|
mp_msg(MSGT_MENCODER,MSGL_INFO,"videocodec: XViD (%dx%d fourcc=%x [%.4s])\n",
|
|
|
|
|
width, height, fp->mux->bih->biCompression, (char *)&fp->mux->bih->biCompression);
|
2002-09-21 12:34:02 +00:00
|
|
|
|
|
2002-11-22 08:19:08 +00:00
|
|
|
|
// {min,max}_{i,p}quantizer parsing & validation
|
|
|
|
|
if (sscanf (xvidenc_quant_range, "%u-%u/%u-%u", &min_iq, &max_iq, &min_pq, &max_pq) < 4) {
|
|
|
|
|
mp_msg (MSGT_MENCODER, MSGL_ERR,
|
|
|
|
|
"xvid: ERROR: cannot parse \"quant_range=%s\"\n", xvidenc_quant_range);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if (min_iq < 1 || min_iq > 31 || max_iq < 1 || max_iq > 31 || min_iq > max_iq ||
|
|
|
|
|
min_pq < 1 || min_pq > 31 || max_pq < 1 || max_pq > 31 || min_pq > max_pq) {
|
|
|
|
|
mp_msg (MSGT_MENCODER, MSGL_ERR,
|
|
|
|
|
"xvid: ERROR: {min,max} {I,P} quantizer must be in [1,31] and min must be <= max.\n");
|
|
|
|
|
mp_msg (MSGT_MENCODER, MSGL_ERR,
|
|
|
|
|
"xvid: ERROR: cannot use \"quant_range=%s\"\n", xvidenc_quant_range);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-18 08:10:24 +00:00
|
|
|
|
#ifdef XVID_API_UNSTABLE
|
|
|
|
|
mp_msg (MSGT_MENCODER, MSGL_WARN,
|
|
|
|
|
"\n"
|
|
|
|
|
"*******************************************************************\n"
|
|
|
|
|
"** **\n"
|
|
|
|
|
"** Y O U ' R E U S I N G U N S T A B L E S O F T W A R E **\n"
|
|
|
|
|
"** **\n"
|
2003-04-02 22:27:35 +00:00
|
|
|
|
"** Streams produced by this version aren't probably compatible **\n"
|
2002-12-18 08:10:24 +00:00
|
|
|
|
"** with anything else, even the xvid decoder itself. There are **\n"
|
|
|
|
|
"** bugs, this code could crash, could blow up your PC or the **\n"
|
|
|
|
|
"** whole building ! **\n"
|
|
|
|
|
"** If you want stable code and compatible streams, use stable **\n"
|
|
|
|
|
"** XViD releases (currently 0.9.x). **\n"
|
|
|
|
|
"** **\n"
|
|
|
|
|
"*******************************************************************\n"
|
|
|
|
|
"\n");
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-11-03 12:43:30 +00:00
|
|
|
|
// initialize XViD core parameters
|
|
|
|
|
// ===============================
|
2002-09-21 12:34:02 +00:00
|
|
|
|
memset(&enc_param, 0, sizeof(enc_param));
|
|
|
|
|
enc_param.width = width;
|
|
|
|
|
enc_param.height = height;
|
2002-11-03 12:43:30 +00:00
|
|
|
|
enc_param.fincr = fp->mux->h.dwScale;
|
|
|
|
|
enc_param.fbase = fp->mux->h.dwRate;
|
|
|
|
|
if (xvidenc_bitrate > 16000)
|
|
|
|
|
enc_param.rc_bitrate = xvidenc_bitrate;
|
|
|
|
|
else if (xvidenc_bitrate > 0)
|
|
|
|
|
enc_param.rc_bitrate = xvidenc_bitrate * 1000;
|
|
|
|
|
else
|
|
|
|
|
enc_param.rc_bitrate = -1;
|
2002-12-18 08:10:24 +00:00
|
|
|
|
#ifdef XVID_API_UNSTABLE
|
2002-12-15 18:35:11 +00:00
|
|
|
|
if (xvidenc_max_bframes >= 1 && xvidenc_pass >= 1) {
|
|
|
|
|
mp_msg(MSGT_MENCODER,MSGL_WARN, "xvid: cannot use bframes with 2-pass, disabling bframes\n");
|
|
|
|
|
xvidenc_max_bframes = 0;
|
|
|
|
|
}
|
|
|
|
|
enc_param.max_bframes = xvidenc_max_bframes;
|
|
|
|
|
enc_param.bquant_ratio = xvidenc_bquant_ratio;
|
|
|
|
|
enc_param.bquant_offset = xvidenc_bquant_offset;
|
2003-04-02 22:13:44 +00:00
|
|
|
|
if (xvidenc_divx5bvop)
|
|
|
|
|
enc_param.global |= XVID_GLOBAL_DX50BVOP;
|
|
|
|
|
if (xvidenc_packed)
|
|
|
|
|
enc_param.global |= XVID_GLOBAL_PACKED;
|
2002-12-15 18:35:11 +00:00
|
|
|
|
if (xvidenc_reduced)
|
|
|
|
|
enc_param.global |= XVID_GLOBAL_REDUCED;
|
2003-04-03 06:53:01 +00:00
|
|
|
|
if (xvidenc_psnr) {
|
2003-04-02 20:31:47 +00:00
|
|
|
|
enc_param.global |= XVID_GLOBAL_EXTRASTATS;
|
2003-04-03 06:53:01 +00:00
|
|
|
|
fp->pixels = width * height;
|
|
|
|
|
fp->nb_frames = 0;
|
|
|
|
|
xvid_error[0] = xvid_error[1] = xvid_error[2] = 0;
|
|
|
|
|
}
|
2003-04-02 22:27:35 +00:00
|
|
|
|
if (xvidenc_greyscale)
|
|
|
|
|
enc_param.global |= XVID_GREYSCALE;
|
2003-04-04 20:45:05 +00:00
|
|
|
|
#endif
|
2002-11-03 12:43:30 +00:00
|
|
|
|
enc_param.rc_reaction_delay_factor = xvidenc_rc_reaction_delay_factor;
|
|
|
|
|
enc_param.rc_averaging_period = xvidenc_rc_averaging_period;
|
|
|
|
|
enc_param.rc_buffer = xvidenc_rc_buffer;
|
2002-11-22 08:19:08 +00:00
|
|
|
|
enc_param.min_quantizer = min_iq;
|
|
|
|
|
enc_param.max_quantizer = max_iq;
|
2002-11-17 13:01:06 +00:00
|
|
|
|
if( xvidenc_max_key_interval <= 0 )
|
|
|
|
|
xvidenc_max_key_interval = 10 * enc_param.fbase / enc_param.fincr;
|
|
|
|
|
enc_param.max_key_interval = xvidenc_max_key_interval;
|
2002-09-21 12:34:02 +00:00
|
|
|
|
switch (xvid_encore(NULL, XVID_ENC_CREATE, &enc_param, NULL)) {
|
|
|
|
|
case XVID_ERR_FAIL:
|
2002-11-03 12:43:30 +00:00
|
|
|
|
mp_msg(MSGT_MENCODER,MSGL_ERR, "xvid: encoder creation failed\n");
|
2002-09-21 12:34:02 +00:00
|
|
|
|
return 0;
|
|
|
|
|
case XVID_ERR_MEMORY:
|
2002-11-03 12:43:30 +00:00
|
|
|
|
mp_msg(MSGT_MENCODER,MSGL_ERR, "xvid: encoder creation failed, out of memory\n");
|
2002-09-21 12:34:02 +00:00
|
|
|
|
return 0;
|
|
|
|
|
case XVID_ERR_FORMAT:
|
2002-11-03 12:43:30 +00:00
|
|
|
|
mp_msg(MSGT_MENCODER,MSGL_ERR, "xvid: encoder creation failed, bad format\n");
|
2002-09-21 12:34:02 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2002-11-03 12:43:30 +00:00
|
|
|
|
fp->enc_handle = enc_param.handle;
|
|
|
|
|
|
|
|
|
|
// initialize XViD per-frame static parameters
|
|
|
|
|
// ===========================================
|
2002-12-15 18:35:11 +00:00
|
|
|
|
fp->enc_frame.motion = motion_presets[xvidenc_quality];
|
|
|
|
|
fp->enc_frame.general = XVID_HALFPEL | (xvidenc_mpeg_quant ? XVID_MPEGQUANT : XVID_H263QUANT);
|
|
|
|
|
if (xvidenc_4mv)
|
|
|
|
|
fp->enc_frame.general |= XVID_INTER4V;
|
2003-04-02 22:13:44 +00:00
|
|
|
|
if (xvidenc_interlacing)
|
|
|
|
|
fp->enc_frame.general |= XVID_INTERLACING;
|
2002-12-18 08:10:24 +00:00
|
|
|
|
#ifdef XVID_API_UNSTABLE
|
2003-04-06 15:46:05 +00:00
|
|
|
|
fp->enc_frame.bframe_threshold = xvidenc_bf_threshold;
|
2003-04-04 20:45:05 +00:00
|
|
|
|
if (xvidenc_lumi_mask)
|
|
|
|
|
fp->enc_frame.general |= XVID_LUMIMASKING;
|
2002-12-15 18:35:11 +00:00
|
|
|
|
if (xvidenc_qpel) {
|
|
|
|
|
fp->enc_frame.general |= XVID_QUARTERPEL;
|
2003-04-03 20:36:58 +00:00
|
|
|
|
fp->enc_frame.motion |= PMV_QUARTERPELREFINE16 | PMV_QUARTERPELREFINE8;
|
2002-12-15 18:35:11 +00:00
|
|
|
|
}
|
2003-04-03 20:36:58 +00:00
|
|
|
|
switch (xvidenc_vhq) {
|
2003-04-04 05:47:27 +00:00
|
|
|
|
case 4: // wide search
|
2003-04-03 20:36:58 +00:00
|
|
|
|
fp->enc_frame.motion |= EXTSEARCH_BITS | PMV_EXTSEARCH8;
|
2003-04-04 05:47:27 +00:00
|
|
|
|
case 3: // medium search
|
2003-04-03 20:36:58 +00:00
|
|
|
|
fp->enc_frame.motion |= HALFPELREFINE8_BITS | QUARTERPELREFINE8_BITS | CHECKPREDICTION_BITS;
|
2003-04-04 05:47:27 +00:00
|
|
|
|
case 2: // limited search
|
2003-04-03 20:36:58 +00:00
|
|
|
|
fp->enc_frame.motion |= HALFPELREFINE16_BITS | QUARTERPELREFINE16_BITS;
|
2003-04-04 05:47:27 +00:00
|
|
|
|
case 1: // mode decision
|
2003-04-02 20:31:47 +00:00
|
|
|
|
fp->enc_frame.general |= XVID_MODEDECISION_BITS;
|
2003-04-03 20:36:58 +00:00
|
|
|
|
break;
|
|
|
|
|
case 0: // off
|
|
|
|
|
break;
|
|
|
|
|
}
|
2002-12-15 18:35:11 +00:00
|
|
|
|
if (xvidenc_gmc)
|
|
|
|
|
fp->enc_frame.general |= XVID_GMC;
|
2003-04-03 06:53:01 +00:00
|
|
|
|
if (xvidenc_psnr)
|
2003-04-02 20:31:47 +00:00
|
|
|
|
fp->enc_frame.general |= XVID_EXTRASTATS;
|
2003-04-02 22:13:44 +00:00
|
|
|
|
if (xvidenc_chroma_me)
|
2003-04-02 20:31:47 +00:00
|
|
|
|
fp->enc_frame.motion |= PMV_CHROMA16 | PMV_CHROMA8;
|
2002-12-15 18:35:11 +00:00
|
|
|
|
if(xvidenc_reduced)
|
|
|
|
|
fp->enc_frame.general |= XVID_REDUCED;
|
2003-04-02 20:31:47 +00:00
|
|
|
|
if(xvidenc_hqac)
|
|
|
|
|
fp->enc_frame.general |= XVID_HQACPRED;
|
2003-04-03 20:36:58 +00:00
|
|
|
|
if (xvidenc_chroma_opt)
|
2003-04-02 20:31:47 +00:00
|
|
|
|
fp->enc_frame.general |= XVID_CHROMAOPT;
|
2003-04-04 20:45:05 +00:00
|
|
|
|
#else
|
|
|
|
|
if (xvidenc_greyscale)
|
|
|
|
|
fp->enc_frame.general |= XVID_GREYSCALE;
|
2002-12-15 18:35:11 +00:00
|
|
|
|
#endif
|
2002-09-21 12:34:02 +00:00
|
|
|
|
|
|
|
|
|
switch (outfmt) {
|
|
|
|
|
case IMGFMT_YV12:
|
2002-11-03 12:43:30 +00:00
|
|
|
|
fp->enc_frame.colorspace = XVID_CSP_YV12;
|
2002-09-21 12:34:02 +00:00
|
|
|
|
break;
|
|
|
|
|
case IMGFMT_IYUV: case IMGFMT_I420:
|
2002-11-03 12:43:30 +00:00
|
|
|
|
fp->enc_frame.colorspace = XVID_CSP_I420;
|
2002-09-21 12:34:02 +00:00
|
|
|
|
break;
|
|
|
|
|
case IMGFMT_YUY2:
|
2002-11-03 12:43:30 +00:00
|
|
|
|
fp->enc_frame.colorspace = XVID_CSP_YUY2;
|
2002-09-21 12:34:02 +00:00
|
|
|
|
break;
|
|
|
|
|
case IMGFMT_UYVY:
|
2002-11-03 12:43:30 +00:00
|
|
|
|
fp->enc_frame.colorspace = XVID_CSP_UYVY;
|
2002-09-21 12:34:02 +00:00
|
|
|
|
break;
|
|
|
|
|
case IMGFMT_RGB24: case IMGFMT_BGR24:
|
2002-11-03 12:43:30 +00:00
|
|
|
|
fp->enc_frame.colorspace = XVID_CSP_RGB24;
|
2002-09-21 12:34:02 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
mp_msg(MSGT_MENCODER,MSGL_ERR,"xvid: unsupported picture format (%s)!\n",
|
|
|
|
|
vo_format_name(outfmt));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2002-11-03 12:43:30 +00:00
|
|
|
|
fp->enc_frame.quant_intra_matrix = 0;
|
|
|
|
|
fp->enc_frame.quant_inter_matrix = 0;
|
|
|
|
|
|
|
|
|
|
// initialize VBR engine
|
|
|
|
|
// =====================
|
|
|
|
|
vbrSetDefaults(&fp->vbr_state);
|
2002-11-17 13:01:06 +00:00
|
|
|
|
if (xvidenc_min_key_interval < 0)
|
|
|
|
|
xvidenc_min_key_interval = fp->vbr_state.min_key_interval;
|
|
|
|
|
|
|
|
|
|
// pass
|
2002-11-03 12:43:30 +00:00
|
|
|
|
if (xvidenc_pass == 0) {
|
|
|
|
|
if (xvidenc_fixed_quant >= 1) {
|
|
|
|
|
fp->vbr_state.mode = VBR_MODE_FIXED_QUANT;
|
|
|
|
|
fp->vbr_state.fixed_quant = xvidenc_fixed_quant;
|
|
|
|
|
} else
|
|
|
|
|
fp->vbr_state.mode = VBR_MODE_1PASS;
|
2002-09-21 12:34:02 +00:00
|
|
|
|
}
|
2002-11-03 12:43:30 +00:00
|
|
|
|
else if (xvidenc_pass == 1)
|
|
|
|
|
fp->vbr_state.mode = VBR_MODE_2PASS_1;
|
|
|
|
|
else if (xvidenc_pass == 2)
|
|
|
|
|
fp->vbr_state.mode = VBR_MODE_2PASS_2;
|
|
|
|
|
else
|
|
|
|
|
return -1;
|
2002-11-17 13:01:06 +00:00
|
|
|
|
|
|
|
|
|
// misc
|
2002-11-03 12:43:30 +00:00
|
|
|
|
fp->vbr_state.fps = (double)enc_param.fbase / enc_param.fincr;
|
|
|
|
|
fp->vbr_state.filename = passtmpfile;
|
|
|
|
|
fp->vbr_state.desired_bitrate = enc_param.rc_bitrate;
|
2002-11-22 08:19:08 +00:00
|
|
|
|
fp->vbr_state.min_iquant = min_iq;
|
|
|
|
|
fp->vbr_state.max_iquant = max_iq;
|
|
|
|
|
fp->vbr_state.min_pquant = min_pq;
|
|
|
|
|
fp->vbr_state.max_pquant = max_pq;
|
2002-11-17 13:01:06 +00:00
|
|
|
|
if (xvidenc_keyframe_boost >= 0)
|
2002-11-03 12:43:30 +00:00
|
|
|
|
fp->vbr_state.keyframe_boost = xvidenc_keyframe_boost;
|
2002-11-14 21:46:36 +00:00
|
|
|
|
if (xvidenc_kfthreshold >= 0)
|
2002-11-03 12:43:30 +00:00
|
|
|
|
fp->vbr_state.kftreshold = xvidenc_kfthreshold;
|
2002-11-14 21:46:36 +00:00
|
|
|
|
if (xvidenc_kfreduction >= 0)
|
2002-11-03 12:43:30 +00:00
|
|
|
|
fp->vbr_state.kfreduction = xvidenc_kfreduction;
|
2002-11-17 13:01:06 +00:00
|
|
|
|
if (xvidenc_min_key_interval >= 0)
|
2002-11-03 12:43:30 +00:00
|
|
|
|
fp->vbr_state.min_key_interval = xvidenc_min_key_interval;
|
|
|
|
|
fp->vbr_state.max_key_interval = enc_param.max_key_interval;
|
|
|
|
|
fp->vbr_state.debug = xvidenc_debug;
|
2002-11-17 13:01:06 +00:00
|
|
|
|
|
2002-11-03 12:43:30 +00:00
|
|
|
|
vbrInit(&fp->vbr_state);
|
|
|
|
|
|
2002-09-21 12:34:02 +00:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-04 15:22:59 +00:00
|
|
|
|
#ifdef XVID_API_UNSTABLE
|
2003-04-03 06:53:01 +00:00
|
|
|
|
static double
|
|
|
|
|
sse_to_PSNR(double sse, double pixels)
|
|
|
|
|
{
|
|
|
|
|
return sse == 0 ? INFINITY : 4.34294481903251827652 * (11.08252709031685229249 - log(sse/pixels));
|
|
|
|
|
// 4.34294481903251827652 = 10/log(10)
|
|
|
|
|
// 11.08252709031685229249 = log(255*255)
|
|
|
|
|
}
|
2003-04-04 15:22:59 +00:00
|
|
|
|
#endif
|
2003-04-03 06:53:01 +00:00
|
|
|
|
|
2002-09-21 12:34:02 +00:00
|
|
|
|
static void
|
|
|
|
|
uninit(struct vf_instance_s* vf)
|
|
|
|
|
{
|
2002-11-03 12:43:30 +00:00
|
|
|
|
struct vf_priv_s *fp = vf->priv;
|
|
|
|
|
|
2003-04-04 15:22:59 +00:00
|
|
|
|
#ifdef XVID_API_UNSTABLE
|
2003-04-03 06:53:01 +00:00
|
|
|
|
if (xvidenc_psnr) {
|
|
|
|
|
double p = (double)fp->pixels * (double)fp->nb_frames;
|
|
|
|
|
printf ("PSNR: Y:%2.2f, Cb:%2.2f, Cr:%2.2f, All:%2.2f\n",
|
|
|
|
|
sse_to_PSNR(xvid_error[0], p),
|
|
|
|
|
sse_to_PSNR(xvid_error[1], p/4),
|
|
|
|
|
sse_to_PSNR(xvid_error[2], p/4),
|
|
|
|
|
sse_to_PSNR(xvid_error[0] + xvid_error[1] + xvid_error[2], p*1.5));
|
|
|
|
|
}
|
2003-04-04 15:22:59 +00:00
|
|
|
|
#endif
|
2002-11-03 12:43:30 +00:00
|
|
|
|
vbrFinish(&fp->vbr_state);
|
2002-09-21 12:34:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
case IMGFMT_YUY2: case IMGFMT_UYVY:
|
|
|
|
|
return VFCAP_CSP_SUPPORTED;
|
|
|
|
|
case IMGFMT_RGB24: case IMGFMT_BGR24:
|
|
|
|
|
return VFCAP_CSP_SUPPORTED | VFCAP_FLIPPED;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
put_image(struct vf_instance_s* vf, mp_image_t *mpi)
|
|
|
|
|
{
|
|
|
|
|
XVID_ENC_STATS enc_stats;
|
2002-11-03 12:43:30 +00:00
|
|
|
|
struct vf_priv_s *fp = vf->priv;
|
2002-09-21 12:34:02 +00:00
|
|
|
|
|
2002-11-03 12:43:30 +00:00
|
|
|
|
fp->enc_frame.bitstream = fp->mux->buffer;
|
|
|
|
|
fp->enc_frame.length = -1 /* fp->mux->buffer_size */;
|
|
|
|
|
fp->enc_frame.image = mpi->planes[0];
|
2002-12-25 11:44:14 +00:00
|
|
|
|
#ifdef XVID_API_UNSTABLE
|
|
|
|
|
fp->enc_frame.stride = mpi->stride[0];
|
|
|
|
|
#endif
|
2002-11-14 21:46:36 +00:00
|
|
|
|
|
|
|
|
|
// get quantizers & I/P decision from the VBR engine
|
2002-12-18 08:10:24 +00:00
|
|
|
|
#ifdef XVID_API_UNSTABLE
|
2002-12-15 18:35:11 +00:00
|
|
|
|
if (xvidenc_max_bframes >= 1) {
|
2003-04-02 20:31:47 +00:00
|
|
|
|
if (xvidenc_fixed_quant!=0) {
|
2002-12-15 18:35:11 +00:00
|
|
|
|
// hack, the internal VBR engine isn't fixed-quant aware
|
|
|
|
|
fp->enc_frame.quant = xvidenc_fixed_quant;
|
|
|
|
|
fp->enc_frame.intra = -1;
|
|
|
|
|
fp->enc_frame.bquant = (xvidenc_fixed_quant * xvidenc_bquant_ratio + xvidenc_bquant_offset) / 100;
|
|
|
|
|
} else
|
|
|
|
|
// use the internal VBR engine since the external one isn't bframe aware
|
2003-04-02 20:31:47 +00:00
|
|
|
|
fp->enc_frame.quant =0;
|
|
|
|
|
fp->enc_frame.intra =-1;
|
|
|
|
|
fp->enc_frame.bquant = 0;
|
2002-12-15 18:35:11 +00:00
|
|
|
|
} else {
|
|
|
|
|
fp->enc_frame.quant = vbrGetQuant(&fp->vbr_state);
|
|
|
|
|
fp->enc_frame.intra = vbrGetIntra(&fp->vbr_state);
|
|
|
|
|
}
|
|
|
|
|
#else
|
2002-11-03 12:43:30 +00:00
|
|
|
|
fp->enc_frame.quant = vbrGetQuant(&fp->vbr_state);
|
|
|
|
|
fp->enc_frame.intra = vbrGetIntra(&fp->vbr_state);
|
2002-12-15 18:35:11 +00:00
|
|
|
|
#endif
|
2002-11-14 21:46:36 +00:00
|
|
|
|
|
|
|
|
|
// modulated quantizer type
|
|
|
|
|
if (xvidenc_mod_quant && xvidenc_pass == 2) {
|
|
|
|
|
fp->enc_frame.general |= (fp->enc_frame.quant < 4) ? XVID_MPEGQUANT : XVID_H263QUANT;
|
|
|
|
|
fp->enc_frame.general &= (fp->enc_frame.quant < 4) ? ~XVID_H263QUANT : ~XVID_MPEGQUANT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// encode frame
|
2002-11-03 12:43:30 +00:00
|
|
|
|
switch (xvid_encore(fp->enc_handle, XVID_ENC_ENCODE, &fp->enc_frame, &enc_stats)) {
|
2002-09-21 12:34:02 +00:00
|
|
|
|
case XVID_ERR_OK:
|
|
|
|
|
break;
|
|
|
|
|
case XVID_ERR_MEMORY:
|
|
|
|
|
mp_msg(MSGT_MENCODER, MSGL_ERR, "xvid: out of memory\n");
|
|
|
|
|
break;
|
|
|
|
|
case XVID_ERR_FORMAT:
|
|
|
|
|
mp_msg(MSGT_MENCODER, MSGL_ERR, "xvid: bad format\n");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
mp_msg(MSGT_MENCODER, MSGL_ERR, "xvid: failure\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
2003-04-03 06:53:01 +00:00
|
|
|
|
|
2003-04-04 15:22:59 +00:00
|
|
|
|
#ifdef XVID_API_UNSTABLE
|
2003-04-03 06:53:01 +00:00
|
|
|
|
if (xvidenc_psnr) {
|
|
|
|
|
static FILE *fvstats = NULL;
|
|
|
|
|
char filename[20];
|
|
|
|
|
|
|
|
|
|
if (!fvstats) {
|
|
|
|
|
time_t today2;
|
|
|
|
|
struct tm *today;
|
|
|
|
|
today2 = time (NULL);
|
|
|
|
|
today = localtime (&today2);
|
|
|
|
|
sprintf (filename, "psnr_%02d%02d%02d.log", today->tm_hour, today->tm_min, today->tm_sec);
|
|
|
|
|
fvstats = fopen (filename,"w");
|
|
|
|
|
if (!fvstats) {
|
|
|
|
|
perror ("fopen");
|
|
|
|
|
xvidenc_psnr = 0; // disable block
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xvid_error[0] += enc_stats.sse_y;
|
|
|
|
|
xvid_error[1] += enc_stats.sse_u;
|
|
|
|
|
xvid_error[2] += enc_stats.sse_v;
|
|
|
|
|
|
|
|
|
|
fprintf (fvstats, "%6d, %2d, %6d, %2.2f, %2.2f, %2.2f, %2.2f %c\n",
|
|
|
|
|
fp->nb_frames,
|
|
|
|
|
enc_stats.quant,
|
|
|
|
|
fp->enc_frame.length,
|
|
|
|
|
sse_to_PSNR (enc_stats.sse_y, fp->pixels),
|
|
|
|
|
sse_to_PSNR (enc_stats.sse_u, fp->pixels / 4),
|
|
|
|
|
sse_to_PSNR (enc_stats.sse_v, fp->pixels / 4),
|
|
|
|
|
sse_to_PSNR (enc_stats.sse_y + enc_stats.sse_u + enc_stats.sse_v, (double)fp->pixels * 1.5),
|
|
|
|
|
fp->enc_frame.intra == 0 ? 'P' : fp->enc_frame.intra == 1 ? 'I' : 'B'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
fp->nb_frames++;
|
|
|
|
|
}
|
2003-04-04 15:22:59 +00:00
|
|
|
|
#endif
|
2002-11-14 21:46:36 +00:00
|
|
|
|
|
|
|
|
|
// write output
|
2006-01-26 19:32:07 +00:00
|
|
|
|
muxer_write_chunk(fp->mux, fp->enc_frame.length, fp->enc_frame.intra==1 ? 0x10 : 0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
|
2002-11-14 21:46:36 +00:00
|
|
|
|
|
|
|
|
|
// update the VBR engine
|
2002-11-03 12:43:30 +00:00
|
|
|
|
vbrUpdate(&fp->vbr_state, enc_stats.quant, fp->enc_frame.intra,
|
|
|
|
|
enc_stats.hlength, fp->enc_frame.length, enc_stats.kblks, enc_stats.mblks, enc_stats.ublks);
|
2002-11-14 21:46:36 +00:00
|
|
|
|
|
2002-09-21 12:34:02 +00:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//===========================================================================//
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
vf_open(vf_instance_t *vf, char* args)
|
|
|
|
|
{
|
|
|
|
|
XVID_INIT_PARAM params = { 0, 0, 0};
|
|
|
|
|
vf->config = config;
|
2005-03-01 20:21:58 +00:00
|
|
|
|
vf->default_caps = VFCAP_CONSTANT;
|
2002-09-21 12:34:02 +00:00
|
|
|
|
vf->control = control;
|
|
|
|
|
vf->uninit = uninit;
|
|
|
|
|
vf->query_format = query_format;
|
|
|
|
|
vf->put_image = put_image;
|
|
|
|
|
vf->priv = malloc(sizeof(struct vf_priv_s));
|
|
|
|
|
memset(vf->priv, 0, sizeof(struct vf_priv_s));
|
2002-12-27 22:43:20 +00:00
|
|
|
|
vf->priv->mux = (muxer_stream_t*)args;
|
2002-09-21 12:34:02 +00:00
|
|
|
|
|
2005-01-20 22:53:37 +00:00
|
|
|
|
vf->priv->mux->bih = calloc(1, sizeof(BITMAPINFOHEADER));
|
2002-09-21 12:34:02 +00:00
|
|
|
|
vf->priv->mux->bih->biSize = sizeof(BITMAPINFOHEADER);
|
|
|
|
|
vf->priv->mux->bih->biWidth = 0;
|
|
|
|
|
vf->priv->mux->bih->biHeight = 0;
|
|
|
|
|
vf->priv->mux->bih->biPlanes = 1;
|
|
|
|
|
vf->priv->mux->bih->biBitCount = 24;
|
|
|
|
|
vf->priv->mux->bih->biCompression = mmioFOURCC('X','V','I','D');
|
|
|
|
|
|
|
|
|
|
if (xvid_init(NULL, 0, ¶ms, NULL) != XVID_ERR_OK) {
|
2002-11-03 12:43:30 +00:00
|
|
|
|
mp_msg(MSGT_MENCODER,MSGL_ERR, "xvid: initialisation failure\n");
|
2002-09-21 12:34:02 +00:00
|
|
|
|
abort();
|
|
|
|
|
}
|
|
|
|
|
if (params.api_version != API_VERSION) {
|
2002-11-03 12:43:30 +00:00
|
|
|
|
mp_msg(MSGT_MENCODER,MSGL_ERR, "xvid: XviD library API version mismatch\n"
|
2002-09-21 12:34:02 +00:00
|
|
|
|
"\texpected %d.%d, got %d.%d, you should recompile MPlayer.\n",
|
|
|
|
|
API_VERSION >> 16, API_VERSION & 0xff,
|
|
|
|
|
params.api_version >> 16, params.api_version & 0xff);
|
|
|
|
|
abort();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vf_info_t ve_info_xvid = {
|
|
|
|
|
"XviD encoder",
|
|
|
|
|
"xvid",
|
2002-11-03 12:43:30 +00:00
|
|
|
|
"Kim Minh Kaplan & R<>mi Guyomarch",
|
2002-09-21 12:34:02 +00:00
|
|
|
|
"for internal use by mencoder",
|
|
|
|
|
vf_open
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//===========================================================================//
|
|
|
|
|
#endif
|