Ticket #4653: 26_updated_skiploop_options.dpatch

File 26_updated_skiploop_options.dpatch, 14.3 KB (added by anonymous, 11 years ago)
Line 
1#! /bin/sh /usr/share/dpatch/dpatch-run
2## 26_updated_skiploop_options.dpatch by John Reid <reidjr_at_lineone.net>
3## WAS: 25_skiploop_option.dpatch by Michael Haas <laga@laga.ath.cx>
4##
5## All lines beginning with `## DP:' are a description of the patch.
6## DP: Add a checkbox to disable the deblocking loop filter for h.264 ffmpeg.
7## DP: Enable this checkbox to reduce CPU usage when playing h.264 content.
8## DP: Original patch by reidjr_at_lineone_net, updated by Robert Mcnamara
9## DP: Updated by reidjr_at_lineone_net, against mythtv-0.22.0~trunk21644
10
11@DPATCH@
12
13diff -urNad mythtv-0.22.0~trunk21644~/libs/libmythtv/avformatdecoder.cpp mythtv-0.22.0~trunk21644/libs/libmythtv/avformatdecoder.cpp
14--- mythtv-0.22.0~trunk21644~/libs/libmythtv/avformatdecoder.cpp        2009-09-01 23:49:21.000000000 +0100
15+++ mythtv-0.22.0~trunk21644/libs/libmythtv/avformatdecoder.cpp 2009-09-03 23:04:23.000000000 +0100
16@@ -1625,8 +1625,13 @@
17                     vdp.SetInput(QSize(width, height));
18                     dec = vdp.GetDecoder();
19                     thread_count = vdp.GetMaxCPUs();
20+                    bool skip_loop_filter = vdp.IsSkipLoopEnabled();
21+                    if  (!skip_loop_filter)
22+                    {
23+                    enc->skip_loop_filter = AVDISCARD_ALL;
24+                    } 
25                 }
26
27                 bool handled = false;
28                 if (!using_null_videoout && mpeg_version(enc->codec_id))
29                 {
30diff -urNad mythtv-0.22.0~trunk21644~/libs/libmythtv/videodisplayprofile.cpp mythtv-0.22.0~trunk21644/libs/libmythtv/videodisplayprofile.cpp
31--- mythtv-0.22.0~trunk21644~/libs/libmythtv/videodisplayprofile.cpp    2009-08-28 04:03:19.000000000 +0100
32+++ mythtv-0.22.0~trunk21644/libs/libmythtv/videodisplayprofile.cpp     2009-09-03 23:03:02.000000000 +0100
33@@ -175,6 +175,7 @@
34     QString cmp1      = Get("pref_cmp1");
35     QString decoder   = Get("pref_decoder");
36     uint    max_cpus  = Get("pref_max_cpus").toUInt();
37+    bool    skiploop  = Get("pref_skiploop").toInt();
38     QString renderer  = Get("pref_videorenderer");
39     QString osd       = Get("pref_osdrenderer");
40     QString deint0    = Get("pref_deint0");
41@@ -182,9 +183,9 @@
42     QString filter    = Get("pref_filters");
43     bool    osdfade   = Get("pref_osdfade").toInt();
44 
45-    QString str =  QString("cmp(%1%2) dec(%3) cpus(%4) rend(%5) ")
46+    QString str =  QString("cmp(%1%2) dec(%3) cpus(%4) skiploop(%5) rend(%6) ")
47         .arg(cmp0).arg(QString(cmp1.isEmpty() ? "" : ",") + cmp1)
48-        .arg(decoder).arg(max_cpus).arg(renderer);
49+        .arg(decoder).arg(max_cpus).arg((skiploop) ? "enabled" : "disabled").arg(renderer);
50     str += QString("osd(%1) osdfade(%2) deint(%3,%4) filt(%5)")
51         .arg(osd).arg((osdfade) ? "enabled" : "disabled")
52         .arg(deint0).arg(deint1).arg(filter);
53@@ -858,7 +859,7 @@
54     uint groupid, uint priority,
55     QString cmp0, uint width0, uint height0,
56     QString cmp1, uint width1, uint height1,
57-    QString decoder, uint max_cpus, QString videorenderer,
58+    QString decoder, uint max_cpus, bool skiploop, QString videorenderer,
59     QString osdrenderer, bool osdfade,
60     QString deint0, QString deint1, QString filters)
61 {
62@@ -904,6 +905,9 @@
63     queryValue += "pref_max_cpus";
64     queryData  += QString::number(max_cpus);
65 
66+    queryValue += "pref_skiploop";
67+    queryData  += (skiploop) ? "1" : "0";
68+
69     queryValue += "pref_videorenderer";
70     queryData  += videorenderer;
71 
72@@ -1017,48 +1021,48 @@
73     DeleteProfileGroup("CPU++", hostname);
74     uint groupid = CreateProfileGroup("CPU++", hostname);
75     CreateProfile(groupid, 1, ">", 0, 0, "", 0, 0,
76-                  "ffmpeg", 1, "xv-blit", "softblend", true,
77+                  "ffmpeg", 1, true, "xv-blit", "softblend", true,
78                   "bobdeint", "linearblend", "");
79     CreateProfile(groupid, 2, ">", 0, 0, "", 0, 0,
80-                  "ffmpeg", 1, "quartz-blit", "softblend", true,
81+                  "ffmpeg", 1, true, "quartz-blit", "softblend", true,     
82                   "linearblend", "linearblend", "");
83 
84     (void) QObject::tr("CPU+", "Sample: Hardware assist HD only");
85     DeleteProfileGroup("CPU+", hostname);
86     groupid = CreateProfileGroup("CPU+", hostname);
87     CreateProfile(groupid, 1, "<=", 720, 576, ">", 0, 0,
88-                  "ffmpeg", 1, "xv-blit", "softblend", true,
89+                  "ffmpeg", 1, true, "xv-blit", "softblend", true,
90                   "bobdeint", "linearblend", "");
91     CreateProfile(groupid, 2, "<=", 1280, 720, ">", 720, 576,
92-                  "xvmc", 1, "xvmc-blit", "opengl", true,
93+                  "xvmc", 1, true, "xvmc-blit", "opengl", true,
94                   "bobdeint", "onefield", "");
95     CreateProfile(groupid, 3, "<=", 1280, 720, ">", 720, 576,
96-                  "libmpeg2", 1, "xv-blit", "softblend", true,
97+                  "libmpeg2", 1, true, "xv-blit", "softblend", true,
98                   "bobdeint", "onefield", "");
99     CreateProfile(groupid, 4, ">", 0, 0, "", 0, 0,
100-                  "xvmc", 1, "xvmc-blit", "ia44blend", false,
101+                  "xvmc", 1, true, "xvmc-blit", "ia44blend", false,
102                   "bobdeint", "onefield", "");
103     CreateProfile(groupid, 5, ">", 0, 0, "", 0, 0,
104-                  "libmpeg2", 1, "xv-blit", "chromakey", false,
105+                  "libmpeg2", 1, true, "xv-blit", "chromakey", false,
106                   "bobdeint", "onefield", "");
107 
108     (void) QObject::tr("CPU--", "Sample: Hardware assist all");
109     DeleteProfileGroup("CPU--", hostname);
110     groupid = CreateProfileGroup("CPU--", hostname);
111     CreateProfile(groupid, 1, "<=", 720, 576, ">", 0, 0,
112-                  "ivtv", 1, "ivtv", "ivtv", true,
113+                  "ivtv", 1, true, "ivtv", "ivtv", true,
114                   "none", "none", "");
115     CreateProfile(groupid, 2, "<=", 720, 576, ">", 0, 0,
116-                  "xvmc", 1, "xvmc-blit", "ia44blend", false,
117+                  "xvmc", 1, true, "xvmc-blit", "ia44blend", false,
118                   "bobdeint", "onefield", "");
119     CreateProfile(groupid, 3, "<=", 1280, 720, ">", 720, 576,
120-                  "xvmc", 1, "xvmc-blit", "ia44blend", false,
121+                  "xvmc", 1, true, "xvmc-blit", "ia44blend", false,
122                   "bobdeint", "onefield", "");
123     CreateProfile(groupid, 4, ">", 0, 0, "", 0, 0,
124-                  "xvmc", 1, "xvmc-blit", "ia44blend", false,
125+                  "xvmc", 1, true, "xvmc-blit", "ia44blend", false,
126                   "bobdeint", "onefield", "");
127     CreateProfile(groupid, 5, ">", 0, 0, "", 0, 0,
128-                  "libmpeg2", 1, "xv-blit", "chromakey", false,
129+                  "libmpeg2", 1, true, "xv-blit", "chromakey", false,
130                   "none", "none", "");
131 }
132 
133@@ -1068,48 +1072,48 @@
134     DeleteProfileGroup("High Quality", hostname);
135     uint groupid = CreateProfileGroup("High Quality", hostname);
136     CreateProfile(groupid, 1, ">=", 1920, 1080, "", 0, 0,
137-                  "ffmpeg", 2, "xv-blit", "softblend", true,
138+                  "ffmpeg", 2, true, "xv-blit", "softblend", true,
139                   "linearblend", "linearblend", "");
140     CreateProfile(groupid, 2, ">", 0, 0, "", 0, 0,
141-                  "ffmpeg", 1, "xv-blit", "softblend", true,
142+                  "ffmpeg", 1, true, "xv-blit", "softblend", true,
143                   "yadifdoubleprocessdeint", "yadifdeint", "");
144     CreateProfile(groupid, 3, ">=", 1920, 1080, "", 0, 0,
145-                  "ffmpeg", 2, "quartz-blit", "softblend", true,
146+                  "ffmpeg", 2, true, "quartz-blit", "softblend", true,
147                   "linearblend", "linearblend", "");
148     CreateProfile(groupid, 4, ">", 0, 0, "", 0, 0,
149-                  "ffmpeg", 1, "quartz-blit", "softblend", true,
150+                  "ffmpeg", 1, true, "quartz-blit", "softblend", true,
151                   "yadifdoubleprocessdeint", "yadifdeint", "");
152 
153     (void) QObject::tr("Normal", "Sample: average quality");
154     DeleteProfileGroup("Normal", hostname);
155     groupid = CreateProfileGroup("Normal", hostname);
156     CreateProfile(groupid, 1, ">=", 1280, 720, "", 0, 0,
157-                  "ffmpeg", 1, "xv-blit", "softblend", false,
158+                  "ffmpeg", 1, true, "xv-blit", "softblend", false,
159                   "linearblend", "linearblend", "");
160     CreateProfile(groupid, 2, ">", 0, 0, "", 0, 0,
161-                  "ffmpeg", 1, "xv-blit", "softblend", true,
162+                  "ffmpeg", 1, true, "xv-blit", "softblend", true,
163                   "greedyhdoubleprocessdeint", "kerneldeint", "");
164     CreateProfile(groupid, 3, ">=", 1280, 720, "", 0, 0,
165-                  "ffmpeg", 1, "quartz-blit", "softblend", false,
166+                  "ffmpeg", 1, true, "quartz-blit", "softblend", false,
167                   "linearblend", "linearblend", "");
168     CreateProfile(groupid, 4, ">", 0, 0, "", 0, 0,
169-                  "ffmpeg", 1, "quartz-blit", "softblend", true,
170+                  "ffmpeg", 1, true, "quartz-blit", "softblend", true,
171                   "greedyhdoubleprocessdeint", "kerneldeint", "");
172 
173     (void) QObject::tr("Slim", "Sample: low CPU usage");
174     DeleteProfileGroup("Slim", hostname);
175     groupid = CreateProfileGroup("Slim", hostname);
176     CreateProfile(groupid, 1, ">=", 1280, 720, "", 0, 0,
177-                  "ffmpeg", 1, "xv-blit", "softblend", false,
178+                  "ffmpeg", 1, true, "xv-blit", "softblend", false,
179                   "onefield", "onefield", "");
180     CreateProfile(groupid, 2, ">", 0, 0, "", 0, 0,
181-                  "ffmpeg", 1, "xv-blit", "softblend", true,
182+                  "ffmpeg", 1, true, "xv-blit", "softblend", true,
183                   "linearblend", "linearblend", "");
184     CreateProfile(groupid, 3, ">=", 1280, 720, "", 0, 0,
185-                  "ffmpeg", 1, "quartz-blit", "softblend", false,
186+                  "ffmpeg", 1, true, "quartz-blit", "softblend", false,
187                   "onefield", "onefield", "");
188     CreateProfile(groupid, 4, ">", 0, 0, "", 0, 0,
189-                  "ffmpeg", 1, "quartz-blit", "softblend", true,
190+                  "ffmpeg", 1, true, "quartz-blit", "softblend", true,
191                   "linearblend", "linearblend", "");
192 }
193 
194
195diff -urNad mythtv-0.22.0~trunk21644~/libs/libmythtv/videodisplayprofile.h mythtv-0.22.0~trunk21644/libs/libmythtv/videodisplayprofile.h
196--- mythtv-0.22.0~trunk21644~/libs/libmythtv/videodisplayprofile.h      2009-06-12 04:06:23.000000000 +0100
197+++ mythtv-0.22.0~trunk21644/libs/libmythtv/videodisplayprofile.h       2009-09-03 23:03:02.000000000 +0100
198@@ -84,6 +84,9 @@
199     uint GetMaxCPUs(void) const
200         { return GetPreference("pref_max_cpus").toUInt(); }
201 
202+    bool IsSkipLoopEnabled(void) const
203+        { return GetPreference("pref_skiploop").toInt(); }
204+   
205     QString GetVideoRenderer(void) const
206         { return GetPreference("pref_videorenderer"); }
207 
208@@ -125,7 +128,7 @@
209         uint grpid, uint priority,
210         QString cmp0, uint width0, uint height0,
211         QString cmp1, uint width1, uint height1,
212-        QString decoder, uint max_cpus, QString videorenderer,
213+        QString decoder, uint max_cpus, bool skiploop, QString videorenderer,
214         QString osdrenderer, bool osdfade,
215         QString deint0, QString deint1, QString filters);
216 
217diff -urNad mythtv-0.22.0~trunk21644~/programs/mythfrontend/globalsettings.cpp mythtv-0.22.0~trunk21644/programs/mythfrontend/globalsettings.cpp
218--- mythtv-0.22.0~trunk21644~/programs/mythfrontend/globalsettings.cpp  2009-08-28 04:03:20.000000000 +0100
219+++ mythtv-0.22.0~trunk21644/programs/mythfrontend/globalsettings.cpp   2009-09-03 23:05:05.000000000 +0100
220@@ -853,6 +853,7 @@
221     height[1] = new TransSpinBoxSetting(0, 1088, 64, true);
222     decoder   = new TransComboBoxSetting();
223     max_cpus  = new TransSpinBoxSetting(1, HAVE_THREADS ? 4 : 1, 1, true);
224+    skiploop  = new TransCheckBoxSetting();
225     vidrend   = new TransComboBoxSetting();
226     osdrend   = new TransComboBoxSetting();
227     osdfade   = new TransCheckBoxSetting();
228@@ -884,6 +885,7 @@
229 
230     decoder->setLabel(tr("Decoder"));
231     max_cpus->setLabel(tr("Max CPUs"));
232+    skiploop->setLabel(tr("Loopfilter"));
233     vidrend->setLabel(tr("Video Renderer"));
234     osdrend->setLabel(tr("OSD Renderer"));
235     osdfade->setLabel(tr("OSD Fade"));
236@@ -901,6 +903,12 @@
237     filters->setHelpText(
238         QObject::tr("Example Custom filter list: 'ivtc,denoise3d'"));
239 
240+    skiploop->setHelpText(
241+        tr("When unchecked the deblocking loopfilter will be disabled "
242+           "for h264 decoding.") + "\n" +
243+        tr("Disabling will significantly reduce the load on the CPU "
244+           "when watching HD h264."));
245+
246     osdfade->setHelpText(
247         tr("When unchecked the OSD will not fade away but instead "
248            "will disappear abruptly.") + "\n" +
249@@ -909,7 +917,7 @@
250 
251     vid_row->addChild(decoder);
252     vid_row->addChild(max_cpus);
253-
254+    vid_row->addChild(skiploop);
255     osd_row->addChild(vidrend);
256     osd_row->addChild(osdrend);
257     osd_row->addChild(osdfade);
258@@ -962,6 +970,7 @@
259 
260     QString pdecoder  = item.Get("pref_decoder");
261     QString pmax_cpus = item.Get("pref_max_cpus");
262+    QString pskiploop  = item.Get("pref_skiploop");
263     QString prenderer = item.Get("pref_videorenderer");
264     QString posd      = item.Get("pref_osdrenderer");
265     QString posdfade  = item.Get("pref_osdfade");
266@@ -989,6 +998,9 @@
267 
268     if (!pmax_cpus.isEmpty())
269         max_cpus->setValue(pmax_cpus.toUInt());
270+
271+    skiploop->setValue((!pskiploop.isEmpty()) ? (bool) pskiploop.toInt() : true);
272+
273     if (!prenderer.isEmpty())
274         vidrend->setValue(prenderer);
275     if (!posd.isEmpty())
276@@ -1022,6 +1034,7 @@
277 
278     item.Set("pref_decoder",       decoder->getValue());
279     item.Set("pref_max_cpus",      max_cpus->getValue());
280+    item.Set("pref_skiploop",       (skiploop->boolValue()) ? "1" : "0");
281     item.Set("pref_videorenderer", vidrend->getValue());
282     item.Set("pref_osdrenderer",   osdrend->getValue());
283     item.Set("pref_osdfade",       (osdfade->boolValue()) ? "1" : "0");
284
285diff -urNad mythtv-0.22.0~trunk21644~/programs/mythfrontend/globalsettings.h mythtv-0.22.0~trunk21644/programs/mythfrontend/globalsettings.h
286--- mythtv-0.22.0~trunk21644~/programs/mythfrontend/globalsettings.h    2009-04-17 04:07:04.000000000 +0100
287+++ mythtv-0.22.0~trunk21644/programs/mythfrontend/globalsettings.h     2009-09-03 23:03:02.000000000 +0100
288@@ -87,6 +87,7 @@
289     TransSpinBoxSetting  *height[2];
290     TransComboBoxSetting *decoder;
291     TransSpinBoxSetting  *max_cpus;
292+    TransCheckBoxSetting *skiploop;
293     TransComboBoxSetting *vidrend;
294     TransComboBoxSetting *osdrend;
295     TransCheckBoxSetting *osdfade;