1 /***************************************************************************
2 \fn ADM_Xvid4
3 \brief Front end for xvid4 Mpeg4 asp encoder
4 -------------------
5
6 copyright : (C) 2002/2009 by mean/gruntster
7 email : fixounet@free.fr
8 ***************************************************************************/
9
10 /***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18 #include "ADM_default.h"
19 #include "ADM_xvid4.h"
20 #undef ADM_MINIMAL_UI_INTERFACE // we need the full UI
21 #include "DIA_factory.h"
22
23 /**
24 \fn xvidConfigure
25 \brief UI configuration for xvid4 encoder
26 */
27 extern xvid4_encoder xvid4Settings;
xvid4Configure(void)28 bool xvid4Configure(void)
29 {
30
31 diaMenuEntry meE[]={
32 {0,QT_TRANSLATE_NOOP("xvid4","None")},
33 {1,QT_TRANSLATE_NOOP("xvid4","Low")},
34 {2,QT_TRANSLATE_NOOP("xvid4","Medium")},
35 {3,QT_TRANSLATE_NOOP("xvid4","Full")}
36 };
37
38 diaMenuEntry qzE[]={
39 {0,QT_TRANSLATE_NOOP("xvid4","H.263")},
40 {1,QT_TRANSLATE_NOOP("xvid4","MPEG")},
41 {2,QT_TRANSLATE_NOOP("xvid4","Custom")}
42 };
43 diaMenuEntry profileE[]={
44 { XVID_PROFILE_S_L0 ,"Simple Level0"},
45 { XVID_PROFILE_S_L1 ,"Simple Level1"},
46 { XVID_PROFILE_S_L2 ,"Simple Level2"},
47 { XVID_PROFILE_S_L3 ,"Simple Level3"},
48 { XVID_PROFILE_AS_L0 ,"Adv. Simple Level0"},
49 { XVID_PROFILE_AS_L1 ,"Adv. Simple Level1"},
50 { XVID_PROFILE_AS_L2 ,"Adv. Simple Level2"},
51 { XVID_PROFILE_AS_L3 ,"Adv. Simple Level3"},
52 { XVID_PROFILE_AS_L4 ,"Adv. Simple Level4"},
53 };
54
55 diaMenuEntry rdE[]={
56 {0,QT_TRANSLATE_NOOP("xvid4","None")},
57 {1,QT_TRANSLATE_NOOP("xvid4","DCT")},
58 {2,QT_TRANSLATE_NOOP("xvid4","Qpel16")},
59 {3,QT_TRANSLATE_NOOP("xvid4","Qpel8")},
60 {4,QT_TRANSLATE_NOOP("xvid4","Square")}
61 };
62
63 diaMenuEntry threads[]={
64 {1,QT_TRANSLATE_NOOP("xvid4","One thread")},
65 {2,QT_TRANSLATE_NOOP("xvid4","Two threads)")},
66 {3,QT_TRANSLATE_NOOP("xvid4","Three threads")},
67 {99,QT_TRANSLATE_NOOP("xvid4","Auto (#cpu)")}
68 };
69
70 diaMenuEntry arModeE[]={
71 {XVID_PAR_11_VGA,QT_TRANSLATE_NOOP("xvid4","1:1 (PC)")},
72 {XVID_PAR_43_PAL,QT_TRANSLATE_NOOP("xvid4","4:3 (PAL)")},
73 {XVID_PAR_43_NTSC,QT_TRANSLATE_NOOP("xvid4","4:3 (NTSC)")},
74 {XVID_PAR_169_PAL,QT_TRANSLATE_NOOP("xvid4","16:9 (PAL)")},
75 {XVID_PAR_169_NTSC,QT_TRANSLATE_NOOP("xvid4","16:9 (NTSC)")},
76 };
77
78
79 #define PX(x) &(xvid4Settings.x)
80
81 diaElemBitrate bitrate(&(xvid4Settings.params),NULL);
82 diaElemMenu meM(PX(motionEstimation),QT_TRANSLATE_NOOP("xvid4","Motion Estimation"),4,meE);
83
84 diaElemMenu threadM(PX(nbThreads),QT_TRANSLATE_NOOP("xvid4","Threading"),4,threads);
85
86 diaElemUInteger qminM(PX(qMin),QT_TRANSLATE_NOOP("xvid4","Mi_n. quantizer:"),1,31);
87 diaElemUInteger qmaxM(PX(qMax),QT_TRANSLATE_NOOP("xvid4","Ma_x. quantizer:"),1,31);
88 /*
89 diaElemUInteger qdiffM(PX(max_qdiff),QT_TRANSLATE_NOOP("xvid4","Max. quantizer _difference:"),1,31);
90 */
91 diaElemToggle trellis(PX(trellis),QT_TRANSLATE_NOOP("xvid4","_Trellis quantization"));
92 diaElemUInteger max_b_frames(PX(maxBFrame),QT_TRANSLATE_NOOP("xvid4","_Number of B frames:"),0,32);
93
94 diaElemToggle fdrop(PX(enableFrameDrop),QT_TRANSLATE_NOOP("xvid4","_Drop identical frames (this disables B-frames)"),0);
95 diaElemUInteger fdRatio(PX(frameDropRatio),QT_TRANSLATE_NOOP("xvid4","Framedrop _Ratio:"),1,100);
96
97 diaElemMenu qzM(PX(cqmMode),QT_TRANSLATE_NOOP("xvid4","_Quantization type:"),2,qzE);
98
99 diaElemMenu rdM(PX(rdMode),QT_TRANSLATE_NOOP("xvid4","_Macroblock decision:"),5,rdE);
100
101 diaElemMenu profileM(PX(profile),QT_TRANSLATE_NOOP("xvid4","Profile:"),9,profileE);
102
103 diaElemMenu par(PX(arMode),QT_TRANSLATE_NOOP("xvid4","Aspect Ratio:"),sizeof(arModeE)/sizeof(diaMenuEntry),arModeE);
104
105 /*
106 diaElemUInteger filetol(PX(vratetol),QT_TRANSLATE_NOOP("xvid4","_Filesize tolerance (kb):"),0,100000);
107
108 diaElemFloat qzComp(PX(qcompress),QT_TRANSLATE_NOOP("xvid4","_Quantizer compression:"),0,1);
109 diaElemFloat qzBlur(PX(qblur),QT_TRANSLATE_NOOP("xvid4","Quantizer _blur:"),0,1);
110 */
111 diaElemUInteger GopSize(PX(maxKeyFrameInterval),QT_TRANSLATE_NOOP("xvid4","_Gop Size:"),1,500);
112
113 // DIVX or XVID ?
114 diaElemToggle fcc(PX(useXvidFCC),QT_TRANSLATE_NOOP("xvid4","Use XVID fcc (else DIVX)"));
115
116 /* First Tab : encoding mode */
117 diaElemFrame frameBr(QT_TRANSLATE_NOOP("xvid4","Encoding Mode"));
118 frameBr.swallow(&profileM);
119 frameBr.swallow(&bitrate);
120
121 diaElemFrame frameGop(QT_TRANSLATE_NOOP("xvid4","Frame Settings"));
122 frameGop.swallow(&max_b_frames);
123 frameGop.swallow(&fdrop);
124 frameGop.swallow(&fdRatio);
125 frameGop.swallow(&GopSize);
126
127 fdrop.link(0,&max_b_frames);
128 fdrop.link(1,&fdRatio);
129
130 diaElemFrame frameMisc(QT_TRANSLATE_NOOP("xvid4","Miscellaneous"));
131 frameMisc.swallow(&fcc);
132
133 diaElem *diaEM[]={&frameBr,&frameGop,&frameMisc};
134 diaElemTabs tabEM(QT_TRANSLATE_NOOP("xvid4","Encoding Mode"),3,diaEM);
135
136 /* 2nd Tab : Qz */
137
138 diaElem *diaQze[]={&qzM,&qminM,&qmaxM,&rdM,&meM,&trellis};
139 diaElemTabs tabQz(QT_TRANSLATE_NOOP("xvid4","Quantization"),6,diaQze);
140
141 /* 3th Tab : thread */
142 diaElem *diaThread[]={&threadM};
143 diaElemTabs tabThread(QT_TRANSLATE_NOOP("xvid4","Threads"),1,diaThread);
144
145 /**
146 * 4th tab : aspect ratio
147 * @return
148 */
149 diaElem *diaAR[]={&par};
150 diaElemTabs tabAR(QT_TRANSLATE_NOOP("xvid4","Aspect Ratio"),1,diaAR);
151
152
153 #if 0
154 diaElem *diaRC[]={&filetol,&qzComp,&qzBlur};
155 diaElemTabs tabRC(QT_TRANSLATE_NOOP("xvid4","Rate Control"),3,diaRC);
156 #endif
157 diaElemTabs *tabs[]={&tabEM,&tabQz,&tabThread,&tabAR};
158 if( diaFactoryRunTabs(QT_TRANSLATE_NOOP("xvid4","Xvid4 MPEG-4 ASP configuration"),4,tabs))
159 {
160 if(xvid4Settings.enableFrameDrop)
161 xvid4Settings.maxBFrame=0;
162 return true;
163 }
164 return false;
165 }
166