Ticket #4653: skiplooppatch_16446.diff.txt

File skiplooppatch_16446.diff.txt, 13.3 KB (added by robert.mcnamara@…, 12 years ago)

Patch updated to work with 16446 for anyone interested

Line 
1===================================================================
2--- libs/libmythtv/avformatdecoder.cpp  (revision 16446)
3+++ libs/libmythtv/avformatdecoder.cpp  (working copy)
4@@ -1487,6 +1487,7 @@
5                 vdp.SetInput(QSize(width, height));
6                 QString dec = vdp.GetDecoder();
7                 uint thread_count = vdp.GetMaxCPUs();
8+                bool skip_loop_filter = vdp.IsSkipLoopEnabled();
9                 VERBOSE(VB_PLAYBACK, QString("Using %1 CPUs for decoding")
10                         .arg(ENABLE_THREADS ? thread_count : 1));
11 
12@@ -1494,6 +1495,9 @@
13                 {
14                     avcodec_thread_init(enc, thread_count);
15                     enc->thread_count = thread_count;
16+                        if  (!skip_loop_filter)
17+                        enc->skip_loop_filter = AVDISCARD_ALL;
18+                       
19                 }
20 
21                 bool handled = false;
22Index: libs/libmythtv/videodisplayprofile.h
23===================================================================
24--- libs/libmythtv/videodisplayprofile.h        (revision 16446)
25+++ libs/libmythtv/videodisplayprofile.h        (working copy)
26@@ -84,6 +84,9 @@
27     uint GetMaxCPUs(void) const
28         { return GetPreference("pref_max_cpus").toUInt(); }
29 
30+    bool IsSkipLoopEnabled(void) const
31+        { return GetPreference("pref_skiploop").toInt(); }
32+   
33     QString GetVideoRenderer(void) const
34         { return GetPreference("pref_videorenderer"); }
35 
36@@ -125,7 +128,7 @@
37         uint grpid, uint priority,
38         QString cmp0, uint width0, uint height0,
39         QString cmp1, uint width1, uint height1,
40-        QString decoder, uint max_cpus, QString videorenderer,
41+        QString decoder, uint max_cpus, bool skiploop, QString videorenderer,
42         QString osdrenderer, bool osdfade,
43         QString deint0, QString deint1, QString filters);
44 
45Index: libs/libmythtv/videodisplayprofile.cpp
46===================================================================
47--- libs/libmythtv/videodisplayprofile.cpp      (revision 16446)
48+++ libs/libmythtv/videodisplayprofile.cpp      (working copy)
49@@ -170,6 +170,7 @@
50     QString cmp1      = Get("pref_cmp1");
51     QString decoder   = Get("pref_decoder");
52     uint    max_cpus  = Get("pref_max_cpus").toUInt();
53+    bool    skiploop  = Get("pref_skiploop").toInt();
54     QString renderer  = Get("pref_videorenderer");
55     QString osd       = Get("pref_osdrenderer");
56     QString deint0    = Get("pref_deint0");
57@@ -177,9 +178,9 @@
58     QString filter    = Get("pref_filters");
59     bool    osdfade   = Get("pref_osdfade").toInt();
60 
61-    QString str =  QString("cmp(%1%2) dec(%3) cpus(%4) rend(%5) ")
62+    QString str =  QString("cmp(%1%2) dec(%3) cpus(%4) skiploop(%5) rend(%6) ")
63         .arg(cmp0).arg(QString(cmp1.isEmpty() ? "" : ",") + cmp1)
64-        .arg(decoder).arg(max_cpus).arg(renderer);
65+        .arg(decoder).arg(max_cpus).arg((skiploop) ? "enabled" : "disabled").arg(renderer);
66     str += QString("osd(%1) osdfade(%2) deint(%3,%4) filt(%5)")
67         .arg(osd).arg((osdfade) ? "enabled" : "disabled")
68         .arg(deint0).arg(deint1).arg(filter);
69@@ -799,7 +800,7 @@
70     uint groupid, uint priority,
71     QString cmp0, uint width0, uint height0,
72     QString cmp1, uint width1, uint height1,
73-    QString decoder, uint max_cpus, QString videorenderer,
74+    QString decoder, uint max_cpus, bool skiploop, QString videorenderer,
75     QString osdrenderer, bool osdfade,
76     QString deint0, QString deint1, QString filters)
77 {
78@@ -845,6 +846,9 @@
79     queryValue += "pref_max_cpus";
80     queryData  += QString::number(max_cpus);
81 
82+    queryValue += "pref_skiploop";
83+    queryData  += (skiploop) ? "1" : "0";
84+
85     queryValue += "pref_videorenderer";
86     queryData  += videorenderer;
87 
88@@ -958,48 +962,48 @@
89     DeleteProfileGroup("CPU++", hostname);
90     uint groupid = CreateProfileGroup("CPU++", hostname);
91     CreateProfile(groupid, 1, ">", 0, 0, "", 0, 0,
92-                  "ffmpeg", 1, "xv-blit", "softblend", true,
93+                  "ffmpeg", 1, true, "xv-blit", "softblend", true,
94                   "bobdeint", "linearblend", "");
95     CreateProfile(groupid, 2, ">", 0, 0, "", 0, 0,
96-                  "ffmpeg", 1, "quartz-blit", "softblend", true,
97+                  "ffmpeg", 1, true, "quartz-blit", "softblend", true,     
98                   "linearblend", "linearblend", "");
99 
100     (void) QObject::tr("CPU+", "Sample: Hardware assist HD only");
101     DeleteProfileGroup("CPU+", hostname);
102     groupid = CreateProfileGroup("CPU+", hostname);
103     CreateProfile(groupid, 1, "<=", 720, 576, ">", 0, 0,
104-                  "ffmpeg", 1, "xv-blit", "softblend", true,
105+                  "ffmpeg", 1, true, "xv-blit", "softblend", true,
106                   "bobdeint", "linearblend", "");
107     CreateProfile(groupid, 2, "<=", 1280, 720, ">", 720, 576,
108-                  "xvmc", 1, "xvmc-blit", "opengl", true,
109+                  "xvmc", 1, true, "xvmc-blit", "opengl", true,
110                   "bobdeint", "onefield", "");
111     CreateProfile(groupid, 3, "<=", 1280, 720, ">", 720, 576,
112-                  "libmpeg2", 1, "xv-blit", "softblend", true,
113+                  "libmpeg2", 1, true, "xv-blit", "softblend", true,
114                   "bobdeint", "onefield", "");
115     CreateProfile(groupid, 4, ">", 0, 0, "", 0, 0,
116-                  "xvmc", 1, "xvmc-blit", "ia44blend", false,
117+                  "xvmc", 1, true, "xvmc-blit", "ia44blend", false,
118                   "bobdeint", "onefield", "");
119     CreateProfile(groupid, 5, ">", 0, 0, "", 0, 0,
120-                  "libmpeg2", 1, "xv-blit", "chromakey", false,
121+                  "libmpeg2", 1, true, "xv-blit", "chromakey", false,
122                   "bobdeint", "onefield", "");
123 
124     (void) QObject::tr("CPU--", "Sample: Hardware assist all");
125     DeleteProfileGroup("CPU--", hostname);
126     groupid = CreateProfileGroup("CPU--", hostname);
127     CreateProfile(groupid, 1, "<=", 720, 576, ">", 0, 0,
128-                  "ivtv", 1, "ivtv", "ivtv", true,
129+                  "ivtv", 1, true, "ivtv", "ivtv", true,
130                   "none", "none", "");
131     CreateProfile(groupid, 2, "<=", 720, 576, ">", 0, 0,
132-                  "xvmc", 1, "xvmc-blit", "ia44blend", false,
133+                  "xvmc", 1, true, "xvmc-blit", "ia44blend", false,
134                   "bobdeint", "onefield", "");
135     CreateProfile(groupid, 3, "<=", 1280, 720, ">", 720, 576,
136-                  "xvmc", 1, "xvmc-blit", "ia44blend", false,
137+                  "xvmc", 1, true, "xvmc-blit", "ia44blend", false,
138                   "bobdeint", "onefield", "");
139     CreateProfile(groupid, 4, ">", 0, 0, "", 0, 0,
140-                  "xvmc", 1, "xvmc-blit", "ia44blend", false,
141+                  "xvmc", 1, true, "xvmc-blit", "ia44blend", false,
142                   "bobdeint", "onefield", "");
143     CreateProfile(groupid, 5, ">", 0, 0, "", 0, 0,
144-                  "libmpeg2", 1, "xv-blit", "chromakey", false,
145+                  "libmpeg2", 1, true, "xv-blit", "chromakey", false,
146                   "none", "none", "");
147 }
148 
149@@ -1009,48 +1013,48 @@
150     DeleteProfileGroup("High Quality", hostname);
151     uint groupid = CreateProfileGroup("High Quality", hostname);
152     CreateProfile(groupid, 1, ">=", 1920, 1080, "", 0, 0,
153-                  "ffmpeg", 2, "xv-blit", "softblend", true,
154+                  "ffmpeg", 2, true, "xv-blit", "softblend", true,
155                   "linearblend", "linearblend", "");
156     CreateProfile(groupid, 2, ">", 0, 0, "", 0, 0,
157-                  "ffmpeg", 1, "xv-blit", "softblend", true,
158+                  "ffmpeg", 1, true, "xv-blit", "softblend", true,
159                   "yadifdoubleprocessdeint", "yadifdeint", "");
160     CreateProfile(groupid, 3, ">=", 1920, 1080, "", 0, 0,
161-                  "ffmpeg", 2, "quartz-blit", "softblend", true,
162+                  "ffmpeg", 2, true, "quartz-blit", "softblend", true,
163                   "linearblend", "linearblend", "");
164     CreateProfile(groupid, 4, ">", 0, 0, "", 0, 0,
165-                  "ffmpeg", 1, "quartz-blit", "softblend", true,
166+                  "ffmpeg", 1, true, "quartz-blit", "softblend", true,
167                   "yadifdoubleprocessdeint", "yadifdeint", "");
168 
169     (void) QObject::tr("Normal", "Sample: average quality");
170     DeleteProfileGroup("Normal", hostname);
171     groupid = CreateProfileGroup("Normal", hostname);
172     CreateProfile(groupid, 1, ">=", 1280, 720, "", 0, 0,
173-                  "ffmpeg", 1, "xv-blit", "softblend", false,
174+                  "ffmpeg", 1, true, "xv-blit", "softblend", false,
175                   "linearblend", "linearblend", "");
176     CreateProfile(groupid, 2, ">", 0, 0, "", 0, 0,
177-                  "ffmpeg", 1, "xv-blit", "softblend", true,
178+                  "ffmpeg", 1, true, "xv-blit", "softblend", true,
179                   "greedyhdoubleprocessdeint", "kerneldeint", "");
180     CreateProfile(groupid, 3, ">=", 1280, 720, "", 0, 0,
181-                  "ffmpeg", 1, "quartz-blit", "softblend", false,
182+                  "ffmpeg", 1, true, "quartz-blit", "softblend", false,
183                   "linearblend", "linearblend", "");
184     CreateProfile(groupid, 4, ">", 0, 0, "", 0, 0,
185-                  "ffmpeg", 1, "quartz-blit", "softblend", true,
186+                  "ffmpeg", 1, true, "quartz-blit", "softblend", true,
187                   "greedyhdoubleprocessdeint", "kerneldeint", "");
188 
189     (void) QObject::tr("Slim", "Sample: low CPU usage");
190     DeleteProfileGroup("Slim", hostname);
191     groupid = CreateProfileGroup("Slim", hostname);
192     CreateProfile(groupid, 1, ">=", 1280, 720, "", 0, 0,
193-                  "ffmpeg", 1, "xv-blit", "softblend", false,
194+                  "ffmpeg", 1, true, "xv-blit", "softblend", false,
195                   "onefield", "onefield", "");
196     CreateProfile(groupid, 2, ">", 0, 0, "", 0, 0,
197-                  "ffmpeg", 1, "xv-blit", "softblend", true,
198+                  "ffmpeg", 1, true, "xv-blit", "softblend", true,
199                   "linearblend", "linearblend", "");
200     CreateProfile(groupid, 3, ">=", 1280, 720, "", 0, 0,
201-                  "ffmpeg", 1, "quartz-blit", "softblend", false,
202+                  "ffmpeg", 1, true, "quartz-blit", "softblend", false,
203                   "onefield", "onefield", "");
204     CreateProfile(groupid, 4, ">", 0, 0, "", 0, 0,
205-                  "ffmpeg", 1, "quartz-blit", "softblend", true,
206+                  "ffmpeg", 1, true, "quartz-blit", "softblend", true,
207                   "linearblend", "linearblend", "");
208 }
209 
210Index: programs/mythfrontend/globalsettings.cpp
211===================================================================
212--- programs/mythfrontend/globalsettings.cpp    (revision 16446)
213+++ programs/mythfrontend/globalsettings.cpp    (working copy)
214@@ -846,6 +846,7 @@
215     height[1] = new TransSpinBoxSetting(0, 1088, 64, true);
216     decoder   = new TransComboBoxSetting();
217     max_cpus  = new TransSpinBoxSetting(1, ENABLE_THREADS ? 4 : 1, 1, true);
218+    skiploop  = new TransCheckBoxSetting();
219     vidrend   = new TransComboBoxSetting();
220     osdrend   = new TransComboBoxSetting();
221     osdfade   = new TransCheckBoxSetting();
222@@ -877,6 +878,7 @@
223 
224     decoder->setLabel(tr("Decoder"));
225     max_cpus->setLabel(tr("Max CPUs"));
226+    skiploop->setLabel(tr("Loopfilter"));
227     vidrend->setLabel(tr("Video Renderer"));
228     osdrend->setLabel(tr("OSD Renderer"));
229     osdfade->setLabel(tr("OSD Fade"));
230@@ -894,6 +896,12 @@
231     filters->setHelpText(
232         QObject::tr("Example Custom filter list: 'ivtc,denoise3d'"));
233 
234+    skiploop->setHelpText(
235+        tr("When unchecked the deblocking loopfilter will be disabled "
236+           "for h264 decoding.") + "\n" +
237+        tr("Disabling will significantly reduce the load on the CPU "
238+           "when watching HD h264."));
239+
240     osdfade->setHelpText(
241         tr("When unchecked the OSD will not fade away but instead "
242            "will disappear abruptly.") + "\n" +
243@@ -902,7 +910,7 @@
244 
245     vid_row->addChild(decoder);
246     vid_row->addChild(max_cpus);
247-
248+    vid_row->addChild(skiploop);
249     osd_row->addChild(vidrend);
250     osd_row->addChild(osdrend);
251     osd_row->addChild(osdfade);
252@@ -955,6 +963,7 @@
253 
254     QString pdecoder  = item.Get("pref_decoder");
255     QString pmax_cpus = item.Get("pref_max_cpus");
256+    QString pskiploop  = item.Get("pref_skiploop");
257     QString prenderer = item.Get("pref_videorenderer");
258     QString posd      = item.Get("pref_osdrenderer");
259     QString posdfade  = item.Get("pref_osdfade");
260@@ -982,6 +991,9 @@
261 
262     if (!pmax_cpus.isEmpty())
263         max_cpus->setValue(pmax_cpus.toUInt());
264+
265+    skiploop->setValue((!pskiploop.isEmpty()) ? (bool) pskiploop.toInt() : true);
266+
267     if (!prenderer.isEmpty())
268         vidrend->setValue(prenderer);
269     if (!posd.isEmpty())
270@@ -1015,6 +1027,7 @@
271 
272     item.Set("pref_decoder",       decoder->getValue());
273     item.Set("pref_max_cpus",      max_cpus->getValue());
274+    item.Set("pref_skiploop",       (skiploop->boolValue()) ? "1" : "0");
275     item.Set("pref_videorenderer", vidrend->getValue());
276     item.Set("pref_osdrenderer",   osdrend->getValue());
277     item.Set("pref_osdfade",       (osdfade->boolValue()) ? "1" : "0");
278Index: programs/mythfrontend/globalsettings.h
279===================================================================
280--- programs/mythfrontend/globalsettings.h      (revision 16446)
281+++ programs/mythfrontend/globalsettings.h      (working copy)
282@@ -87,6 +87,7 @@
283     TransSpinBoxSetting  *height[2];
284     TransComboBoxSetting *decoder;
285     TransSpinBoxSetting  *max_cpus;
286+    TransCheckBoxSetting *skiploop;
287     TransComboBoxSetting *vidrend;
288     TransComboBoxSetting *osdrend;
289     TransCheckBoxSetting *osdfade;