1 /***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9
10 #include "ADM_default.h"
11 #include "ADM_vp9.h"
12 #include "vp9_encoder.h"
13 #undef ADM_MINIMAL_UI_INTERFACE // we need the full UI
14 #include "DIA_factory.h"
15
16 extern vp9_encoder vp9Settings;
17
18 /**
19 * \fn vp9EncoderConfigure
20 * \brief Configuration UI for VP9 encoder
21 */
vp9EncoderConfigure(void)22 bool vp9EncoderConfigure(void)
23 {
24 vp9_encoder *cfg = &vp9Settings;
25 int spdi = cfg->speed - 9;
26
27 diaMenuEntry dltype[]={
28 {REALTIME,QT_TRANSLATE_NOOP("vp9encoder","Realtime")},
29 {GOOD_QUALITY,QT_TRANSLATE_NOOP("vp9encoder","Good quality")},
30 {BEST_QUALITY,QT_TRANSLATE_NOOP("vp9encoder","Best quality")}
31 };
32 #define PX(x) &(cfg->x)
33 diaElemBitrate bitrate(PX(ratectl),NULL);
34 diaElemReadOnlyText advice(QT_TRANSLATE_NOOP("vp9encoder","For optimal quality, select 2-pass average bitrate mode and set target bitrate to zero"),NULL);
35
36 diaElemMenu menudl(PX(deadline),QT_TRANSLATE_NOOP("vp9encoder","Deadline"),3,dltype);
37 diaElemInteger speedi(&spdi,QT_TRANSLATE_NOOP("vp9encoder","Speed"),-9,9);
38 diaElemUInteger conc(PX(nbThreads),QT_TRANSLATE_NOOP("vp9encoder","Threads"),1,VP9_ENC_MAX_THREADS);
39 diaElemToggle thrmatic(PX(autoThreads),QT_TRANSLATE_NOOP("vp9encoder","Use as many threads as CPU cores"));
40
41 thrmatic.link(0,&conc);
42
43 diaElemUInteger gopsize(PX(keyint),QT_TRANSLATE_NOOP("vp9encoder","GOP Size"),0,1000);
44 diaElemToggle range(PX(fullrange),QT_TRANSLATE_NOOP("vp9encoder","Use full color range"));
45
46 diaElemFrame frameEncMode(QT_TRANSLATE_NOOP("vp9encoder","Encoding Mode"));
47 frameEncMode.swallow(&bitrate);
48 frameEncMode.swallow(&advice);
49
50 diaElemFrame frameEncSpeed(QT_TRANSLATE_NOOP("vp9encoder","Speed vs Quality"));
51 frameEncSpeed.swallow(&speedi);
52 frameEncSpeed.swallow(&conc);
53 frameEncSpeed.swallow(&thrmatic);
54 frameEncSpeed.swallow(&menudl);
55
56 diaElemFrame frameIdr(QT_TRANSLATE_NOOP("vp9encoder","Keyframes"));
57 frameIdr.swallow(&gopsize);
58
59 diaElemFrame frameMisc(QT_TRANSLATE_NOOP("vp9encoder","Miscellaneous"));
60 frameMisc.swallow(&range);
61
62 diaElem *dialog[] = {&frameEncMode,&frameEncSpeed,&frameIdr,&frameMisc};
63 if(diaFactoryRun(QT_TRANSLATE_NOOP("vp9encoder","libvpx VP9 Encoder Configuration"),4,dialog))
64 {
65 cfg->speed=spdi+9;
66 return true;
67 }
68 return false;
69 }
70
71 // EOF
72
73