annotate libmpcodecs/ve_xvid4.c @ 33815:4d75b3bf9561

Split out read/write part from data struct and make read-only struct const.
author reimar
date Sun, 24 Jul 2011 19:29:10 +0000
parents 84b3eebfd796
children 0967f7988a01
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26727
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
1 /*
26883
a365271c97a5 Revert commit r26897.
iive
parents: 26865
diff changeset
2 * - XviD 1.x decoder module for mplayer/mencoder -
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
3 *
26727
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
4 * Copyright(C) 2003 Marco Belli <elcabesa@inwind.it>
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
5 * 2003-2004 Edouard Gomez <ed.gomez@free.fr>
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
6 *
26727
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
7 * This file is part of MPlayer.
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
8 *
26727
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
9 * MPlayer is free software; you can redistribute it and/or modify
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
10 * it under the terms of the GNU General Public License as published by
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
12 * (at your option) any later version.
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
13 *
26727
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
14 * MPlayer is distributed in the hope that it will be useful,
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
17 * GNU General Public License for more details.
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
18 *
26727
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
19 * You should have received a copy of the GNU General Public License along
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
20 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
22 */
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
23
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
24 /*****************************************************************************
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
25 * Includes
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
26 ****************************************************************************/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
27
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
28 #include <stdio.h>
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
29 #include <stdlib.h>
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
30 #include <string.h>
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
31 #include <errno.h>
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
32 #include <math.h>
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
33 #include <limits.h>
11920
886e33d9dd10 psnr and debug option added
iive
parents: 11912
diff changeset
34 #include <time.h>
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
35
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16615
diff changeset
36 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16615
diff changeset
37 #include "mp_msg.h"
32064
a735105a66b6 Move all MEncoder-related extern variable declarations to mencoder.h.
diego
parents: 32033
diff changeset
38 #include "mencoder.h"
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
39 #include "codec-cfg.h"
22600
3c2b4a866c6a Add explicit location for headers from the stream/ directory.
diego
parents: 21660
diff changeset
40 #include "stream/stream.h"
22601
ed8f90096c65 Add explicit location for headers from the libmpdemux/ directory.
diego
parents: 22600
diff changeset
41 #include "libmpdemux/demuxer.h"
ed8f90096c65 Add explicit location for headers from the libmpdemux/ directory.
diego
parents: 22600
diff changeset
42 #include "libmpdemux/stheader.h"
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
43
22600
3c2b4a866c6a Add explicit location for headers from the stream/ directory.
diego
parents: 21660
diff changeset
44 #include "stream/stream.h"
22601
ed8f90096c65 Add explicit location for headers from the libmpdemux/ directory.
diego
parents: 22600
diff changeset
45 #include "libmpdemux/muxer.h"
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
46
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
47 #include "img_format.h"
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
48 #include "mp_image.h"
32479
a14d1a13a342 Support for -force-key-frames for ve_xvid4.
cigaes
parents: 32123
diff changeset
49 #include "ve.h"
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
50 #include "vf.h"
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
51
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
52 #include <xvid.h>
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
53 #include <stdio.h>
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
54 #include <stdarg.h>
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
55 #include <limits.h>
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
56 #include <assert.h>
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
57
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
58 #include "m_option.h"
33760
84b3eebfd796 ve_xvid: Add libavutil/rational.h #include for AVRational et al.
diego
parents: 32574
diff changeset
59 #include "libavutil/rational.h"
26069
1318e956c092 FFmpeg now uses different (unified) #include paths.
diego
parents: 25962
diff changeset
60 #include "libavutil/avutil.h"
24295
de8e36aec5ff Remove imported rational calculation code and use the original one from avutil.
iive
parents: 22601
diff changeset
61
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
62 #define FINE (!0)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
63 #define BAD (!FINE)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
64
15619
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
65 #define MAX_ZONES 64
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
66
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
67 // Profile flag definitions
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
68 #define PROFILE_ADAPTQUANT 0x00000001
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
69 #define PROFILE_BVOP 0x00000002
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
70 #define PROFILE_MPEGQUANT 0x00000004
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
71 #define PROFILE_INTERLACE 0x00000008
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
72 #define PROFILE_QPEL 0x00000010
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
73 #define PROFILE_GMC 0x00000020
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
74 #define PROFILE_4MV 0x00000040
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
75 #define PROFILE_DXN 0x00000080
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
76
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
77 // Reduce code duplication in profiles[] array
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
78 #define PROFILE_S (PROFILE_4MV)
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
79 #define PROFILE_AS (PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_MPEGQUANT|PROFILE_INTERLACE|PROFILE_QPEL|PROFILE_GMC)
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
80
24629
36c574ac1008 Define profiles_t as const to fix a warning. Prevent profiles[] from been exported.
iive
parents: 24295
diff changeset
81 typedef const struct
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
82 {
28186
79aef31ed618 XVID profile array should be const, so it is in rodata
reimar
parents: 26883
diff changeset
83 const char *name; ///< profile name
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
84 int id; ///< mpeg-4 profile id; iso/iec 14496-2:2001 table G-1
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
85 int width; ///< profile width restriction
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
86 int height; ///< profile height restriction
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
87 int fps; ///< profile frame rate restriction
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
88 int max_objects; ///< ??????
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
89 int total_vmv_buffer_sz; ///< macroblock memory; when BVOPS=false, vmv = 2*vcv; when BVOPS=true, vmv = 3*vcv
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
90 int max_vmv_buffer_sz; ///< max macroblocks per vop
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
91 int vcv_decoder_rate; ///< macroblocks decoded per second
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
92 int max_acpred_mbs; ///< percentage
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
93 int max_vbv_size; ///< max vbv size (bits) 16368 bits
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
94 int max_video_packet_length; ///< bits
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
95 int max_bitrate; ///< bits per second
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
96 int vbv_peakrate; ///< max bits over anyone second period; 0=don't care
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
97 int dxn_max_bframes; ///< dxn: max consecutive bframes
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
98 unsigned int flags; ///< flags for allowed options/dxn note the definitions for PROFILE_S and PROFILE_AS
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
99 } profile_t;
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
100
26883
a365271c97a5 Revert commit r26897.
iive
parents: 26865
diff changeset
101 // Code taken from XviD VfW source for profile support
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
102
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
103 /* default vbv_occupancy is (64/170)*vbv_buffer_size */
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
104
28186
79aef31ed618 XVID profile array should be const, so it is in rodata
reimar
parents: 26883
diff changeset
105 static const profile_t profiles[] =
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
106 {
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
107 /* name p@l w h fps obj Tvmv vmv vcv ac% vbv pkt bps vbv_peak dbf flags */
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
108 /* unrestricted profile (default) */
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
109 { "unrestricted", 0x00, 0, 0, 0, 0, 0, 0, 0, 100, 0*16368, -1, 0, 0, -1, 0xffffffff & ~PROFILE_DXN },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
110
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
111 { "sp0", 0x08, 176, 144, 15, 1, 198, 99, 1485, 100, 10*16368, 2048, 64000, 0, -1, PROFILE_S },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
112 /* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 */
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
113 /* if ac preidition is used, adaptive quantization must not be used */
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
114 /* <=qcif must be used */
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
115 { "sp1", 0x01, 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 2048, 64000, 0, -1, PROFILE_S|PROFILE_ADAPTQUANT },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
116 { "sp2", 0x02, 352, 288, 15, 4, 792, 396, 5940, 100, 40*16368, 4096, 128000, 0, -1, PROFILE_S|PROFILE_ADAPTQUANT },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
117 { "sp3", 0x03, 352, 288, 15, 4, 792, 396, 11880, 100, 40*16368, 8192, 384000, 0, -1, PROFILE_S|PROFILE_ADAPTQUANT },
31937
0b29d0c8c62d Add new Simple Profile Levels to the Xvid encoder.
cehoyos
parents: 30955
diff changeset
118 /* From ISO/IEC 14496-2:2004/FPDAM 2: New Levels for Simple Profile */
0b29d0c8c62d Add new Simple Profile Levels to the Xvid encoder.
cehoyos
parents: 30955
diff changeset
119 { "sp4a", 0x04, 640, 480, 30, 4, 2400, 1200, 36000, 100, 80*16368, 16384, 4000000, 0, -1, PROFILE_S|PROFILE_ADAPTQUANT },
0b29d0c8c62d Add new Simple Profile Levels to the Xvid encoder.
cehoyos
parents: 30955
diff changeset
120 { "sp5", 0x05, 720, 576, 30, 4, 3240, 1620, 40500, 100, 112*16368, 16384, 8000000, 0, -1, PROFILE_S|PROFILE_ADAPTQUANT },
0b29d0c8c62d Add new Simple Profile Levels to the Xvid encoder.
cehoyos
parents: 30955
diff changeset
121 /* From ISO/IEC 14496-2:2004/FPDAM 4: Simple profile level 6 */
0b29d0c8c62d Add new Simple Profile Levels to the Xvid encoder.
cehoyos
parents: 30955
diff changeset
122 { "sp6", 0x06, 1280, 720, 30, 4, 7200, 3600, 108000, 100, 248*16368, 16384,12000000, 0, -1, PROFILE_S|PROFILE_ADAPTQUANT },
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
123
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
124 { "asp0", 0xf0, 176, 144, 30, 1, 297, 99, 2970, 100, 10*16368, 2048, 128000, 0, -1, PROFILE_AS },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
125 { "asp1", 0xf1, 176, 144, 30, 4, 297, 99, 2970, 100, 10*16368, 2048, 128000, 0, -1, PROFILE_AS },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
126 { "asp2", 0xf2, 352, 288, 15, 4, 1188, 396, 5940, 100, 40*16368, 4096, 384000, 0, -1, PROFILE_AS },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
127 { "asp3", 0xf3, 352, 288, 30, 4, 1188, 396, 11880, 100, 40*16368, 4096, 768000, 0, -1, PROFILE_AS },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
128 /* ISMA Profile 1, (ASP) @ L3b (CIF, 1.5 Mb/s) CIF(352x288), 30fps, 1.5Mbps max ??? */
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
129 { "asp4", 0xf4, 352, 576, 30, 4, 2376, 792, 23760, 50, 80*16368, 8192, 3000000, 0, -1, PROFILE_AS },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
130 { "asp5", 0xf5, 720, 576, 30, 4, 4860, 1620, 48600, 25, 112*16368, 16384, 8000000, 0, -1, PROFILE_AS },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
131
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
132 // information provided by DivXNetworks, USA.
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
133 // "DivX Certified Profile Compatibility v1.1", February 2005
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
134 { "dxnhandheld", 0x00, 176, 144, 15, 1, 198, 99, 1485, 100, 32*8192, -1, 537600, 800000, 0, PROFILE_ADAPTQUANT|PROFILE_DXN },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
135 { "dxnportntsc", 0x00, 352, 240, 30, 1, 990, 330, 36000, 100, 384*8192, -1, 4854000, 8000000, 1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_DXN },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
136 { "dxnportpal", 0x00, 352, 288, 25, 1, 1188, 396, 36000, 100, 384*8192, -1, 4854000, 8000000, 1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_DXN },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
137 { "dxnhtntsc", 0x00, 720, 480, 30, 1, 4050, 1350, 40500, 100, 384*8192, -1, 4854000, 8000000, 1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE|PROFILE_DXN },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
138 { "dxnhtpal", 0x00, 720, 576, 25, 1, 4860, 1620, 40500, 100, 384*8192, -1, 4854000, 8000000, 1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE|PROFILE_DXN },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
139 { "dxnhdtv", 0x00, 1280, 720, 30, 1,10800, 3600, 108000, 100, 768*8192, -1, 9708400, 16000000, 2, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE|PROFILE_DXN },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
140
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
141 { NULL, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000000 },
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
142 };
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
143
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
144 /**
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
145 * \brief return the pointer to a chosen profile
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
146 * \param str the profile name
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
147 * \return pointer of the appropriate profiles array entry or NULL for a mistyped profile name
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
148 */
28186
79aef31ed618 XVID profile array should be const, so it is in rodata
reimar
parents: 26883
diff changeset
149 static const profile_t *profileFromName(const char *str)
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
150 {
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
151 profile_t *cur = profiles;
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
152 while (cur->name && strcasecmp(cur->name, str)) cur++;
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
153 if(!cur->name) return NULL;
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
154 return cur;
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
155 }
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
156
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
157 /*****************************************************************************
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
158 * Configuration options
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
159 ****************************************************************************/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
160
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
161 static int xvidenc_bitrate = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
162 static int xvidenc_pass = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
163 static float xvidenc_quantizer = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
164
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
165 static int xvidenc_packed = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
166 static int xvidenc_closed_gop = 1;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
167 static int xvidenc_interlaced = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
168 static int xvidenc_quarterpel = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
169 static int xvidenc_gmc = 0;
15070
bde4030f9134 Better defaults encoding settings for XviD, intended to be a good tradeoff CPU/PSNR.
gpoirier
parents: 14878
diff changeset
170 static int xvidenc_trellis = 1;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
171 static int xvidenc_cartoon = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
172 static int xvidenc_hqacpred = 1;
15070
bde4030f9134 Better defaults encoding settings for XviD, intended to be a good tradeoff CPU/PSNR.
gpoirier
parents: 14878
diff changeset
173 static int xvidenc_chromame = 1;
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
174 static int xvidenc_chroma_opt = 0;
15070
bde4030f9134 Better defaults encoding settings for XviD, intended to be a good tradeoff CPU/PSNR.
gpoirier
parents: 14878
diff changeset
175 static int xvidenc_vhq = 1;
bde4030f9134 Better defaults encoding settings for XviD, intended to be a good tradeoff CPU/PSNR.
gpoirier
parents: 14878
diff changeset
176 static int xvidenc_bvhq = 1;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
177 static int xvidenc_motion = 6;
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
178 static int xvidenc_turbo = 0;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
179 static int xvidenc_stats = 0;
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
180 static int xvidenc_max_key_interval = 0; /* Let xvidcore set a 10s interval by default */
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
181 static int xvidenc_frame_drop_ratio = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
182 static int xvidenc_greyscale = 0;
15638
189da3c3116b Add XviD's luminance masking (option name: lumi_mask)
gpoirier
parents: 15619
diff changeset
183 static int xvidenc_luminance_masking = 0;
11920
886e33d9dd10 psnr and debug option added
iive
parents: 11912
diff changeset
184 static int xvidenc_debug = 0;
886e33d9dd10 psnr and debug option added
iive
parents: 11912
diff changeset
185 static int xvidenc_psnr = 0;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
186
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
187 static int xvidenc_max_bframes = 2;
17703
2b5c0730598d XviD multi-threaded encoding support
gpoirier
parents: 17659
diff changeset
188 static int xvidenc_num_threads = 0;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
189 static int xvidenc_bquant_ratio = 150;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
190 static int xvidenc_bquant_offset = 100;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
191 static int xvidenc_bframe_threshold = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
192
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
193 static int xvidenc_min_quant[3] = {2, 2, 2};
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
194 static int xvidenc_max_quant[3] = {31, 31, 31};
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
195 static char *xvidenc_intra_matrix_file = NULL;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
196 static char *xvidenc_inter_matrix_file = NULL;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
197 static char *xvidenc_quant_method = NULL;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
198
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
199 static int xvidenc_cbr_reaction_delay_factor = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
200 static int xvidenc_cbr_averaging_period = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
201 static int xvidenc_cbr_buffer = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
202
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
203 static int xvidenc_vbr_keyframe_boost = 0;
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
204 static int xvidenc_vbr_overflow_control_strength = 5;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
205 static int xvidenc_vbr_curve_compression_high = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
206 static int xvidenc_vbr_curve_compression_low = 0;
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
207 static int xvidenc_vbr_max_overflow_improvement = 5;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
208 static int xvidenc_vbr_max_overflow_degradation = 5;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
209 static int xvidenc_vbr_kfreduction = 0;
11586
efe910b068fc xvid 1.0 beta2
iive
parents: 11491
diff changeset
210 static int xvidenc_vbr_kfthreshold = 0;
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
211 static int xvidenc_vbr_container_frame_overhead = 24; /* mencoder uses AVI container */
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
212
32574
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
213 static int xvidenc_vbv_size = 0;
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
214 static int xvidenc_vbv_initial = 0;
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
215 static int xvidenc_vbv_maxrate = 0;
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
216
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
217 // commandline profile option string - default to unrestricted
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
218 static char *xvidenc_profile = "unrestricted";
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
219
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
220 static char *xvidenc_par = NULL;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
221 static int xvidenc_par_width = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
222 static int xvidenc_par_height = 0;
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
223 static float xvidenc_dar_aspect = 0.0f;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
224 static int xvidenc_autoaspect = 0;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
225
15619
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
226 static char *xvidenc_zones = NULL; // zones string
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
227
30955
4e59a7aebadb Mark encoder-related m_option_t struct arrays as const.
diego
parents: 30642
diff changeset
228 const m_option_t xvidencopts_conf[] =
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
229 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
230 /* Standard things mencoder should be able to treat directly */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
231 {"bitrate", &xvidenc_bitrate, CONF_TYPE_INT, 0, 0, 0, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
232 {"pass", &xvidenc_pass, CONF_TYPE_INT, CONF_RANGE, 1, 2, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
233 {"fixed_quant", &xvidenc_quantizer, CONF_TYPE_FLOAT, CONF_RANGE, 1, 31, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
234
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
235 /* Features */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
236 {"quant_type", &xvidenc_quant_method, CONF_TYPE_STRING, 0, 0, 0, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
237 {"me_quality", &xvidenc_motion, CONF_TYPE_INT, CONF_RANGE, 0, 6, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
238 {"chroma_me", &xvidenc_chromame, CONF_TYPE_FLAG, 0, 0, 1, NULL},
13853
5a786c7e4df4 have each XviD's option flag have its (no)counterpart
gpoirier
parents: 13675
diff changeset
239 {"nochroma_me", &xvidenc_chromame, CONF_TYPE_FLAG, 0, 1, 0, NULL},
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
240 {"chroma_opt", &xvidenc_chroma_opt, CONF_TYPE_FLAG, 0, 0, 1, NULL},
13853
5a786c7e4df4 have each XviD's option flag have its (no)counterpart
gpoirier
parents: 13675
diff changeset
241 {"nochroma_opt", &xvidenc_chroma_opt, CONF_TYPE_FLAG, 0, 1, 0, NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
242 {"vhq", &xvidenc_vhq, CONF_TYPE_INT, CONF_RANGE, 0, 4, NULL},
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
243 {"bvhq", &xvidenc_bvhq, CONF_TYPE_INT, CONF_RANGE, 0, 1, NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
244 {"max_bframes", &xvidenc_max_bframes, CONF_TYPE_INT, CONF_RANGE, 0, 20, NULL},
17703
2b5c0730598d XviD multi-threaded encoding support
gpoirier
parents: 17659
diff changeset
245 {"threads", &xvidenc_num_threads, CONF_TYPE_INT, 0, 0, 0, NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
246 {"bquant_ratio", &xvidenc_bquant_ratio, CONF_TYPE_INT, CONF_RANGE, 0, 200, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
247 {"bquant_offset", &xvidenc_bquant_offset, CONF_TYPE_INT, CONF_RANGE, 0, 200, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
248 {"bf_threshold", &xvidenc_bframe_threshold, CONF_TYPE_INT, CONF_RANGE, -255, 255, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
249 {"qpel", &xvidenc_quarterpel, CONF_TYPE_FLAG, 0, 0, 1, NULL},
13853
5a786c7e4df4 have each XviD's option flag have its (no)counterpart
gpoirier
parents: 13675
diff changeset
250 {"noqpel", &xvidenc_quarterpel, CONF_TYPE_FLAG, 0, 1, 0, NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
251 {"gmc", &xvidenc_gmc, CONF_TYPE_FLAG, 0, 0, 1, NULL},
13853
5a786c7e4df4 have each XviD's option flag have its (no)counterpart
gpoirier
parents: 13675
diff changeset
252 {"nogmc", &xvidenc_gmc, CONF_TYPE_FLAG, 0, 1, 0, NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
253 {"trellis", &xvidenc_trellis, CONF_TYPE_FLAG, 0, 0, 1, NULL},
13853
5a786c7e4df4 have each XviD's option flag have its (no)counterpart
gpoirier
parents: 13675
diff changeset
254 {"notrellis", &xvidenc_trellis, CONF_TYPE_FLAG, 0, 1, 0, NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
255 {"packed", &xvidenc_packed, CONF_TYPE_FLAG, 0, 0, 1, NULL},
13853
5a786c7e4df4 have each XviD's option flag have its (no)counterpart
gpoirier
parents: 13675
diff changeset
256 {"nopacked", &xvidenc_packed, CONF_TYPE_FLAG, 0, 1, 0, NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
257 {"closed_gop", &xvidenc_closed_gop, CONF_TYPE_FLAG, 0, 0, 1, NULL},
13853
5a786c7e4df4 have each XviD's option flag have its (no)counterpart
gpoirier
parents: 13675
diff changeset
258 {"noclosed_gop", &xvidenc_closed_gop, CONF_TYPE_FLAG, 0, 1, 0, NULL},
11491
5af505348795 use the old names for 4 options
iive
parents: 11437
diff changeset
259 {"interlacing", &xvidenc_interlaced, CONF_TYPE_FLAG, 0, 0, 1, NULL},
13853
5a786c7e4df4 have each XviD's option flag have its (no)counterpart
gpoirier
parents: 13675
diff changeset
260 {"nointerlacing", &xvidenc_interlaced, CONF_TYPE_FLAG, 0, 1, 0, NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
261 {"cartoon", &xvidenc_cartoon, CONF_TYPE_FLAG, 0, 0, 1, NULL},
13853
5a786c7e4df4 have each XviD's option flag have its (no)counterpart
gpoirier
parents: 13675
diff changeset
262 {"nocartoon", &xvidenc_cartoon, CONF_TYPE_FLAG, 0, 1, 0, NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
263 {"hq_ac", &xvidenc_hqacpred, CONF_TYPE_FLAG, 0, 0, 1, NULL},
13853
5a786c7e4df4 have each XviD's option flag have its (no)counterpart
gpoirier
parents: 13675
diff changeset
264 {"nohq_ac", &xvidenc_hqacpred, CONF_TYPE_FLAG, 0, 1, 0, NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
265 {"frame_drop_ratio", &xvidenc_frame_drop_ratio, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
266 {"max_key_interval", &xvidenc_max_key_interval, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
20259
135e5919638f Use American spelling of "gray" instead for British's "grey" for XviD option, while keeping backward compatibility
gpoirier
parents: 20017
diff changeset
267 {"greyscale", &xvidenc_greyscale, CONF_TYPE_FLAG, 0, 0, 1, NULL}, /* kept for backward compatibility */
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
268 {"grayscale", &xvidenc_greyscale, CONF_TYPE_FLAG, 0, 0, 1, NULL},
13853
5a786c7e4df4 have each XviD's option flag have its (no)counterpart
gpoirier
parents: 13675
diff changeset
269 {"nogreyscale", &xvidenc_greyscale, CONF_TYPE_FLAG, 0, 1, 0, NULL},
15638
189da3c3116b Add XviD's luminance masking (option name: lumi_mask)
gpoirier
parents: 15619
diff changeset
270 {"lumi_mask", &xvidenc_luminance_masking, CONF_TYPE_FLAG, 0, 0, 1, NULL},
189da3c3116b Add XviD's luminance masking (option name: lumi_mask)
gpoirier
parents: 15619
diff changeset
271 {"nolumi_mask", &xvidenc_luminance_masking, CONF_TYPE_FLAG, 0, 1, 0, NULL},
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
272 {"turbo", &xvidenc_turbo, CONF_TYPE_FLAG, 0, 0, 1, NULL},
11920
886e33d9dd10 psnr and debug option added
iive
parents: 11912
diff changeset
273 {"debug", &xvidenc_debug, CONF_TYPE_INT , 0 ,0,-1,NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
274 {"stats", &xvidenc_stats, CONF_TYPE_FLAG, 0, 0, 1, NULL},
11920
886e33d9dd10 psnr and debug option added
iive
parents: 11912
diff changeset
275 {"psnr", &xvidenc_psnr , CONF_TYPE_FLAG, 0, 0, 1, NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
276
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
277
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
278 /* section [quantizer] */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
279 {"min_iquant", &xvidenc_min_quant[0], CONF_TYPE_INT, CONF_RANGE, 1, 31, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
280 {"max_iquant", &xvidenc_max_quant[0], CONF_TYPE_INT, CONF_RANGE, 1, 31, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
281 {"min_pquant", &xvidenc_min_quant[1], CONF_TYPE_INT, CONF_RANGE, 1, 31, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
282 {"max_pquant", &xvidenc_max_quant[1], CONF_TYPE_INT, CONF_RANGE, 1, 31, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
283 {"min_bquant", &xvidenc_min_quant[2], CONF_TYPE_INT, CONF_RANGE, 1, 31, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
284 {"max_bquant", &xvidenc_max_quant[2], CONF_TYPE_INT, CONF_RANGE, 1, 31, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
285 {"quant_intra_matrix", &xvidenc_intra_matrix_file, CONF_TYPE_STRING, 0, 0, 100, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
286 {"quant_inter_matrix", &xvidenc_inter_matrix_file, CONF_TYPE_STRING, 0, 0, 100, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
287
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
288 /* section [cbr] */
11491
5af505348795 use the old names for 4 options
iive
parents: 11437
diff changeset
289 {"rc_reaction_delay_factor", &xvidenc_cbr_reaction_delay_factor, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
5af505348795 use the old names for 4 options
iive
parents: 11437
diff changeset
290 {"rc_averaging_period", &xvidenc_cbr_averaging_period, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
5af505348795 use the old names for 4 options
iive
parents: 11437
diff changeset
291 {"rc_buffer", &xvidenc_cbr_buffer, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
292
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
293 /* section [vbr] */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
294 {"keyframe_boost", &xvidenc_vbr_keyframe_boost, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
295 {"curve_compression_high", &xvidenc_vbr_curve_compression_high, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
296 {"curve_compression_low", &xvidenc_vbr_curve_compression_low, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
297 {"overflow_control_strength", &xvidenc_vbr_overflow_control_strength, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
298 {"max_overflow_improvement", &xvidenc_vbr_max_overflow_improvement, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
299 {"max_overflow_degradation", &xvidenc_vbr_max_overflow_degradation, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
300 {"kfreduction", &xvidenc_vbr_kfreduction, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
11586
efe910b068fc xvid 1.0 beta2
iive
parents: 11491
diff changeset
301 {"kfthreshold", &xvidenc_vbr_kfthreshold, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
302 {"container_frame_overhead", &xvidenc_vbr_container_frame_overhead, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
303
32574
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
304 /* section [vbv] */
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
305 {"vbv_bufsize", &xvidenc_vbv_size, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
306 {"vbv_initial", &xvidenc_vbv_initial, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
307 {"vbv_maxrate", &xvidenc_vbv_maxrate, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
308
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
309 /* Section Aspect Ratio */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
310 {"par", &xvidenc_par, CONF_TYPE_STRING, 0, 0, 0, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
311 {"par_width", &xvidenc_par_width, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL},
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
312 {"par_height", &xvidenc_par_height, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL},
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
313 {"aspect", &xvidenc_dar_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.1, 9.99, NULL},
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
314 {"autoaspect", &xvidenc_autoaspect, CONF_TYPE_FLAG, 0, 0, 1, NULL},
13853
5a786c7e4df4 have each XviD's option flag have its (no)counterpart
gpoirier
parents: 13675
diff changeset
315 {"noautoaspect", &xvidenc_autoaspect, CONF_TYPE_FLAG, 0, 1, 0, NULL},
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
316
15619
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
317 /* Section Zones */
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
318 {"zones", &xvidenc_zones, CONF_TYPE_STRING, 0, 0, 0, NULL},
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
319
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
320 /* section profiles */
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
321 {"profile", &xvidenc_profile, CONF_TYPE_STRING, 0, 0, 0, NULL},
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
322
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
323 /* End of the config array */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
324 {NULL, 0, 0, 0, 0, 0, NULL}
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
325 };
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
326
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
327 /*****************************************************************************
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
328 * Module private data
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
329 ****************************************************************************/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
330
25607
9d0b189ce1b2 Fix illegal identifiers: Names starting with __ or _ and uppercase are reserved
diego
parents: 24735
diff changeset
331 typedef struct xvid_mplayer_module_t
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
332 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
333 /* Instance related global vars */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
334 void *instance;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
335 xvid_gbl_init_t init;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
336 xvid_enc_create_t create;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
337 xvid_enc_frame_t frame;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
338 xvid_plugin_single_t onepass;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
339 xvid_plugin_2pass1_t pass1;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
340 xvid_plugin_2pass2_t pass2;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
341
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
342 /* This data must survive local block scope, so here it is */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
343 xvid_enc_plugin_t plugins[7];
15619
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
344 xvid_enc_zone_t zones[MAX_ZONES];
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
345
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
346 /* MPEG4 stream buffer */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
347 muxer_stream_t *mux;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
348
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
349 /* Stats accumulators */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
350 int frames;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
351 long long sse_y;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
352 long long sse_u;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
353 long long sse_v;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
354
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
355 /* Min & Max PSNR */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
356 int min_sse_y;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
357 int min_sse_u;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
358 int min_sse_v;
11920
886e33d9dd10 psnr and debug option added
iive
parents: 11912
diff changeset
359 int min_framenum;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
360 int max_sse_y;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
361 int max_sse_u;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
362 int max_sse_v;
11920
886e33d9dd10 psnr and debug option added
iive
parents: 11912
diff changeset
363 int max_framenum;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
364
11920
886e33d9dd10 psnr and debug option added
iive
parents: 11912
diff changeset
365 int pixels;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
366
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
367 /* DAR/PAR and all that thingies */
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
368 int d_width;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
369 int d_height;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
370 FILE *fvstats;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
371 } xvid_mplayer_module_t;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
372
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
373 static int dispatch_settings(xvid_mplayer_module_t *mod);
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
374 static int set_create_struct(xvid_mplayer_module_t *mod);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
375 static int set_frame_struct(xvid_mplayer_module_t *mod, mp_image_t *mpi);
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
376 static void update_stats(xvid_mplayer_module_t *mod, xvid_enc_stats_t *stats);
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
377 static void print_stats(xvid_mplayer_module_t *mod);
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
378 static void flush_internal_buffers(xvid_mplayer_module_t *mod);
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
379 static const char *par_string(int parcode);
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
380 static const char *errorstring(int err);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
381
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
382 /*****************************************************************************
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
383 * Video Filter API function definitions
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
384 ****************************************************************************/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
385
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
386 /*============================================================================
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
387 * config
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
388 *==========================================================================*/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
389
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
390 static int
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 29263
diff changeset
391 config(struct vf_instance *vf,
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
392 int width, int height, int d_width, int d_height,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
393 unsigned int flags, unsigned int outfmt)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
394 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
395 int err;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
396 xvid_mplayer_module_t *mod = (xvid_mplayer_module_t *)vf->priv;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
397
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
398 /* Complete the muxer initialization */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
399 mod->mux->bih->biWidth = width;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
400 mod->mux->bih->biHeight = height;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
401 mod->mux->bih->biSizeImage =
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
402 mod->mux->bih->biWidth * mod->mux->bih->biHeight * 3 / 2;
12061
656a1b45b309 Use aspect from encoder for AVI vprp header
ranma
parents: 11929
diff changeset
403 mod->mux->aspect = (float)d_width/d_height;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
404
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
405 /* Message the FourCC type */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
406 mp_msg(MSGT_MENCODER, MSGL_INFO,
26883
a365271c97a5 Revert commit r26897.
iive
parents: 26865
diff changeset
407 "videocodec: XviD (%dx%d fourcc=%x [%.4s])\n",
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
408 width, height, mod->mux->bih->biCompression,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
409 (char *)&mod->mux->bih->biCompression);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
410
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
411 /* Total number of pixels per frame required for PSNR */
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
412 mod->pixels = mod->mux->bih->biWidth*mod->mux->bih->biHeight;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
413
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
414 /*--------------------------------------------------------------------
26883
a365271c97a5 Revert commit r26897.
iive
parents: 26865
diff changeset
415 * Dispatch all module settings to XviD structures
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
416 *------------------------------------------------------------------*/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
417
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
418 mod->d_width = d_width;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
419 mod->d_height = d_height;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
420
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
421 if(dispatch_settings(mod) == BAD)
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
422 return BAD;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
423
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
424 /*--------------------------------------------------------------------
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
425 * Set remaining information in the xvid_enc_create_t structure
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
426 *------------------------------------------------------------------*/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
427
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
428 if(set_create_struct(mod) == BAD)
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
429 return BAD;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
430
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
431 /*--------------------------------------------------------------------
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
432 * Encoder instance creation
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
433 *------------------------------------------------------------------*/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
434
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
435 err = xvid_encore(NULL, XVID_ENC_CREATE, &mod->create, NULL);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
436
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
437 if(err<0) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
438 mp_msg(MSGT_MENCODER, MSGL_ERR,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
439 "xvid: xvidcore returned a '%s' error\n", errorstring(err));
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
440 return BAD;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
441 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
442
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
443 /* Store the encoder instance into the private data */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
444 mod->instance = mod->create.handle;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
445
17659
92ac78a93625 Fix video delay when encoding with B-frames.
corey
parents: 17487
diff changeset
446 mod->mux->decoder_delay = mod->create.max_bframes ? 1 : 0;
92ac78a93625 Fix video delay when encoding with B-frames.
corey
parents: 17487
diff changeset
447
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
448 return FINE;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
449 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
450
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
451 /*============================================================================
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
452 * uninit
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
453 *==========================================================================*/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
454
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
455 static void
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 29263
diff changeset
456 uninit(struct vf_instance *vf)
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
457 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
458
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
459 xvid_mplayer_module_t *mod = (xvid_mplayer_module_t *)vf->priv;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
460
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
461 /* Destroy xvid instance */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
462 xvid_encore(mod->instance, XVID_ENC_DESTROY, NULL, NULL);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
463
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
464 /* Display stats (if any) */
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
465 print_stats(mod);
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
466
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
467 /* Close PSNR file if ever opened */
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
468 if (mod->fvstats) {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
469 fclose(mod->fvstats);
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
470 mod->fvstats = NULL;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
471 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
472
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
473 /* Free allocated memory */
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 32479
diff changeset
474 free(mod->frame.quant_intra_matrix);
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 32479
diff changeset
475 free(mod->frame.quant_inter_matrix);
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 32479
diff changeset
476 free(mod->mux->bih);
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
477 free(vf->priv);
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
478 vf->priv=NULL;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
479
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
480 return;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
481 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
482
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
483 /*============================================================================
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
484 * control
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
485 *==========================================================================*/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
486
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
487 static int
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 29263
diff changeset
488 control(struct vf_instance *vf, int request, void* data)
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
489 {
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
490 xvid_mplayer_module_t *mod = (xvid_mplayer_module_t *)vf->priv;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
491
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
492 switch(request){
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
493 case VFCTRL_FLUSH_FRAMES:
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
494 if(mod)/*paranoid*/
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
495 flush_internal_buffers(mod);
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
496 break;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
497 }
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
498 return CONTROL_UNKNOWN;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
499 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
500
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
501 /*============================================================================
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
502 * query_format
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
503 *==========================================================================*/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
504
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
505 static int
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 29263
diff changeset
506 query_format(struct vf_instance *vf, unsigned int fmt)
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
507 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
508 switch(fmt){
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
509 case IMGFMT_YV12:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
510 case IMGFMT_IYUV:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
511 case IMGFMT_I420:
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
512 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
513 case IMGFMT_YUY2:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
514 case IMGFMT_UYVY:
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
515 return VFCAP_CSP_SUPPORTED;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
516 }
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
517 return BAD;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
518 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
519
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
520 /*============================================================================
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
521 * put_image
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
522 *==========================================================================*/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
523
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
524 static int
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 29263
diff changeset
525 put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
526 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
527 int size;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
528 xvid_enc_stats_t stats;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
529 xvid_mplayer_module_t *mod = (xvid_mplayer_module_t *)vf->priv;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
530
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
531 /* Prepare the stats */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
532 memset(&stats,0,sizeof( xvid_enc_stats_t));
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
533 stats.version = XVID_VERSION;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
534
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
535 /* -------------------------------------------------------------------
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
536 * Set remaining information in the xvid_enc_frame_t structure
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
537 * NB: all the other struct members were initialized by
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
538 * dispatch_settings
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
539 * -----------------------------------------------------------------*/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
540
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
541 if(set_frame_struct(mod, mpi) == BAD)
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
542 return BAD;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
543
32479
a14d1a13a342 Support for -force-key-frames for ve_xvid4.
cigaes
parents: 32123
diff changeset
544 mod->frame.type = is_forced_key_frame(pts) || xvidenc_motion == 0 ?
a14d1a13a342 Support for -force-key-frames for ve_xvid4.
cigaes
parents: 32123
diff changeset
545 XVID_TYPE_IVOP : XVID_TYPE_AUTO;
a14d1a13a342 Support for -force-key-frames for ve_xvid4.
cigaes
parents: 32123
diff changeset
546
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
547 /* -------------------------------------------------------------------
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
548 * Encode the frame
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
549 * ---------------------------------------------------------------- */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
550
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
551 size = xvid_encore(mod->instance, XVID_ENC_ENCODE, &mod->frame, &stats);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
552
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
553 /* Analyse the returned value */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
554 if(size<0) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
555 mp_msg(MSGT_MENCODER, MSGL_ERR,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
556 "xvid: xvidcore returned a '%s' error\n", errorstring(size));
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
557 return BAD;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
558 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
559
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
560 /* If size is == 0, we're done with that frame */
17659
92ac78a93625 Fix video delay when encoding with B-frames.
corey
parents: 17487
diff changeset
561 if(size == 0) {
92ac78a93625 Fix video delay when encoding with B-frames.
corey
parents: 17487
diff changeset
562 ++mod->mux->encoder_delay;
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
563 return FINE;
17659
92ac78a93625 Fix video delay when encoding with B-frames.
corey
parents: 17487
diff changeset
564 }
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
565
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
566 /* xvidcore returns stats about encoded frame in an asynchronous way
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
567 * accumulate these stats */
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
568 update_stats(mod, &stats);
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
569
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
570 /* xvidcore outputed bitstream -- mux it */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
571 muxer_write_chunk(mod->mux,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
572 size,
17487
fa17424b4c7b change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents: 17012
diff changeset
573 (mod->frame.out_flags & XVID_KEYFRAME)?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
574
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
575 return FINE;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
576 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
577
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
578 /*============================================================================
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
579 * vf_open
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
580 *==========================================================================*/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
581
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
582 static int
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
583 vf_open(vf_instance_t *vf, char* args)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
584 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
585 xvid_mplayer_module_t *mod;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
586 xvid_gbl_init_t xvid_gbl_init;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
587 xvid_gbl_info_t xvid_gbl_info;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
588
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
589 /* Setting libmpcodec module API pointers */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
590 vf->config = config;
14878
5723c4b2a2ea fixes for encoding of multiple files
henry
parents: 14549
diff changeset
591 vf->default_caps = VFCAP_CONSTANT;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
592 vf->control = control;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
593 vf->uninit = uninit;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
594 vf->query_format = query_format;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
595 vf->put_image = put_image;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
596
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
597 /* Allocate the private part of the codec module */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
598 vf->priv = malloc(sizeof(xvid_mplayer_module_t));
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
599 mod = (xvid_mplayer_module_t*)vf->priv;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
600
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
601 if(mod == NULL) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
602 mp_msg(MSGT_MENCODER,MSGL_ERR,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
603 "xvid: memory allocation failure (private data)\n");
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
604 return BAD;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
605 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
606
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
607 /* Initialize the module to zeros */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
608 memset(mod, 0, sizeof(xvid_mplayer_module_t));
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
609 mod->min_sse_y = mod->min_sse_u = mod->min_sse_v = INT_MAX;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
610 mod->max_sse_y = mod->max_sse_u = mod->max_sse_v = INT_MIN;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
611
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
612 /* Bind the Muxer */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
613 mod->mux = (muxer_stream_t*)args;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
614
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
615 /* Initialize muxer BITMAP header */
32123
a86413775fbe Replace sizeof(BITMAPINFOHEADER)
reimar
parents: 32064
diff changeset
616 mod->mux->bih = calloc(1, sizeof(*mod->mux->bih));
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
617
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
618 if(mod->mux->bih == NULL) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
619 mp_msg(MSGT_MENCODER,MSGL_ERR,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
620 "xvid: memory allocation failure (BITMAP header)\n");
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
621 return BAD;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
622 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
623
32123
a86413775fbe Replace sizeof(BITMAPINFOHEADER)
reimar
parents: 32064
diff changeset
624 mod->mux->bih->biSize = sizeof(*mod->mux->bih);
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
625 mod->mux->bih->biWidth = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
626 mod->mux->bih->biHeight = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
627 mod->mux->bih->biPlanes = 1;
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
628 mod->mux->bih->biBitCount = 12;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
629 mod->mux->bih->biCompression = mmioFOURCC('X','V','I','D');
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
630
26883
a365271c97a5 Revert commit r26897.
iive
parents: 26865
diff changeset
631 /* Retrieve information about the host XviD library */
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
632 memset(&xvid_gbl_info, 0, sizeof(xvid_gbl_info_t));
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
633 xvid_gbl_info.version = XVID_VERSION;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
634
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
635 if (xvid_global(NULL, XVID_GBL_INFO, &xvid_gbl_info, NULL) < 0) {
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
636 mp_msg(MSGT_MENCODER,MSGL_WARN, "xvid: could not get information about the library\n");
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
637 } else {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
638 mp_msg(MSGT_MENCODER,MSGL_INFO, "xvid: using library version %d.%d.%d (build %s)\n",
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
639 XVID_VERSION_MAJOR(xvid_gbl_info.actual_version),
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
640 XVID_VERSION_MINOR(xvid_gbl_info.actual_version),
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
641 XVID_VERSION_PATCH(xvid_gbl_info.actual_version),
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
642 xvid_gbl_info.build);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
643 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
644
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
645 /* Initialize the xvid_gbl_init structure */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
646 memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init_t));
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
647 xvid_gbl_init.version = XVID_VERSION;
11920
886e33d9dd10 psnr and debug option added
iive
parents: 11912
diff changeset
648 xvid_gbl_init.debug = xvidenc_debug;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
649
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
650 /* Initialize the xvidcore library */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
651 if (xvid_global(NULL, XVID_GBL_INIT, &xvid_gbl_init, NULL) < 0) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
652 mp_msg(MSGT_MENCODER,MSGL_ERR, "xvid: initialisation failure\n");
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
653 return BAD;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
654 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
655
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
656 return FINE;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
657 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
658
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
659 /*****************************************************************************
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
660 * Helper functions
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
661 ****************************************************************************/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
662
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
663 static void *read_matrix(unsigned char *filename);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
664
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
665 static int dispatch_settings(xvid_mplayer_module_t *mod)
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
666 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
667 xvid_enc_create_t *create = &mod->create;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
668 xvid_enc_frame_t *frame = &mod->frame;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
669 xvid_plugin_single_t *onepass = &mod->onepass;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
670 xvid_plugin_2pass2_t *pass2 = &mod->pass2;
24295
de8e36aec5ff Remove imported rational calculation code and use the original one from avutil.
iive
parents: 22601
diff changeset
671 AVRational ar;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
672
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
673 const int motion_presets[7] =
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
674 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
675 0,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
676 0,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
677 0,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
678 0,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
679 XVID_ME_HALFPELREFINE16,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
680 XVID_ME_HALFPELREFINE16 | XVID_ME_ADVANCEDDIAMOND16,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
681 XVID_ME_HALFPELREFINE16 | XVID_ME_EXTSEARCH16 |
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
682 XVID_ME_HALFPELREFINE8 | XVID_ME_USESQUARES16
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
683 };
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
684
16615
aede77b9e276 code before decleration, gcc2.95 fix
ods15
parents: 16602
diff changeset
685 //profile is unrestricted as default
28186
79aef31ed618 XVID profile array should be const, so it is in rodata
reimar
parents: 26883
diff changeset
686 const profile_t *selected_profile = profileFromName("unrestricted");
16615
aede77b9e276 code before decleration, gcc2.95 fix
ods15
parents: 16602
diff changeset
687 if(xvidenc_profile)
aede77b9e276 code before decleration, gcc2.95 fix
ods15
parents: 16602
diff changeset
688 selected_profile = profileFromName(xvidenc_profile);
aede77b9e276 code before decleration, gcc2.95 fix
ods15
parents: 16602
diff changeset
689 if(!selected_profile)
aede77b9e276 code before decleration, gcc2.95 fix
ods15
parents: 16602
diff changeset
690 {
aede77b9e276 code before decleration, gcc2.95 fix
ods15
parents: 16602
diff changeset
691 mp_msg(MSGT_MENCODER,MSGL_ERR,
aede77b9e276 code before decleration, gcc2.95 fix
ods15
parents: 16602
diff changeset
692 "xvid:[ERROR] \"%s\" is an invalid profile name\n", xvidenc_profile);
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
693 return BAD;
16615
aede77b9e276 code before decleration, gcc2.95 fix
ods15
parents: 16602
diff changeset
694 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
695
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
696 /* -------------------------------------------------------------------
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
697 * Dispatch all settings having an impact on the "create" structure
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
698 * This includes plugins as they are passed to encore through the
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
699 * create structure
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
700 * -----------------------------------------------------------------*/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
701
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
702 /* -------------------------------------------------------------------
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
703 * The create structure
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
704 * ---------------------------------------------------------------- */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
705
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
706 create->global = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
707
11920
886e33d9dd10 psnr and debug option added
iive
parents: 11912
diff changeset
708 if(xvidenc_psnr)
886e33d9dd10 psnr and debug option added
iive
parents: 11912
diff changeset
709 xvidenc_stats = 1;
886e33d9dd10 psnr and debug option added
iive
parents: 11912
diff changeset
710
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
711 if(xvidenc_stats)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
712 create->global |= XVID_GLOBAL_EXTRASTATS_ENABLE;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
713
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
714 create->num_zones = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
715 create->zones = NULL;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
716 create->num_plugins = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
717 create->plugins = NULL;
17703
2b5c0730598d XviD multi-threaded encoding support
gpoirier
parents: 17659
diff changeset
718 create->num_threads = xvidenc_num_threads;
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
719
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
720 if( (selected_profile->flags & PROFILE_BVOP) &&
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
721 /* dxn: prevent bframes usage if interlacing is selected */
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
722 !((selected_profile->flags & PROFILE_DXN) && xvidenc_interlaced) )
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
723 {
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
724 create->max_bframes = xvidenc_max_bframes;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
725 create->bquant_ratio = xvidenc_bquant_ratio;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
726 create->bquant_offset = xvidenc_bquant_offset;
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
727 if(xvidenc_packed)
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
728 create->global |= XVID_GLOBAL_PACKED;
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
729 if(xvidenc_closed_gop)
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
730 create->global |= XVID_GLOBAL_CLOSED_GOP;
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
731
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
732 /* dxn: restrict max bframes, require closed gop
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
733 and require packed b-frames */
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
734 if(selected_profile->flags & PROFILE_DXN)
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
735 {
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
736 if(create->max_bframes > selected_profile->dxn_max_bframes)
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
737 create->max_bframes = selected_profile->dxn_max_bframes;
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
738 create->global |= XVID_GLOBAL_CLOSED_GOP;
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
739 create->global |= XVID_GLOBAL_PACKED;
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
740 }
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
741 }
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
742 else
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
743 create->max_bframes = 0;
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
744
16515
1218c5859ce8 10l: fully working DXN profile support require XviD 1.1.x. Earlier version will work but will lack VBV support
gpoirier
parents: 16481
diff changeset
745 #if XVID_API >= XVID_MAKE_API(4,1)
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
746 /* dxn: always write divx5 userdata */
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
747 if(selected_profile->flags & PROFILE_DXN)
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
748 create->global |= XVID_GLOBAL_DIVX5_USERDATA;
16515
1218c5859ce8 10l: fully working DXN profile support require XviD 1.1.x. Earlier version will work but will lack VBV support
gpoirier
parents: 16481
diff changeset
749 #endif
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
750
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
751 create->max_key_interval = xvidenc_max_key_interval;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
752 create->frame_drop_ratio = xvidenc_frame_drop_ratio;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
753 create->min_quant[0] = xvidenc_min_quant[0];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
754 create->min_quant[1] = xvidenc_min_quant[1];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
755 create->min_quant[2] = xvidenc_min_quant[2];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
756 create->max_quant[0] = xvidenc_max_quant[0];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
757 create->max_quant[1] = xvidenc_max_quant[1];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
758 create->max_quant[2] = xvidenc_max_quant[2];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
759
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
760
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
761 /* -------------------------------------------------------------------
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
762 * The single pass plugin
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
763 * ---------------------------------------------------------------- */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
764
13675
d4cba4c4c54c Bitrate setting option in ve_xvid4.c doesn't follow the rules described
rathann
parents: 13610
diff changeset
765 if (xvidenc_bitrate > 16000) onepass->bitrate = xvidenc_bitrate;
d4cba4c4c54c Bitrate setting option in ve_xvid4.c doesn't follow the rules described
rathann
parents: 13610
diff changeset
766 else onepass->bitrate = xvidenc_bitrate*1000;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
767 onepass->reaction_delay_factor = xvidenc_cbr_reaction_delay_factor;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
768 onepass->averaging_period = xvidenc_cbr_averaging_period;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
769 onepass->buffer = xvidenc_cbr_buffer;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
770
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
771 /* -------------------------------------------------------------------
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
772 * The pass2 plugin
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
773 * ---------------------------------------------------------------- */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
774
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
775 pass2->keyframe_boost = xvidenc_vbr_keyframe_boost;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
776 pass2->overflow_control_strength = xvidenc_vbr_overflow_control_strength;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
777 pass2->curve_compression_high = xvidenc_vbr_curve_compression_high;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
778 pass2->curve_compression_low = xvidenc_vbr_curve_compression_low;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
779 pass2->max_overflow_improvement = xvidenc_vbr_max_overflow_improvement;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
780 pass2->max_overflow_degradation = xvidenc_vbr_max_overflow_degradation;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
781 pass2->kfreduction = xvidenc_vbr_kfreduction;
11586
efe910b068fc xvid 1.0 beta2
iive
parents: 11491
diff changeset
782 pass2->kfthreshold = xvidenc_vbr_kfthreshold;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
783 pass2->container_frame_overhead = xvidenc_vbr_container_frame_overhead;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
784
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
785 /* VBV */
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
786
16515
1218c5859ce8 10l: fully working DXN profile support require XviD 1.1.x. Earlier version will work but will lack VBV support
gpoirier
parents: 16481
diff changeset
787 #if XVID_API >= XVID_MAKE_API(4,1)
32574
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
788 if(xvidenc_vbv_size > 0) {
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
789 if(selected_profile->max_vbv_size > 0 && xvidenc_vbv_size > selected_profile->max_vbv_size) {
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
790 mp_msg(MSGT_MENCODER,MSGL_ERR,
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
791 "xvid:[ERROR] Selected profile limits vbv_bufsize <= %d\n", selected_profile->max_vbv_size);
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
792 return BAD;
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
793 }
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
794
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
795 pass2->vbv_size = xvidenc_vbv_size;
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
796 } else {
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
797 pass2->vbv_size = selected_profile->max_vbv_size;
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
798 }
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
799
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
800 if(xvidenc_vbv_initial > 0) {
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
801 if(xvidenc_vbv_initial > pass2->vbv_size) {
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
802 mp_msg(MSGT_MENCODER,MSGL_ERR,
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
803 "xvid:[ERROR] vbv_initial must be <= vbv_bufsize\n");
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
804 return BAD;
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
805 }
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
806
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
807 pass2->vbv_initial = xvidenc_vbv_initial;
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
808 } else {
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
809 pass2->vbv_initial = (pass2->vbv_size*3)>>2; /* 75% */
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
810 }
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
811
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
812 if(xvidenc_vbv_maxrate > 0) {
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
813 if(selected_profile->max_bitrate > 0 && xvidenc_vbv_maxrate > selected_profile->max_bitrate) {
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
814 mp_msg(MSGT_MENCODER,MSGL_ERR,
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
815 "xvid:[ERROR] Selected profile limits vbv_maxrate <= %d\n", selected_profile->max_bitrate);
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
816 return BAD;
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
817 }
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
818
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
819 pass2->vbv_maxrate = xvidenc_vbv_maxrate;
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
820 } else {
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
821 pass2->vbv_maxrate = selected_profile->max_bitrate;
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
822 }
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
823
59ecb59c86cc Expose the VBV options of xvid encoder to the command line interface.
iive
parents: 32537
diff changeset
824 pass2->vbv_peakrate = selected_profile->vbv_peakrate; /* Useless */
16515
1218c5859ce8 10l: fully working DXN profile support require XviD 1.1.x. Earlier version will work but will lack VBV support
gpoirier
parents: 16481
diff changeset
825 #endif
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
826
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
827 create->profile = selected_profile->id;
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
828
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
829 /* -------------------------------------------------------------------
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
830 * The frame structure
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
831 * ---------------------------------------------------------------- */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
832 frame->vol_flags = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
833 frame->vop_flags = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
834 frame->motion = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
835
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
836 frame->vop_flags |= XVID_VOP_HALFPEL;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
837 frame->motion |= motion_presets[xvidenc_motion];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
838
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
839 if(xvidenc_stats)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
840 frame->vol_flags |= XVID_VOL_EXTRASTATS;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
841
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
842 if(xvidenc_greyscale)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
843 frame->vop_flags |= XVID_VOP_GREYSCALE;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
844
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
845 if(xvidenc_cartoon) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
846 frame->vop_flags |= XVID_VOP_CARTOON;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
847 frame->motion |= XVID_ME_DETECT_STATIC_MOTION;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
848 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
849
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
850 // MPEG quantisation is only supported in ASP and unrestricted profiles
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
851 if((selected_profile->flags & PROFILE_MPEGQUANT) &&
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
852 (xvidenc_quant_method != NULL) &&
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
853 !strcasecmp(xvidenc_quant_method, "mpeg"))
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
854 {
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
855 frame->vol_flags |= XVID_VOL_MPEGQUANT;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
856 if(xvidenc_intra_matrix_file != NULL) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
857 frame->quant_intra_matrix = (unsigned char*)read_matrix(xvidenc_intra_matrix_file);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
858 if(frame->quant_intra_matrix != NULL) {
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
859 mp_msg(MSGT_MENCODER, MSGL_INFO, "xvid: Loaded Intra matrix (switching to mpeg quantization type)\n");
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 32479
diff changeset
860 free(xvidenc_quant_method);
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
861 xvidenc_quant_method = strdup("mpeg");
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
862 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
863 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
864 if(xvidenc_inter_matrix_file != NULL) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
865 frame->quant_inter_matrix = read_matrix(xvidenc_inter_matrix_file);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
866 if(frame->quant_inter_matrix) {
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
867 mp_msg(MSGT_MENCODER, MSGL_INFO, "\nxvid: Loaded Inter matrix (switching to mpeg quantization type)\n");
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 32479
diff changeset
868 free(xvidenc_quant_method);
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
869 xvidenc_quant_method = strdup("mpeg");
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
870 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
871 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
872 }
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
873 if(xvidenc_quarterpel && (selected_profile->flags & PROFILE_QPEL)) {
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
874 frame->vol_flags |= XVID_VOL_QUARTERPEL;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
875 frame->motion |= XVID_ME_QUARTERPELREFINE16;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
876 frame->motion |= XVID_ME_QUARTERPELREFINE8;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
877 }
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
878 if(xvidenc_gmc && (selected_profile->flags & PROFILE_GMC)) {
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
879 frame->vol_flags |= XVID_VOL_GMC;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
880 frame->motion |= XVID_ME_GME_REFINE;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
881 }
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
882 if(xvidenc_interlaced && (selected_profile->flags & PROFILE_INTERLACE)) {
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
883 frame->vol_flags |= XVID_VOL_INTERLACING;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
884 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
885 if(xvidenc_trellis) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
886 frame->vop_flags |= XVID_VOP_TRELLISQUANT;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
887 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
888 if(xvidenc_hqacpred) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
889 frame->vop_flags |= XVID_VOP_HQACPRED;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
890 }
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
891 if(xvidenc_chroma_opt) {
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
892 frame->vop_flags |= XVID_VOP_CHROMAOPT;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
893 }
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
894 if((xvidenc_motion > 4) && (selected_profile->flags & PROFILE_4MV)) {
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
895 frame->vop_flags |= XVID_VOP_INTER4V;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
896 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
897 if(xvidenc_chromame) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
898 frame->motion |= XVID_ME_CHROMA_PVOP;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
899 frame->motion |= XVID_ME_CHROMA_BVOP;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
900 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
901 if(xvidenc_vhq >= 1) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
902 frame->vop_flags |= XVID_VOP_MODEDECISION_RD;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
903 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
904 if(xvidenc_vhq >= 2) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
905 frame->motion |= XVID_ME_HALFPELREFINE16_RD;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
906 frame->motion |= XVID_ME_QUARTERPELREFINE16_RD;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
907 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
908 if(xvidenc_vhq >= 3) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
909 frame->motion |= XVID_ME_HALFPELREFINE8_RD;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
910 frame->motion |= XVID_ME_QUARTERPELREFINE8_RD;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
911 frame->motion |= XVID_ME_CHECKPREDICTION_RD;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
912 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
913 if(xvidenc_vhq >= 4) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
914 frame->motion |= XVID_ME_EXTSEARCH_RD;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
915 }
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
916 if(xvidenc_bvhq >= 1) {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
917 #if XVID_API >= XVID_MAKE_API(4,1)
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
918 frame->vop_flags |= XVID_VOP_RD_BVOP;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
919 #endif
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
920 }
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
921 if(xvidenc_turbo) {
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
922 frame->motion |= XVID_ME_FASTREFINE16;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
923 frame->motion |= XVID_ME_FASTREFINE8;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
924 frame->motion |= XVID_ME_SKIP_DELTASEARCH;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
925 frame->motion |= XVID_ME_FAST_MODEINTERPOLATE;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
926 frame->motion |= XVID_ME_BFRAME_EARLYSTOP;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
927 }
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
928
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
929 /* motion level == 0 means no motion search which is equivalent to
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
930 * intra coding only */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
931 if(xvidenc_motion == 0) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
932 frame->type = XVID_TYPE_IVOP;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
933 } else {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
934 frame->type = XVID_TYPE_AUTO;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
935 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
936
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
937 frame->bframe_threshold = xvidenc_bframe_threshold;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
938
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
939 /* PAR related initialization */
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
940 frame->par = XVID_PAR_11_VGA; /* Default */
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
941
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
942 if( !(selected_profile->flags & PROFILE_DXN) )
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
943 {
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
944 if(xvidenc_dar_aspect > 0)
24295
de8e36aec5ff Remove imported rational calculation code and use the original one from avutil.
iive
parents: 22601
diff changeset
945 ar = av_d2q(xvidenc_dar_aspect * mod->mux->bih->biHeight / mod->mux->bih->biWidth, 255);
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
946 else if(xvidenc_autoaspect)
24295
de8e36aec5ff Remove imported rational calculation code and use the original one from avutil.
iive
parents: 22601
diff changeset
947 ar = av_d2q((float)mod->d_width / mod->d_height * mod->mux->bih->biHeight / mod->mux->bih->biWidth, 255);
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
948 else ar.num = ar.den = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
949
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
950 if(ar.den != 0) {
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
951 if(ar.num == 12 && ar.den == 11)
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
952 frame->par = XVID_PAR_43_PAL;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
953 else if(ar.num == 10 && ar.den == 11)
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
954 frame->par = XVID_PAR_43_NTSC;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
955 else if(ar.num == 16 && ar.den == 11)
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
956 frame->par = XVID_PAR_169_PAL;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
957 else if(ar.num == 40 && ar.den == 33)
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
958 frame->par = XVID_PAR_169_NTSC;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
959 else
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
960 {
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
961 frame->par = XVID_PAR_EXT;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
962 frame->par_width = ar.num;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
963 frame->par_height= ar.den;
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
964 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
965
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
966 } else if(xvidenc_par != NULL) {
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
967 if(strcasecmp(xvidenc_par, "pal43") == 0)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
968 frame->par = XVID_PAR_43_PAL;
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
969 else if(strcasecmp(xvidenc_par, "pal169") == 0)
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
970 frame->par = XVID_PAR_169_PAL;
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
971 else if(strcasecmp(xvidenc_par, "ntsc43") == 0)
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
972 frame->par = XVID_PAR_43_NTSC;
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
973 else if(strcasecmp(xvidenc_par, "ntsc169") == 0)
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
974 frame->par = XVID_PAR_169_NTSC;
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
975 else if(strcasecmp(xvidenc_par, "ext") == 0)
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
976 frame->par = XVID_PAR_EXT;
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
977
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
978 if(frame->par == XVID_PAR_EXT) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
979 if(xvidenc_par_width)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
980 frame->par_width = xvidenc_par_width;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
981 else
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
982 frame->par_width = 1;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
983
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
984 if(xvidenc_par_height)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
985 frame->par_height = xvidenc_par_height;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
986 else
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
987 frame->par_height = 1;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
988 }
11912
8eb96d751dcd new options - aspect,autoaspect,turbo,chroma_opt. patch by Nico <nsabbi@tiscali.it> and Edouard Gomez
iive
parents: 11586
diff changeset
989 }
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
990
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
991 /* Display par information */
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
992 mp_msg(MSGT_MENCODER, MSGL_INFO, "xvid: par=%d/%d (%s), displayed=%dx%d, sampled=%dx%d\n",
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
993 ar.num, ar.den, par_string(frame->par),
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
994 mod->d_width, mod->d_height, mod->mux->bih->biWidth, mod->mux->bih->biHeight);
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
995 }
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
996 else
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
997 mp_msg(MSGT_MENCODER, MSGL_INFO,
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
998 "xvid: par=0/0 (vga11) forced by choosing a DXN profile\n");
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
999 return FINE;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1000 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1001
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1002 static int set_create_struct(xvid_mplayer_module_t *mod)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1003 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1004 int pass;
15619
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1005 int doZones = 0;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1006 xvid_enc_create_t *create = &mod->create;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1007
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1008 // profile is unrestricted as default
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1009 profile_t *selected_profile = profileFromName("unrestricted");
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1010 if(xvidenc_profile)
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1011 selected_profile = profileFromName(xvidenc_profile);
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1012 if(!selected_profile)
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1013 return BAD;
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1014
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1015 /* Most of the structure is initialized by dispatch settings, only a
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1016 * few things are missing */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1017 create->version = XVID_VERSION;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1018
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1019 /* Width and Height */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1020 create->width = mod->mux->bih->biWidth;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1021 create->height = mod->mux->bih->biHeight;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1022
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1023 /* Check resolution of video to be coded is within profile width/height
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1024 restrictions */
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1025 if( ((selected_profile->width != 0) &&
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1026 (mod->mux->bih->biWidth > selected_profile->width)) ||
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1027 ((selected_profile->height != 0) &&
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1028 (mod->mux->bih->biHeight > selected_profile->height)) )
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1029 {
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1030 mp_msg(MSGT_MENCODER,MSGL_ERR,
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1031 "xvid:[ERROR] resolution must be <= %dx%d for the chosen profile\n",
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1032 selected_profile->width, selected_profile->height);
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1033 return BAD;
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1034 }
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1035
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1036 /* FPS */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1037 create->fincr = mod->mux->h.dwScale;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1038 create->fbase = mod->mux->h.dwRate;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1039
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1040 // Check frame rate is within profile restrictions
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1041 if( ((float)mod->mux->h.dwRate/(float)mod->mux->h.dwScale > (float)selected_profile->fps) &&
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1042 (selected_profile->fps != 0))
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1043 {
31938
93c67b51b171 Print a warning, but allow to encode to a non-supported frame rate with
cehoyos
parents: 31937
diff changeset
1044 mp_msg(MSGT_MENCODER,MSGL_WARN,
93c67b51b171 Print a warning, but allow to encode to a non-supported frame rate with
cehoyos
parents: 31937
diff changeset
1045 "xvid:[WARNING] frame rate should be <= %d for the chosen profile\n",
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1046 selected_profile->fps);
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1047 }
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1048
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1049 /* Encodings zones */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1050 memset(mod->zones, 0, sizeof(mod->zones));
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1051 create->zones = mod->zones;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1052 create->num_zones = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1053
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1054 /* Plugins */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1055 memset(mod->plugins, 0, sizeof(mod->plugins));
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1056 create->plugins = mod->plugins;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1057 create->num_plugins = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1058
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1059 /* -------------------------------------------------------------------
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1060 * Initialize and bind the right rate controller plugin
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1061 * ---------------------------------------------------------------- */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1062
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1063 /* First we try to sort out configuration conflicts */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1064 if(xvidenc_quantizer != 0 && (xvidenc_bitrate || xvidenc_pass)) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1065 mp_msg(MSGT_MENCODER, MSGL_ERR,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1066 "xvid: you can't mix Fixed Quantizer Rate Control"
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1067 " with other Rate Control mechanisms\n");
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1068 return BAD;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1069 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1070
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1071 if(xvidenc_bitrate != 0 && xvidenc_pass == 1) {
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1072 mp_msg(MSGT_MENCODER, MSGL_WARN,
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1073 "xvid: bitrate setting is ignored during first pass\n");
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1074 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1075
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1076 /* Sort out which sort of pass we are supposed to do
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1077 * pass == 1<<0 CBR
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1078 * pass == 1<<1 Two pass first pass
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1079 * pass == 1<<2 Two pass second pass
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1080 * pass == 1<<3 Constant quantizer
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1081 */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1082 #define MODE_CBR (1<<0)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1083 #define MODE_2PASS1 (1<<1)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1084 #define MODE_2PASS2 (1<<2)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1085 #define MODE_QUANT (1<<3)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1086
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1087 pass = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1088
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1089 if(xvidenc_bitrate != 0 && xvidenc_pass == 0)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1090 pass |= MODE_CBR;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1091
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1092 if(xvidenc_pass == 1)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1093 pass |= MODE_2PASS1;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1094
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1095 if(xvidenc_bitrate != 0 && xvidenc_pass == 2)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1096 pass |= MODE_2PASS2;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1097
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1098 if(xvidenc_quantizer != 0 && xvidenc_pass == 0)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1099 pass |= MODE_QUANT;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1100
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1101 /* We must be in at least one RC mode */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1102 if(pass == 0) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1103 mp_msg(MSGT_MENCODER, MSGL_ERR,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1104 "xvid: you must specify one or a valid combination of "
25809
7c4ba42d7328 Use the proper option name for constant quantizer
iive
parents: 25607
diff changeset
1105 "'bitrate', 'pass', 'fixed_quant' settings\n");
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1106 return BAD;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1107 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1108
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1109 /* Sanity checking */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1110 if(pass != MODE_CBR && pass != MODE_QUANT &&
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1111 pass != MODE_2PASS1 && pass != MODE_2PASS2) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1112 mp_msg(MSGT_MENCODER, MSGL_ERR,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1113 "xvid: this code should not be reached - fill a bug "
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1114 "report\n");
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1115 return BAD;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1116 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1117
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1118 /* This is a single pass encoding: either a CBR pass or a constant
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1119 * quantizer pass */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1120 if(pass == MODE_CBR || pass == MODE_QUANT) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1121 xvid_plugin_single_t *onepass = &mod->onepass;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1122
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1123 /* There is not much left to initialize after dispatch settings */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1124 onepass->version = XVID_VERSION;
13675
d4cba4c4c54c Bitrate setting option in ve_xvid4.c doesn't follow the rules described
rathann
parents: 13610
diff changeset
1125 if (xvidenc_bitrate > 16000) onepass->bitrate = xvidenc_bitrate;
d4cba4c4c54c Bitrate setting option in ve_xvid4.c doesn't follow the rules described
rathann
parents: 13610
diff changeset
1126 else onepass->bitrate = xvidenc_bitrate*1000;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1127
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1128 /* Quantizer mode uses the same plugin, we have only to define
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1129 * a constant quantizer zone beginning at frame 0 */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1130 if(pass == MODE_QUANT) {
24295
de8e36aec5ff Remove imported rational calculation code and use the original one from avutil.
iive
parents: 22601
diff changeset
1131 AVRational squant;
de8e36aec5ff Remove imported rational calculation code and use the original one from avutil.
iive
parents: 22601
diff changeset
1132 squant = av_d2q(xvidenc_quantizer,128);
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1133
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1134 create->zones[create->num_zones].mode = XVID_ZONE_QUANT;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1135 create->zones[create->num_zones].frame = 0;
12806
2a02e3dc8ba3 fix 10l fixed_quant bug reported by Michael
iive
parents: 12061
diff changeset
1136 create->zones[create->num_zones].increment = squant.num;
2a02e3dc8ba3 fix 10l fixed_quant bug reported by Michael
iive
parents: 12061
diff changeset
1137 create->zones[create->num_zones].base = squant.den;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1138 create->num_zones++;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1139
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1140 mp_msg(MSGT_MENCODER, MSGL_INFO,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1141 "xvid: Fixed Quant Rate Control -- quantizer=%d/%d=%2.2f\n",
11929
d870d266634e allow using of float fixed_quant
iive
parents: 11920
diff changeset
1142 squant.num,
d870d266634e allow using of float fixed_quant
iive
parents: 11920
diff changeset
1143 squant.den,
d870d266634e allow using of float fixed_quant
iive
parents: 11920
diff changeset
1144 (float)(squant.num)/(float)(squant.den));
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
1145
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1146 } else {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1147 mp_msg(MSGT_MENCODER, MSGL_INFO,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1148 "xvid: CBR Rate Control -- bitrate=%dkbit/s\n",
13675
d4cba4c4c54c Bitrate setting option in ve_xvid4.c doesn't follow the rules described
rathann
parents: 13610
diff changeset
1149 xvidenc_bitrate>16000?xvidenc_bitrate/1000:xvidenc_bitrate);
15619
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1150 doZones = 1;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1151 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1152
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1153 create->plugins[create->num_plugins].func = xvid_plugin_single;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1154 create->plugins[create->num_plugins].param = onepass;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1155 create->num_plugins++;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1156 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1157
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1158 /* This is the first pass of a Two pass process */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1159 if(pass == MODE_2PASS1) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1160 xvid_plugin_2pass1_t *pass1 = &mod->pass1;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1161
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1162 /* There is not much to initialize for this plugin */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1163 pass1->version = XVID_VERSION;
16602
4626c4d13e2a make xvid encoding use the filename from
gpoirier
parents: 16515
diff changeset
1164 pass1->filename = passtmpfile;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1165
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1166 create->plugins[create->num_plugins].func = xvid_plugin_2pass1;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1167 create->plugins[create->num_plugins].param = pass1;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1168 create->num_plugins++;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1169
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1170 mp_msg(MSGT_MENCODER, MSGL_INFO,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1171 "xvid: 2Pass Rate Control -- 1st pass\n");
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1172 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1173
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1174 /* This is the second pass of a Two pass process */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1175 if(pass == MODE_2PASS2) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1176 xvid_plugin_2pass2_t *pass2 = &mod->pass2;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1177
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1178 /* There is not much left to initialize after dispatch settings */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1179 pass2->version = XVID_VERSION;
16602
4626c4d13e2a make xvid encoding use the filename from
gpoirier
parents: 16515
diff changeset
1180 pass2->filename = passtmpfile;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1181
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1182 /* Positive bitrate values are bitrates as usual but if the
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1183 * value is negative it is considered as being a total size
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1184 * to reach (in kilobytes) */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1185 if(xvidenc_bitrate > 0) {
13675
d4cba4c4c54c Bitrate setting option in ve_xvid4.c doesn't follow the rules described
rathann
parents: 13610
diff changeset
1186 if(xvidenc_bitrate > 16000) pass2->bitrate = xvidenc_bitrate;
d4cba4c4c54c Bitrate setting option in ve_xvid4.c doesn't follow the rules described
rathann
parents: 13610
diff changeset
1187 else pass2->bitrate = xvidenc_bitrate*1000;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1188 mp_msg(MSGT_MENCODER, MSGL_INFO,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1189 "xvid: 2Pass Rate Control -- 2nd pass -- bitrate=%dkbit/s\n",
13675
d4cba4c4c54c Bitrate setting option in ve_xvid4.c doesn't follow the rules described
rathann
parents: 13610
diff changeset
1190 xvidenc_bitrate>16000?xvidenc_bitrate/1000:xvidenc_bitrate);
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1191 } else {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1192 pass2->bitrate = xvidenc_bitrate;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1193 mp_msg(MSGT_MENCODER, MSGL_INFO,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1194 "xvid: 2Pass Rate Control -- 2nd pass -- total size=%dkB\n",
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1195 -xvidenc_bitrate);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1196 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1197
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1198 create->plugins[create->num_plugins].func = xvid_plugin_2pass2;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1199 create->plugins[create->num_plugins].param = pass2;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1200 create->num_plugins++;
15619
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1201 doZones = 1;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1202 }
15638
189da3c3116b Add XviD's luminance masking (option name: lumi_mask)
gpoirier
parents: 15619
diff changeset
1203
16481
beebfccc00f1 adds Simple, Advanced Simple and DivX profile support for XviD, Patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15664
diff changeset
1204 if(xvidenc_luminance_masking && (selected_profile->flags & PROFILE_ADAPTQUANT)) {
15638
189da3c3116b Add XviD's luminance masking (option name: lumi_mask)
gpoirier
parents: 15619
diff changeset
1205 create->plugins[create->num_plugins].func = xvid_plugin_lumimasking;
189da3c3116b Add XviD's luminance masking (option name: lumi_mask)
gpoirier
parents: 15619
diff changeset
1206 create->plugins[create->num_plugins].param = NULL;
189da3c3116b Add XviD's luminance masking (option name: lumi_mask)
gpoirier
parents: 15619
diff changeset
1207 create->num_plugins++;
189da3c3116b Add XviD's luminance masking (option name: lumi_mask)
gpoirier
parents: 15619
diff changeset
1208 }
189da3c3116b Add XviD's luminance masking (option name: lumi_mask)
gpoirier
parents: 15619
diff changeset
1209
15619
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1210 // parse zones
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1211 if (xvidenc_zones != NULL && doZones > 0) // do not apply zones in CQ, and first pass mode (xvid vfw doesn't allow them in those modes either)
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1212 {
24735
4baa2dbe172c Silence a gcc warning: "wrong type argument to increment".
zuxy
parents: 24629
diff changeset
1213 char *p;
15619
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1214 int i;
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1215 p = xvidenc_zones;
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1216 create->num_zones = 0; // set the number of zones back to zero, this overwrites the zone defined for CQ - desired because each zone has to be specified on the commandline even in cq mode
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1217 for(i = 0; p; i++)
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1218 {
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1219 int start;
15664
aa24bbbfd5c4 gcc-2.95.3 fix, patch inspired by Steven M. Schultz
iive
parents: 15638
diff changeset
1220 int q;
15619
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1221 double value;
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1222 char mode;
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1223 int e = sscanf(p, "%d,%c,%lf", &start, &mode, &value); // start,mode(q = constant quant, w = weight),value
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1224 if(e != 3)
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1225 {
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1226 mp_msg(MSGT_MENCODER,MSGL_ERR, "error parsing zones\n");
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1227 return BAD;
15619
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1228 }
15664
aa24bbbfd5c4 gcc-2.95.3 fix, patch inspired by Steven M. Schultz
iive
parents: 15638
diff changeset
1229 q = (int)(value * 100);
15619
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1230 if (mode == 'q')
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1231 {
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1232 if (q < 200 || q > 3100) // make sure that quantizer is in allowable range
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1233 {
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1234 mp_msg(MSGT_MENCODER, MSGL_ERR, "zone quantizer must be between 2 and 31\n");
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1235 return BAD;
15619
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1236 }
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1237 else
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1238 {
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1239 create->zones[create->num_zones].mode = XVID_ZONE_QUANT;
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1240 }
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1241 }
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1242 if (mode == 'w')
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1243 {
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1244 if (q < 1 || q > 200)
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1245 {
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1246 mp_msg(MSGT_MENCODER, MSGL_ERR, "zone weight must be between 1 and 200\n");
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1247 return BAD;
15619
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1248 }
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1249 else
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1250 {
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1251 create->zones[create->num_zones].mode = XVID_ZONE_WEIGHT;
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1252 }
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1253 }
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1254 create->zones[create->num_zones].frame = start;
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1255 create->zones[create->num_zones].increment = q;
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1256 create->zones[create->num_zones].base = 100; // increment is 100 times the actual value
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1257 create->num_zones++;
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1258 if (create->num_zones > MAX_ZONES) // show warning if we have too many zones
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1259 {
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1260 mp_msg(MSGT_MENCODER, MSGL_ERR, "too many zones, zones will be ignored\n");
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1261 }
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1262 p = strchr(p, '/');
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1263 if(p) p++;
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1264 }
ccf2c61afacd XviD zones support. Patch by Doom9: < feedback123 GROOVY doom9 STEADY org >
gpoirier
parents: 15070
diff changeset
1265 }
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1266 return FINE;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1267 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1268
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1269 static int set_frame_struct(xvid_mplayer_module_t *mod, mp_image_t *mpi)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1270 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1271 xvid_enc_frame_t *frame = &mod->frame;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1272
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1273 /* Most of the initialization is done during dispatch_settings */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1274 frame->version = XVID_VERSION;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1275
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1276 /* Bind output buffer */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1277 frame->bitstream = mod->mux->buffer;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1278 frame->length = -1;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1279
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1280 /* Frame format */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1281 switch(mpi->imgfmt) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1282 case IMGFMT_YV12:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1283 case IMGFMT_IYUV:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1284 case IMGFMT_I420:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1285 frame->input.csp = XVID_CSP_USER;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1286 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1287 case IMGFMT_YUY2:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1288 frame->input.csp = XVID_CSP_YUY2;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1289 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1290 case IMGFMT_UYVY:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1291 frame->input.csp = XVID_CSP_UYVY;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1292 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1293 default:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1294 mp_msg(MSGT_MENCODER, MSGL_ERR,
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1295 "xvid: unsupported picture format (%s)!\n",
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1296 vo_format_name(mpi->imgfmt));
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1297 return BAD;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1298 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1299
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1300 /* Bind source frame */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1301 frame->input.plane[0] = mpi->planes[0];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1302 frame->input.plane[1] = mpi->planes[1];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1303 frame->input.plane[2] = mpi->planes[2];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1304 frame->input.stride[0] = mpi->stride[0];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1305 frame->input.stride[1] = mpi->stride[1];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1306 frame->input.stride[2] = mpi->stride[2];
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1307
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1308 /* Force the right quantizer -- It is internally managed by RC
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1309 * plugins */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1310 frame->quant = 0;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1311
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1312 return FINE;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1313 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1314
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1315 static void
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
1316 flush_internal_buffers(xvid_mplayer_module_t *mod)
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1317 {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1318 int size;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1319 xvid_enc_frame_t *frame = &mod->frame;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1320
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1321 if (mod->instance == NULL)
25962
afa125da85cf typo fix: inited --> initialized
diego
parents: 25809
diff changeset
1322 return; /* encoder not initialized */
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1323
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1324 /* Init a fake frame to force flushing */
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1325 frame->version = XVID_VERSION;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1326 frame->bitstream = mod->mux->buffer;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1327 frame->length = -1;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1328 frame->input.csp = XVID_CSP_NULL;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1329 frame->input.plane[0] = NULL;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1330 frame->input.plane[1] = NULL;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1331 frame->input.plane[2] = NULL;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1332 frame->input.stride[0] = 0;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1333 frame->input.stride[1] = 0;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1334 frame->input.stride[2] = 0;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1335 frame->quant = 0;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1336
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1337 /* Flush encoder buffers caused by bframes usage */
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1338 do {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1339 xvid_enc_stats_t stats;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1340 memset(&stats, 0, sizeof(xvid_enc_stats_t));
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1341 stats.version = XVID_VERSION;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1342
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1343 /* Encode internal buffer */
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1344 size = xvid_encore(mod->instance, XVID_ENC_ENCODE, &mod->frame, &stats);
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1345
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1346 if (size>0) {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1347 /* Update stats */
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1348 update_stats(mod, &stats);
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1349
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1350 /* xvidcore outputed bitstream -- mux it */
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1351 muxer_write_chunk(mod->mux, size,
17487
fa17424b4c7b change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents: 17012
diff changeset
1352 (mod->frame.out_flags & XVID_KEYFRAME)?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1353 }
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1354 } while (size>0);
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1355 }
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1356
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1357 #define SSE2PSNR(sse, nbpixels) \
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1358 ((!(sse)) ? 99.99f : 48.131f - 10*(double)log10((double)(sse)/(double)((nbpixels))))
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1359 static void
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1360 update_stats(xvid_mplayer_module_t *mod, xvid_enc_stats_t *stats)
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1361 {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1362 if(xvidenc_stats && stats->type > 0) {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1363 mod->sse_y += stats->sse_y;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1364 mod->sse_u += stats->sse_u;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1365 mod->sse_v += stats->sse_v;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1366
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1367 if(mod->min_sse_y > stats->sse_y) {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1368 mod->min_sse_y = stats->sse_y;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1369 mod->min_sse_u = stats->sse_u;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1370 mod->min_sse_v = stats->sse_v;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1371 mod->min_framenum = mod->frames;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1372 }
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1373
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1374 if(mod->max_sse_y < stats->sse_y) {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1375 mod->max_sse_y = stats->sse_y;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1376 mod->max_sse_u = stats->sse_u;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1377 mod->max_sse_v = stats->sse_v;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1378 mod->max_framenum = mod->frames;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1379 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
1380
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1381 if (xvidenc_psnr) {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1382 if (!mod->fvstats) {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1383 char filename[20];
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1384 time_t today2;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1385 struct tm *today;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1386 today2 = time (NULL);
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1387 today = localtime (&today2);
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1388 sprintf (filename, "psnr_%02d%02d%02d.log", today->tm_hour, today->tm_min, today->tm_sec);
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1389 mod->fvstats = fopen (filename,"w");
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1390 if (!mod->fvstats) {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1391 perror ("fopen");
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1392 /* Disable PSNR file output so we don't get here again */
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1393 xvidenc_psnr = 0;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1394 }
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1395 }
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1396 fprintf (mod->fvstats, "%6d, %2d, %6d, %2.2f, %2.2f, %2.2f, %2.2f %c\n",
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1397 mod->frames,
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1398 stats->quant,
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1399 stats->length,
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1400 SSE2PSNR (stats->sse_y, mod->pixels),
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1401 SSE2PSNR (stats->sse_u, mod->pixels / 4),
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1402 SSE2PSNR (stats->sse_v, mod->pixels / 4),
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1403 SSE2PSNR (stats->sse_y + stats->sse_u + stats->sse_v,(double)mod->pixels * 1.5),
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1404 stats->type==1?'I':stats->type==2?'P':stats->type==3?'B':stats->type?'S':'?'
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1405 );
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1406 }
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1407 mod->frames++;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1408 }
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1409 }
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1410
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1411 static void
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1412 print_stats(xvid_mplayer_module_t *mod)
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1413 {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1414 if (mod->frames) {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1415 mod->sse_y /= mod->frames;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1416 mod->sse_u /= mod->frames;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1417 mod->sse_v /= mod->frames;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1418
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1419 mp_msg(MSGT_MENCODER, MSGL_INFO,
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1420 "The value 99.99dB is a special value and represents "
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1421 "the upper range limit\n");
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1422 mp_msg(MSGT_MENCODER, MSGL_INFO,
20017
8e43776eeb49 make PSNR printing more consistent with other encoders
corey
parents: 19614
diff changeset
1423 "xvid: Min PSNR Y:%.2f, Cb:%.2f, Cr:%.2f, All:%.2f in frame %d\n",
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1424 SSE2PSNR(mod->max_sse_y, mod->pixels),
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1425 SSE2PSNR(mod->max_sse_u, mod->pixels/4),
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1426 SSE2PSNR(mod->max_sse_v, mod->pixels/4),
20017
8e43776eeb49 make PSNR printing more consistent with other encoders
corey
parents: 19614
diff changeset
1427 SSE2PSNR(mod->max_sse_y + mod->max_sse_u + mod->max_sse_v, mod->pixels*1.5),
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1428 mod->max_framenum);
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1429 mp_msg(MSGT_MENCODER, MSGL_INFO,
20017
8e43776eeb49 make PSNR printing more consistent with other encoders
corey
parents: 19614
diff changeset
1430 "xvid: Average PSNR Y:%.2f, Cb:%.2f, Cr:%.2f, All:%.2f for %d frames\n",
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1431 SSE2PSNR(mod->sse_y, mod->pixels),
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1432 SSE2PSNR(mod->sse_u, mod->pixels/4),
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1433 SSE2PSNR(mod->sse_v, mod->pixels/4),
20017
8e43776eeb49 make PSNR printing more consistent with other encoders
corey
parents: 19614
diff changeset
1434 SSE2PSNR(mod->sse_y + mod->sse_u + mod->sse_v, mod->pixels*1.5),
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1435 mod->frames);
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1436 mp_msg(MSGT_MENCODER, MSGL_INFO,
20017
8e43776eeb49 make PSNR printing more consistent with other encoders
corey
parents: 19614
diff changeset
1437 "xvid: Max PSNR Y:%.2f, Cb:%.2f, Cr:%.2f, All:%.2f in frame %d\n",
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1438 SSE2PSNR(mod->min_sse_y, mod->pixels),
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1439 SSE2PSNR(mod->min_sse_u, mod->pixels/4),
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1440 SSE2PSNR(mod->min_sse_v, mod->pixels/4),
20017
8e43776eeb49 make PSNR printing more consistent with other encoders
corey
parents: 19614
diff changeset
1441 SSE2PSNR(mod->min_sse_y + mod->min_sse_u + mod->min_sse_v, mod->pixels*1.5),
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1442 mod->min_framenum);
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1443 }
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1444 }
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1445 #undef SSE2PSNR
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1446
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1447 static void *read_matrix(unsigned char *filename)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1448 {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1449 int i;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1450 unsigned char *matrix;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1451 FILE *input;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
1452
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1453 /* Allocate matrix space */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1454 if((matrix = malloc(64*sizeof(unsigned char))) == NULL)
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1455 return NULL;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1456
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1457 /* Open the matrix file */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1458 if((input = fopen(filename, "rb")) == NULL) {
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1459 mp_msg(MSGT_MENCODER, MSGL_ERR,
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1460 "xvid: Error opening the matrix file %s\n",
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1461 filename);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1462 free(matrix);
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1463 return NULL;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1464 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1465
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1466 /* Read the matrix */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1467 for(i=0; i<64; i++) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1468
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1469 int value;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1470
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1471 /* If fscanf fails then get out of the loop */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1472 if(fscanf(input, "%d", &value) != 1) {
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1473 mp_msg(MSGT_MENCODER, MSGL_ERR,
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1474 "xvid: Error reading the matrix file %s\n",
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1475 filename);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1476 free(matrix);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1477 fclose(input);
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1478 return NULL;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1479 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1480
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1481 /* Clamp the value to safe range */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1482 value = (value< 1)?1 :value;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1483 value = (value>255)?255:value;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1484 matrix[i] = value;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1485 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1486
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1487 /* Fills the rest with 1 */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1488 while(i<64) matrix[i++] = 1;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1489
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1490 /* We're done */
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1491 fclose(input);
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1492
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1493 return matrix;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28186
diff changeset
1494
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1495 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1496
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1497
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1498 static const char *
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1499 par_string(int parcode)
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1500 {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1501 const char *par_string;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1502 switch (parcode) {
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1503 case XVID_PAR_11_VGA:
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1504 par_string = "vga11";
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1505 break;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1506 case XVID_PAR_43_PAL:
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1507 par_string = "pal43";
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1508 break;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1509 case XVID_PAR_43_NTSC:
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1510 par_string = "ntsc43";
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1511 break;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1512 case XVID_PAR_169_PAL:
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1513 par_string = "pal169";
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1514 break;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1515 case XVID_PAR_169_NTSC:
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1516 par_string = "ntsc69";
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1517 break;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1518 case XVID_PAR_EXT:
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1519 par_string = "ext";
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1520 break;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1521 default:
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1522 par_string = "unknown";
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1523 break;
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1524 }
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1525 return par_string;
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1526 }
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1527
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1528 static const char *errorstring(int err)
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1529 {
13610
b79ee5bf2c9e Sync with GomGom's patch-12 version.
iive
parents: 12806
diff changeset
1530 const char *error;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1531 switch(err) {
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1532 case XVID_ERR_FAIL:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1533 error = "General fault";
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1534 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1535 case XVID_ERR_MEMORY:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1536 error = "Memory allocation error";
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1537 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1538 case XVID_ERR_FORMAT:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1539 error = "File format error";
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1540 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1541 case XVID_ERR_VERSION:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1542 error = "Structure version not supported";
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1543 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1544 case XVID_ERR_END:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1545 error = "End of stream reached";
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1546 break;
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1547 default:
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1548 error = "Unknown";
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1549 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1550
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26727
diff changeset
1551 return error;
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1552 }
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1553
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1554 /*****************************************************************************
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1555 * Module structure definition
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1556 ****************************************************************************/
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1557
32033
c42345605c7a Mark video encoder vf_info_t structs as const.
diego
parents: 31938
diff changeset
1558 const vf_info_t ve_info_xvid = {
26883
a365271c97a5 Revert commit r26897.
iive
parents: 26865
diff changeset
1559 "XviD 1.0 encoder",
11437
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1560 "xvid",
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1561 "Marco Belli <elcabesa@inwind.it>, Edouard Gomez <ed.gomez@free.fr>",
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1562 "No comment",
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1563 vf_open
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1564 };
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1565
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1566
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1567 /* Please do not change that tag comment.
7826e4e376c7 XviD Api4 driver from http://ed.gomez.free.fr/
iive
parents:
diff changeset
1568 * arch-tag: 42ccc257-0548-4a3e-9617-2876c4e8ac88 mplayer xvid encoder module */