annotate libmpcodecs/ve_xvid.c @ 8022:6ec749d1b87e

increase buffer size in immediate mode
author henry
date Fri, 01 Nov 2002 11:14:23 +0000
parents e5dacf3e6a04
children 26a2ae540b04
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7456
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
1 #include <stdio.h>
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
2 #include <stdlib.h>
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
3 #include <string.h>
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
4
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
5 #include "../config.h"
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
6 #include "../mp_msg.h"
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
7
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
8 #ifdef HAVE_XVID
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
9
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
10 #include "codec-cfg.h"
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
11 #include "stream.h"
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
12 #include "demuxer.h"
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
13 #include "stheader.h"
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
14
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
15 #include "aviwrite.h"
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
16
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
17 #include "img_format.h"
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
18 #include "mp_image.h"
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
19 #include "vf.h"
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
20
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
21 #include <xvid.h>
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
22 #include "xvid_vbr.h"
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
23
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
24 #include "cfgparser.h"
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
25
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
26 /**********************************************************************/
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
27 /* Divx4 quality to XviD encoder motion flag presets */
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
28 static int const divx4_motion_presets[7] = {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
29 0,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
30 PMV_EARLYSTOP16,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
31 PMV_EARLYSTOP16 | PMV_ADVANCEDDIAMOND16,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
32 PMV_EARLYSTOP16 | PMV_HALFPELREFINE16,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
33 PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EARLYSTOP8 | PMV_HALFPELREFINE8,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
34 PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EARLYSTOP8 | PMV_HALFPELREFINE8,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
35 PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EXTSEARCH16 | PMV_EARLYSTOP8 | PMV_HALFPELREFINE8
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
36 };
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
37
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
38 /* Divx4 quality to general encoder flag presets */
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
39 static int const divx4_general_presets[7] = {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
40 0,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
41 XVID_H263QUANT,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
42 XVID_H263QUANT,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
43 XVID_H263QUANT | XVID_HALFPEL,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
44 XVID_H263QUANT | XVID_INTER4V | XVID_HALFPEL,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
45 XVID_H263QUANT | XVID_INTER4V | XVID_HALFPEL,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
46 XVID_H263QUANT | XVID_INTER4V | XVID_HALFPEL
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
47 };
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
48
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
49 struct {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
50 int quality;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
51 int bitrate;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
52 int rc_reaction_delay_factor;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
53 int rc_averaging_period;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
54 int rc_buffer;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
55 int max_quantizer;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
56 int min_quantizer;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
57 int max_key_interval;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
58 enum {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
59 XVID_MODE_CBR = 0, XVID_MODE_2PASS_1, XVID_MODE_2PASS_2, XVID_MODE_FIXED_QUANT,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
60 XVID_MODE_UNSPEC = -1
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
61 } mode;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
62 int debug;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
63 char *stats_file;;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
64 int keyframe_boost;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
65 int kfthreshold;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
66 int kfreduction;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
67 int min_key_interval;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
68 int fixed_quant;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
69 } xvidenc_param = {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
70 sizeof(divx4_motion_presets) / sizeof(divx4_motion_presets[0]) - 1, /* quality */
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
71 0, 0, 0, 0, 0, 0, 0,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
72 XVID_MODE_CBR,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
73 1, /* debug */
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
74 NULL, /* stats_file */
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
75 -1, -1, -1, /* keyframe_boost, kfthreshold, kfreduction */
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
76 -1, /* min_key_interval */
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
77 -1, /* fixed_quant */
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
78 };
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
79
7458
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
80 static struct config mode_conf[] = {
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
81 /* cbr, vbrqual, vbrquant, 2pass-1, 2pass-2-int, 2pass-2-ext */
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
82 { "cbr", &xvidenc_param.mode, CONF_TYPE_FLAG, 0, 0, XVID_MODE_CBR, NULL},
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
83 { "fixedquant", &xvidenc_param.mode, CONF_TYPE_FLAG, 0, 0, XVID_MODE_FIXED_QUANT, NULL},
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
84 { "2pass-1", &xvidenc_param.mode, CONF_TYPE_FLAG, 0, 0, XVID_MODE_2PASS_1, NULL},
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
85 { "2pass-2", &xvidenc_param.mode, CONF_TYPE_FLAG, 0, 0, XVID_MODE_2PASS_2, NULL},
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
86 { "help", "\nAvailable modes: \n"
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
87 " cbr - Constant Bit Rate\n"
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
88 " 2pass-1 - First pass of two pass mode\n"
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
89 " 2pass-2 - Second pass of two pass mode\n"
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
90 " fixedquant - Fixed quantizer mode\n"
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
91 "\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
92 { NULL, NULL, 0, 0, 0, 0, NULL}
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
93 };
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
94
7456
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
95 struct config xvidencopts_conf[] = {
7458
e5dacf3e6a04 Use string selection to choose mode
kmkaplan
parents: 7456
diff changeset
96 { "mode", mode_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
7456
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
97 { "quality", &xvidenc_param.quality, CONF_TYPE_INT, CONF_RANGE, 0,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
98 sizeof(divx4_motion_presets) / sizeof(divx4_motion_presets[0]) - 1, NULL},
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
99 { "br", &xvidenc_param.bitrate, CONF_TYPE_INT, 0, 0, 0, NULL},
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
100 { "rc_reaction_delay_factor", &xvidenc_param.rc_reaction_delay_factor, CONF_TYPE_INT, 0, 0, NULL},
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
101 { "rc_averaging_period", &xvidenc_param.rc_averaging_period, CONF_TYPE_INT, 0, 0, NULL},
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
102 { "rc_buffer", &xvidenc_param.rc_buffer, CONF_TYPE_INT, 0, 0, NULL},
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
103 { "max_quantizer", &xvidenc_param.max_quantizer, CONF_TYPE_INT, 0, 0, NULL},
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
104 { "min_quantizer", &xvidenc_param.max_quantizer, CONF_TYPE_INT, 0, 0, NULL},
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
105 { "max_key_interval", &xvidenc_param.max_key_interval, CONF_TYPE_INT, 0, 0, NULL},
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
106 { "nodebug", &xvidenc_param.debug, CONF_TYPE_FLAG, 0, 0, 0, NULL},
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
107 { "debug", &xvidenc_param.debug, CONF_TYPE_FLAG, 0, 0, 1, NULL},
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
108 { "statsfile", &xvidenc_param.stats_file, CONF_TYPE_STRING, 0, 0, 0, NULL}, /* for XVID_MODE_2PASS_1/22 */
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
109 { "keyframe_boost", &xvidenc_param.keyframe_boost, CONF_TYPE_INT, 0, 0, 0, NULL}, /* for XVID_MODE_2PASS_2 */
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
110 { "kfthreshold", &xvidenc_param.kfthreshold, CONF_TYPE_INT, 0, 0, 0, NULL}, /* for XVID_MODE_2PASS_2 */
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
111 { "kfreduction", &xvidenc_param.kfreduction, CONF_TYPE_INT, 0, 0, 0, NULL}, /* for XVID_MODE_2PASS_2 */
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
112 { "min_key_interval", &xvidenc_param.max_key_interval, CONF_TYPE_INT, 0, 0, 0, NULL}, /* for XVID_MODE_2PASS_2 */
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
113 { "fixed_quant", &xvidenc_param.fixed_quant, CONF_TYPE_INT, CONF_RANGE, 1, 31, NULL}, /* for XVID_MODE_FIXED_QUANT */
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
114 { NULL, NULL, 0, 0, 0, 0, NULL}
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
115 };
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
116
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
117 struct vf_priv_s {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
118 aviwrite_stream_t* mux;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
119 XVID_ENC_FRAME enc_frame;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
120 void* enc_handle;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
121 vbr_control_t vbr_state;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
122 FILE *hintfile;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
123 };
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
124
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
125 static FILE *
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
126 get_hint_file(struct vf_instance_s* vf, unsigned char *mode)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
127 {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
128 if (vf->priv->hintfile == NULL) {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
129 vf->priv->hintfile = fopen("xvid_hint_me.dat", mode);
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
130 if (vf->priv->hintfile == NULL)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
131 perror("xvid: could not open xvid_hint_me.dat");
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
132 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
133 return vf->priv->hintfile;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
134 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
135
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
136 static int
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
137 config(struct vf_instance_s* vf,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
138 int width, int height, int d_width, int d_height,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
139 unsigned int flags, unsigned int outfmt)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
140 {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
141 XVID_ENC_PARAM enc_param;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
142
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
143 vf->priv->mux->bih->biWidth = width;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
144 vf->priv->mux->bih->biHeight = height;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
145 vf->priv->mux->bih->biSizeImage = vf->priv->mux->bih->biWidth * vf->priv->mux->bih->biHeight * 3;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
146
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
147 memset(&enc_param, 0, sizeof(enc_param));
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
148 enc_param.width = width;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
149 enc_param.height = height;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
150 enc_param.fincr = vf->priv->mux->h.dwScale;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
151 enc_param.fbase = vf->priv->mux->h.dwRate;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
152 enc_param.rc_bitrate = xvidenc_param.bitrate;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
153 enc_param.rc_reaction_delay_factor = xvidenc_param.rc_reaction_delay_factor;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
154 enc_param.rc_averaging_period = xvidenc_param.rc_averaging_period;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
155 enc_param.rc_buffer = xvidenc_param.rc_buffer;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
156 enc_param.max_quantizer = xvidenc_param.max_quantizer;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
157 enc_param.min_quantizer = xvidenc_param.min_quantizer;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
158 enc_param.max_key_interval = xvidenc_param.max_key_interval;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
159 switch (xvid_encore(NULL, XVID_ENC_CREATE, &enc_param, NULL)) {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
160 case XVID_ERR_FAIL:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
161 fprintf(stderr, "xvid: encoder creation failed\n");
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
162 return 0;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
163 case XVID_ERR_MEMORY:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
164 fprintf(stderr, "xvid: encoder creation failed, out of memory\n");
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
165 return 0;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
166 case XVID_ERR_FORMAT:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
167 fprintf(stderr, "xvid: encoder creation failed, bad format\n");
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
168 return 0;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
169 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
170 vf->priv->enc_handle = enc_param.handle;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
171
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
172 vf->priv->enc_frame.general = divx4_general_presets[xvidenc_param.quality];
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
173 vf->priv->enc_frame.motion = divx4_motion_presets[xvidenc_param.quality];
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
174 switch (outfmt) {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
175 case IMGFMT_YV12:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
176 vf->priv->enc_frame.colorspace = XVID_CSP_YV12;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
177 break;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
178 case IMGFMT_IYUV: case IMGFMT_I420:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
179 vf->priv->enc_frame.colorspace = XVID_CSP_I420;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
180 break;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
181 case IMGFMT_YUY2:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
182 vf->priv->enc_frame.colorspace = XVID_CSP_YUY2;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
183 break;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
184 case IMGFMT_UYVY:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
185 vf->priv->enc_frame.colorspace = XVID_CSP_UYVY;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
186 break;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
187 case IMGFMT_RGB24: case IMGFMT_BGR24:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
188 vf->priv->enc_frame.colorspace = XVID_CSP_RGB24;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
189 break;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
190 default:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
191 mp_msg(MSGT_MENCODER,MSGL_ERR,"xvid: unsupported picture format (%s)!\n",
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
192 vo_format_name(outfmt));
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
193 return 0;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
194 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
195 vf->priv->enc_frame.quant_intra_matrix = 0;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
196 vf->priv->enc_frame.quant_inter_matrix = 0;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
197
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
198 vf->priv->vbr_state.debug = xvidenc_param.debug;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
199 vbrSetDefaults(&vf->priv->vbr_state);
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
200 vf->priv->vbr_state.fps = (double)enc_param.fbase / enc_param.fincr;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
201 if (xvidenc_param.stats_file)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
202 vf->priv->vbr_state.filename = xvidenc_param.stats_file;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
203 if (xvidenc_param.bitrate)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
204 vf->priv->vbr_state.desired_bitrate = xvidenc_param.bitrate;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
205 if (xvidenc_param.keyframe_boost)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
206 vf->priv->vbr_state.keyframe_boost = xvidenc_param.keyframe_boost;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
207 if (xvidenc_param.kfthreshold)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
208 vf->priv->vbr_state.kftreshold = xvidenc_param.kfthreshold;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
209 if (xvidenc_param.kfreduction)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
210 vf->priv->vbr_state.kfreduction = xvidenc_param.kfreduction;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
211 if (xvidenc_param.min_key_interval)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
212 vf->priv->vbr_state.min_key_interval = xvidenc_param.min_key_interval;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
213 if (xvidenc_param.max_key_interval)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
214 vf->priv->vbr_state.max_key_interval = xvidenc_param.max_key_interval;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
215 if (xvidenc_param.fixed_quant)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
216 vf->priv->vbr_state.fixed_quant = xvidenc_param.fixed_quant;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
217 switch (xvidenc_param.mode) {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
218 case XVID_MODE_CBR:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
219 vf->priv->vbr_state.mode = VBR_MODE_1PASS;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
220 break;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
221 case XVID_MODE_FIXED_QUANT:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
222 vf->priv->vbr_state.mode = VBR_MODE_FIXED_QUANT;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
223 break;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
224 case XVID_MODE_2PASS_1:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
225 vf->priv->vbr_state.mode = VBR_MODE_2PASS_1;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
226 break;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
227 case XVID_MODE_2PASS_2:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
228 vf->priv->vbr_state.mode = VBR_MODE_2PASS_2;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
229 break;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
230 default:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
231 abort();
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
232 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
233 vbrInit(&vf->priv->vbr_state);
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
234 return 1;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
235 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
236
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
237 static void
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
238 uninit(struct vf_instance_s* vf)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
239 {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
240 if (vf->priv->hintfile)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
241 fclose(vf->priv->hintfile);
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
242 vbrFinish(&vf->priv->vbr_state);
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
243 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
244
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
245 static int
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
246 control(struct vf_instance_s* vf, int request, void* data)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
247 {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
248 return CONTROL_UNKNOWN;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
249 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
250
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
251 static int
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
252 query_format(struct vf_instance_s* vf, unsigned int fmt)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
253 {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
254 switch(fmt){
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
255 case IMGFMT_YV12: case IMGFMT_IYUV: case IMGFMT_I420:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
256 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
257 case IMGFMT_YUY2: case IMGFMT_UYVY:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
258 return VFCAP_CSP_SUPPORTED;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
259 case IMGFMT_RGB24: case IMGFMT_BGR24:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
260 return VFCAP_CSP_SUPPORTED | VFCAP_FLIPPED;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
261 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
262 return 0;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
263 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
264
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
265 static int
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
266 put_image(struct vf_instance_s* vf, mp_image_t *mpi)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
267 {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
268 XVID_ENC_STATS enc_stats;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
269
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
270 vf->priv->enc_frame.bitstream = vf->priv->mux->buffer;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
271 vf->priv->enc_frame.length = -1 /* vf->priv->mux->buffer_size */;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
272 vf->priv->enc_frame.image = mpi->planes[0];
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
273 vf->priv->enc_frame.quant = vbrGetQuant(&vf->priv->vbr_state);
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
274 vf->priv->enc_frame.intra = vbrGetIntra(&vf->priv->vbr_state);
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
275 #if 0
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
276 if (xvidenc_param.mode == XVID_MODE_2PASS_1) {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
277 vf->priv->enc_frame.hint.hintstream = hintstream;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
278 vf->priv->enc_frame.hint.rawhints = 0;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
279 vf->priv->enc_frame.general |= XVID_HINTEDME_GET;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
280 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
281 else if (xvidenc_param.mode == XVID_MODE_2PASS_2) {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
282 FILE *f = get_hint_file(vf, "r");
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
283 vf->priv->enc_frame.general &= ~XVID_HINTEDME_SET;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
284 if (f) {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
285 int blocksize;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
286 int read;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
287 read = fread(&blocksize, sizeof(blocksize), 1, f);
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
288 if (read == 1) {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
289 read = fread(hintstream, blocksize, 1, f);
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
290 if (read == blocksize) {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
291 vf->priv->enc_frame.hint.hintstream = hintstream;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
292 vf->priv->enc_frame.hint.rawhints = 0;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
293 vf->priv->enc_frame.general |= XVID_HINTEDME_SET;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
294 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
295 else
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
296 perror("xvid: hint file read block failure");
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
297 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
298 else
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
299 perror("xvid: hint file read failure");
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
300 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
301 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
302 #endif
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
303 switch (xvid_encore(vf->priv->enc_handle, XVID_ENC_ENCODE, &vf->priv->enc_frame, &enc_stats)) {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
304 case XVID_ERR_OK:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
305 break;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
306 case XVID_ERR_MEMORY:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
307 mp_msg(MSGT_MENCODER, MSGL_ERR, "xvid: out of memory\n");
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
308 break;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
309 case XVID_ERR_FORMAT:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
310 mp_msg(MSGT_MENCODER, MSGL_ERR, "xvid: bad format\n");
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
311 break;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
312 default:
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
313 mp_msg(MSGT_MENCODER, MSGL_ERR, "xvid: failure\n");
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
314 break;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
315 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
316 mencoder_write_chunk(vf->priv->mux, vf->priv->enc_frame.length, vf->priv->enc_frame.intra ? 0x10 : 0);
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
317 vbrUpdate(&vf->priv->vbr_state, enc_stats.quant, vf->priv->enc_frame.intra,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
318 enc_stats.hlength, vf->priv->enc_frame.length, enc_stats.kblks, enc_stats.mblks, enc_stats.ublks);
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
319 #if 1
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
320 if (vf->priv->enc_frame.general & XVID_HINTEDME_GET) {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
321 FILE *f = get_hint_file(vf, "w");
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
322 if (f) {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
323 unsigned int wrote;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
324 wrote = fwrite(&vf->priv->enc_frame.hint.hintlength, sizeof(vf->priv->enc_frame.hint.hintlength), 1, f);
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
325 if (wrote == 1) {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
326 wrote = fwrite(&vf->priv->enc_frame.hint.hintstream, vf->priv->enc_frame.hint.hintlength, 1, f);
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
327 if (wrote != 1)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
328 perror("xvid: hint write block failure");
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
329 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
330 else
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
331 perror("xvid: hint write failure");
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
332 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
333 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
334 #endif
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
335 return 1;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
336 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
337
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
338 //===========================================================================//
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
339
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
340 static int
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
341 vf_open(vf_instance_t *vf, char* args)
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
342 {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
343 XVID_INIT_PARAM params = { 0, 0, 0};
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
344 vf->config = config;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
345 vf->control = control;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
346 vf->uninit = uninit;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
347 vf->query_format = query_format;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
348 vf->put_image = put_image;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
349 vf->priv = malloc(sizeof(struct vf_priv_s));
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
350 memset(vf->priv, 0, sizeof(struct vf_priv_s));
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
351 vf->priv->mux = (aviwrite_stream_t*)args;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
352
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
353 vf->priv->mux->bih = malloc(sizeof(BITMAPINFOHEADER));
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
354 vf->priv->mux->bih->biSize = sizeof(BITMAPINFOHEADER);
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
355 vf->priv->mux->bih->biWidth = 0;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
356 vf->priv->mux->bih->biHeight = 0;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
357 vf->priv->mux->bih->biPlanes = 1;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
358 vf->priv->mux->bih->biBitCount = 24;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
359 vf->priv->mux->bih->biCompression = mmioFOURCC('X','V','I','D');
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
360
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
361 if (xvid_init(NULL, 0, &params, NULL) != XVID_ERR_OK) {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
362 fprintf(stderr, "xvid: initialisation failure\n");
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
363 abort();
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
364 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
365 if (params.api_version != API_VERSION) {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
366 fprintf(stderr, "xvid: XviD library API version mismatch\n"
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
367 "\texpected %d.%d, got %d.%d, you should recompile MPlayer.\n",
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
368 API_VERSION >> 16, API_VERSION & 0xff,
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
369 params.api_version >> 16, params.api_version & 0xff);
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
370 abort();
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
371 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
372
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
373 return 1;
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
374 }
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
375
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
376 vf_info_t ve_info_xvid = {
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
377 "XviD encoder",
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
378 "xvid",
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
379 "Kim Minh Kaplan",
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
380 "for internal use by mencoder",
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
381 vf_open
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
382 };
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
383
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
384 //===========================================================================//
dacc262f41ba Support for XviD encoding
kmkaplan
parents:
diff changeset
385 #endif