/SystemPlugins/VideoEnhancement: allow configuration of block_noise_reduction, mosqui...
authoracid-burn <acidburn@opendreambox.org>
Mon, 21 Sep 2009 16:10:26 +0000 (18:10 +0200)
committeracid-burn <acidburn@opendreambox.org>
Mon, 21 Sep 2009 16:10:26 +0000 (18:10 +0200)
digital_contour_removal also on dm800

lib/python/Plugins/SystemPlugins/VideoEnhancement/VideoEnhancement.py
lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py

index a9e8d57f1d290076a284e7b30a7b5ad6239db104..f7c5cfb96b74a935dcbb0d714d853e7852b5021b 100755 (executable)
@@ -74,6 +74,48 @@ class VideoEnhancement:
                config.pep.brightness = ConfigSlider(default=128, limits=(0,256))
                config.pep.brightness.addNotifier(setBrightness)
 
+               def setBlock_noise_reduction(config):
+                       myval = int(config.value)
+                       try:
+                               print "--> setting block_noise_reduction to: %0.8X" % myval
+                               open("/proc/stb/vmpeg/0/pep_block_noise_reduction", "w").write("%0.8X" % myval)
+                       except IOError:
+                               print "couldn't write pep_block_noise_reduction."
+
+                       if VideoEnhancement.firstRun is False:
+                               self.setConfiguredValues()
+
+               config.pep.block_noise_reduction = ConfigSlider(default=0, limits=(0,5))
+               config.pep.block_noise_reduction.addNotifier(setBlock_noise_reduction)
+
+               def setMosquito_noise_reduction(config):
+                       myval = int(config.value)
+                       try:
+                               print "--> setting mosquito_noise_reduction to: %0.8X" % myval
+                               open("/proc/stb/vmpeg/0/pep_mosquito_noise_reduction", "w").write("%0.8X" % myval)
+                       except IOError:
+                               print "couldn't write pep_mosquito_noise_reduction."
+
+                       if VideoEnhancement.firstRun is False:
+                               self.setConfiguredValues()
+
+               config.pep.mosquito_noise_reduction = ConfigSlider(default=0, limits=(0,5))
+               config.pep.mosquito_noise_reduction.addNotifier(setMosquito_noise_reduction)
+
+               def setDigital_contour_removal(config):
+                       myval = int(config.value)
+                       try:
+                               print "--> setting digital_contour_removal to: %0.8X" % myval
+                               open("/proc/stb/vmpeg/0/pep_digital_contour_removal", "w").write("%0.8X" % myval)
+                       except IOError:
+                               print "couldn't write pep_digital_contour_removal."
+
+                       if VideoEnhancement.firstRun is False:
+                               self.setConfiguredValues()
+
+               config.pep.digital_contour_removal = ConfigSlider(default=0, limits=(0,5))
+               config.pep.digital_contour_removal.addNotifier(setDigital_contour_removal)
+
                if hw_type == 'dm8000':
                        def setSplitMode(config):
                                try:
@@ -148,48 +190,6 @@ class VideoEnhancement:
                        config.pep.blue_boost = ConfigSlider(default=0, limits=(0,4))
                        config.pep.blue_boost.addNotifier(setBlueboost)
 
-                       def setBlock_noise_reduction(config):
-                               myval = int(config.value)
-                               try:
-                                       print "--> setting block_noise_reduction to: %0.8X" % myval
-                                       open("/proc/stb/vmpeg/0/pep_block_noise_reduction", "w").write("%0.8X" % myval)
-                               except IOError:
-                                       print "couldn't write pep_block_noise_reduction."
-
-                               if VideoEnhancement.firstRun is False:
-                                       self.setConfiguredValues()
-
-                       config.pep.block_noise_reduction = ConfigSlider(default=0, limits=(0,5))
-                       config.pep.block_noise_reduction.addNotifier(setBlock_noise_reduction)
-
-                       def setMosquito_noise_reduction(config):
-                               myval = int(config.value)
-                               try:
-                                       print "--> setting mosquito_noise_reduction to: %0.8X" % myval
-                                       open("/proc/stb/vmpeg/0/pep_mosquito_noise_reduction", "w").write("%0.8X" % myval)
-                               except IOError:
-                                       print "couldn't write pep_mosquito_noise_reduction."
-
-                               if VideoEnhancement.firstRun is False:
-                                       self.setConfiguredValues()
-
-                       config.pep.mosquito_noise_reduction = ConfigSlider(default=0, limits=(0,5))
-                       config.pep.mosquito_noise_reduction.addNotifier(setMosquito_noise_reduction)
-
-                       def setDigital_contour_removal(config):
-                               myval = int(config.value)
-                               try:
-                                       print "--> setting digital_contour_removal to: %0.8X" % myval
-                                       open("/proc/stb/vmpeg/0/pep_digital_contour_removal", "w").write("%0.8X" % myval)
-                               except IOError:
-                                       print "couldn't write pep_digital_contour_removal."
-
-                               if VideoEnhancement.firstRun is False:
-                                       self.setConfiguredValues()
-
-                       config.pep.digital_contour_removal = ConfigSlider(default=0, limits=(0,5))
-                       config.pep.digital_contour_removal.addNotifier(setDigital_contour_removal)
-
                        def setDynamic_contrast(config):
                                myval = int(config.value)
                                try:
index 03fbe95ce3b9c2613c301700bcec7d7fd20e2ef8..1939e2d514a4bf5f652c0470f226b6a142d1987c 100755 (executable)
@@ -95,15 +95,15 @@ class VideoEnhancementSetup(Screen, ConfigListScreen):
                self.oldSaturation = config.pep.saturation.value
                self.oldHue = config.pep.hue.value
                self.oldBrightness = config.pep.brightness.value
+               self.oldBlock_noise = config.pep.block_noise_reduction.value
+               self.oldMosquito_noise = config.pep.mosquito_noise_reduction.value
+               self.oldDigital_contour = config.pep.digital_contour_removal.value
                if self.hw_type == 'dm8000':
                        self.oldSplit = config.pep.split.value
                        self.oldSharpness = config.pep.sharpness.value
                        self.oldAuto_flesh = config.pep.auto_flesh.value
                        self.oldGreen_boost = config.pep.green_boost.value
                        self.oldBlue_boost = config.pep.blue_boost.value
-                       self.oldBlock_noise = config.pep.block_noise_reduction.value
-                       self.oldMosquito_noise = config.pep.mosquito_noise_reduction.value
-                       self.oldDigital_contour = config.pep.digital_contour_removal.value
                        self.oldDynamic_contrast = config.pep.dynamic_contrast.value
 
        def createSetup(self):
@@ -111,6 +111,9 @@ class VideoEnhancementSetup(Screen, ConfigListScreen):
                self.saturationEntry = getConfigListEntry(_("Saturation"), config.pep.saturation)
                self.hueEntry = getConfigListEntry(_("Hue"), config.pep.hue)
                self.brightnessEntry = getConfigListEntry(_("Brightness"), config.pep.brightness)
+               self.block_noise_reductionEntry = getConfigListEntry(_("Block noise reduction"), config.pep.block_noise_reduction)
+               self.mosquito_noise_reductionEntry = getConfigListEntry(_("Mosquito noise reduction"), config.pep.mosquito_noise_reduction)
+               self.digital_contour_removalEntry = getConfigListEntry(_("Digital contour removal"), config.pep.digital_contour_removal)
 
                self.list = [
                        self.contrastEntry
@@ -121,15 +124,19 @@ class VideoEnhancementSetup(Screen, ConfigListScreen):
                        self.hueEntry,
                        self.brightnessEntry
                ))
-               if self.hw_type == 'dm8000':
+               if self.hw_type == 'dm800':
+                       self.list.extend((
+                               self.block_noise_reductionEntry,
+                               self.mosquito_noise_reductionEntry,
+                               self.digital_contour_removalEntry
+                       ))
+
+               elif self.hw_type == 'dm8000':
                        self.splitEntry = getConfigListEntry(_("Split preview mode"), config.pep.split)
                        self.sharpnessEntry = getConfigListEntry(_("Sharpness"), config.pep.sharpness)
                        self.auto_fleshEntry = getConfigListEntry(_("Auto flesh"), config.pep.auto_flesh)
                        self.green_boostEntry = getConfigListEntry(_("Green boost"), config.pep.green_boost)
                        self.blue_boostEntry = getConfigListEntry(_("Blue boost"), config.pep.blue_boost)
-                       self.block_noise_reductionEntry = getConfigListEntry(_("Block noise reduction"), config.pep.block_noise_reduction)
-                       self.mosquito_noise_reductionEntry = getConfigListEntry(_("Mosquito noise reduction"), config.pep.mosquito_noise_reduction)
-                       self.digital_contour_removalEntry = getConfigListEntry(_("Digital contour removal"), config.pep.digital_contour_removal)
                        self.dynamic_contrastEntry = getConfigListEntry(_("Dynamic contrast"), config.pep.dynamic_contrast)
 
                        self.xtdlist = [
@@ -242,6 +249,12 @@ class VideoEnhancementSetup(Screen, ConfigListScreen):
                                config.pep.hue.setValue(self.oldHue)
                        if self.brightnessEntry is not None:
                                config.pep.brightness.setValue(self.oldBrightness)
+                       if self.block_noise_reductionEntry is not None:
+                               config.pep.block_noise_reduction.setValue(self.oldBlock_noise)
+                       if self.mosquito_noise_reductionEntry is not None:
+                               config.pep.mosquito_noise_reduction.setValue(self.oldMosquito_noise)
+                       if self.digital_contour_removalEntry is not None:
+                               config.pep.digital_contour_removal.setValue(self.oldDigital_contour)
 
                        if self.hw_type == 'dm8000':
                                if self.splitEntry is not None:
@@ -254,12 +267,6 @@ class VideoEnhancementSetup(Screen, ConfigListScreen):
                                        config.pep.green_boost.setValue(self.oldGreen_boost)
                                if self.blue_boostEntry is not None:
                                        config.pep.blue_boost.setValue(self.oldBlue_boost)
-                               if self.block_noise_reductionEntry is not None:
-                                       config.pep.block_noise_reduction.setValue(self.oldBlock_noise)
-                               if self.mosquito_noise_reductionEntry is not None:
-                                       config.pep.mosquito_noise_reduction.setValue(self.oldMosquito_noise)
-                               if self.digital_contour_removalEntry is not None:
-                                       config.pep.digital_contour_removal.setValue(self.oldDigital_contour)
                                if self.dynamic_contrastEntry is not None:
                                        config.pep.dynamic_contrast.setValue(self.oldDynamic_contrast)
                        self.keySave()
@@ -279,6 +286,12 @@ class VideoEnhancementSetup(Screen, ConfigListScreen):
                                config.pep.hue.setValue(128)
                        if self.brightnessEntry is not None:
                                config.pep.brightness.setValue(128)
+                       if self.block_noise_reductionEntry is not None:
+                               config.pep.block_noise_reduction.setValue(0)
+                       if self.mosquito_noise_reductionEntry is not None:
+                               config.pep.mosquito_noise_reduction.setValue(0)
+                       if self.digital_contour_removalEntry is not None:
+                               config.pep.digital_contour_removal.setValue(0)
 
                        if self.hw_type == 'dm8000':
                                if self.splitEntry is not None:
@@ -291,12 +304,6 @@ class VideoEnhancementSetup(Screen, ConfigListScreen):
                                        config.pep.green_boost.setValue(0)
                                if self.blue_boostEntry is not None:
                                        config.pep.blue_boost.setValue(0)
-                               if self.block_noise_reductionEntry is not None:
-                                       config.pep.block_noise_reduction.setValue(0)
-                               if self.mosquito_noise_reductionEntry is not None:
-                                       config.pep.mosquito_noise_reduction.setValue(0)
-                               if self.digital_contour_removalEntry is not None:
-                                       config.pep.digital_contour_removal.setValue(0)
                                if self.dynamic_contrastEntry is not None:
                                        config.pep.dynamic_contrast.setValue(0)
                        self.keySave()