[VideoEnhancement] add entry vertical_dejagging, smooth
authorhschang <chang@dev3>
Mon, 10 Mar 2014 04:54:43 +0000 (13:54 +0900)
committerhschang <chang@dev3>
Mon, 17 Mar 2014 09:04:17 +0000 (18:04 +0900)
lib/python/Plugins/SystemPlugins/VideoEnhancement/VideoEnhancement.py
lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py

index 4ba4958..45e129c 100755 (executable)
@@ -1,4 +1,4 @@
-from Components.config import config, ConfigSubsection, ConfigSlider, ConfigSelection, ConfigNothing, NoSave
+from Components.config import config, ConfigSubsection, ConfigSlider, ConfigSelection, ConfigBoolean, ConfigNothing, NoSave
 from Tools.CList import CList
 from os import path as os_path
 # The "VideoEnhancement" is the interface to /proc/stb/vmpeg/0.
@@ -258,6 +258,40 @@ class VideoEnhancement:
                        else:
                                config.av.scaler_sharpness = NoSave(ConfigNothing())
 
+               if os_path.exists("/proc/stb/vmpeg/0/pep_scaler_vertical_dejagging"):
+                       def setScaler_vertical_dejagging(configElement):
+                               myval = configElement.value and "enable" or "disable"
+                               try:
+                                       print "--> setting scaler_vertical_dejagging to: %s" % myval
+                                       open("/proc/stb/vmpeg/0/pep_scaler_vertical_dejagging", "w").write(myval)
+                               except IOError:
+                                       print "couldn't write pep_scaler_vertical_dejagging."
+
+                               if not VideoEnhancement.firstRun:
+                                       self.setConfiguredValues()
+
+                       config.pep.scaler_vertical_dejagging = ConfigBoolean(default=False, descriptions = {False: "Disable", True: "Enable"} )
+                       config.pep.scaler_vertical_dejagging.addNotifier(setScaler_vertical_dejagging)
+               else:
+                       config.pep.scaler_vertical_dejagging = NoSave(ConfigNothing())
+
+               if os_path.exists("/proc/stb/vmpeg/0/smooth"):
+                       def setSmooth(configElement):
+                               myval = configElement.value and "enable" or "disable"
+                               try:
+                                       print "--> setting smooth to: %s" % myval
+                                       open("/proc/stb/vmpeg/0/smooth", "w").write(myval)
+                               except IOError:
+                                       print "couldn't write smooth."
+
+                               if not VideoEnhancement.firstRun:
+                                       self.setConfiguredValues()
+
+                       config.pep.smooth = ConfigBoolean(default=False, descriptions = {False: "Disable", True: "Enable"} )
+                       config.pep.smooth.addNotifier(setSmooth)
+               else:
+                       config.pep.smooth = NoSave(ConfigNothing())
+
                if VideoEnhancement.firstRun:
                        self.setConfiguredValues()
 
index cde3930..a568ac1 100644 (file)
@@ -66,6 +66,8 @@ class VideoEnhancementSetup(Screen, ConfigListScreen):
                self.oldMosquito_noise = config.pep.mosquito_noise_reduction.value
                self.oldDigital_contour = config.pep.digital_contour_removal.value
                self.oldScaler_sharpness = config.av.scaler_sharpness.value
+               self.oldScaler_vertical_dejagging = config.pep.scaler_vertical_dejagging.value
+               self.oldSmooth = config.pep.smooth.value
                self.oldSplit = config.pep.split.value
                self.oldSharpness = config.pep.sharpness.value
                self.oldAuto_flesh = config.pep.auto_flesh.value
@@ -91,6 +93,8 @@ class VideoEnhancementSetup(Screen, ConfigListScreen):
                self.hueEntry = addToConfigList(_("Hue"), config.pep.hue)
                self.brightnessEntry = addToConfigList(_("Brightness"), config.pep.brightness)
                self.scaler_sharpnessEntry = addToConfigList(_("Scaler sharpness"), config.av.scaler_sharpness)
+               self.scaler_vertical_dejaggingEntry = addToConfigList(_("Scaler vertical dejagging"), config.pep.scaler_vertical_dejagging)
+               self.smoothEntry = addToConfigList(_("Smooth"), config.pep.smooth)
                self.splitEntry = addToConfigList(_("Split preview mode"), config.pep.split, True)
                add_to_xtdlist = self.splitEntry is not None
                self.sharpnessEntry = addToConfigList(_("Sharpness"), config.pep.sharpness, add_to_xtdlist)
@@ -120,6 +124,8 @@ class VideoEnhancementSetup(Screen, ConfigListScreen):
                current = self["config"].getCurrent()
                if current == self.splitEntry:
                        ConfigListScreen.keyLeft(self)
+               elif (current == self.scaler_vertical_dejaggingEntry) or (current == self.smoothEntry):
+                       ConfigListScreen.keyLeft(self)
                elif current != self.splitEntry and current in self.xtdlist:
                        self.previewlist = [
                                current,
@@ -138,6 +144,8 @@ class VideoEnhancementSetup(Screen, ConfigListScreen):
                current = self["config"].getCurrent()
                if current == self.splitEntry:
                        ConfigListScreen.keyRight(self)
+               elif (current == self.scaler_vertical_dejaggingEntry) or (current == self.smoothEntry):
+                       ConfigListScreen.keyRight(self)
                elif current != self.splitEntry and current in self.xtdlist:
                        self.previewlist = [
                                current,
@@ -152,6 +160,7 @@ class VideoEnhancementSetup(Screen, ConfigListScreen):
                        maxvalue = current[1].max
                        self.session.openWithCallback(self.PreviewClosed, VideoEnhancementPreview, configEntry = self.previewlist, oldSplitMode = None, maxValue = maxvalue)
 
+
        def confirm(self, confirmed):
                if not confirmed:
                        print "not confirmed"
@@ -195,6 +204,10 @@ class VideoEnhancementSetup(Screen, ConfigListScreen):
                                config.pep.digital_contour_removal.setValue(self.oldDigital_contour)
                        if self.scaler_sharpnessEntry is not None:
                                config.av.scaler_sharpness.setValue(self.oldScaler_sharpness)
+                       if self.scaler_vertical_dejaggingEntry is not None:
+                               config.pep.scaler_vertical_dejagging.setValue(self.oldScaler_vertical_dejagging)
+                       if self.smoothEntry is not None:
+                               config.pep.smooth.setValue(self.oldSmooth)
                        if self.splitEntry is not None:
                                config.pep.split.setValue('off')
                        if self.sharpnessEntry is not None:
@@ -232,6 +245,10 @@ class VideoEnhancementSetup(Screen, ConfigListScreen):
                                config.pep.digital_contour_removal.setValue(0)
                        if self.scaler_sharpnessEntry is not None:
                                config.av.scaler_sharpness.setValue(13)
+                       if self.scaler_vertical_dejaggingEntry is not None:
+                               config.pep.scaler_vertical_dejagging.setValue(False)
+                       if self.smoothEntry is not None:
+                               config.pep.smooth.setValue(False)
                        if self.splitEntry is not None:
                                config.pep.split.setValue('off')
                        if self.sharpnessEntry is not None: