Navigation Menu

Skip to content

Commit

Permalink
Implement median filtering for ALS data
Browse files Browse the repository at this point in the history
Earlier, when fixed time ALS sampling was possible, mce used median
filtering to prevent adjusting display brightness due to short lived
sensor noise. The feature got removed while adapting to sensor drivers
that report only changes that are significant enough.

User timer based approach to resample waveform obtained by tracking
changes reported by the ambient light sensor. Apply 9 slot moving
window median filtering on top of that and feed the results in to
brightness evaluation state machines.

To avoid unnecessary processing, the timer is stopped when no ALS
changes are noticed i.e. when all of the history data is the same.

The median filter can be enabled via:
  mcetool --set-als-input-filter=<disabled|median>

And the sample time can be adjusted via:
  mcetool --set-als-sample-time=<50...1000>

[mce] Implement median filtering for ALS data
  • Loading branch information
spiiroin committed Jan 29, 2015
1 parent 7f69e77 commit 9054d85
Show file tree
Hide file tree
Showing 6 changed files with 767 additions and 164 deletions.
2 changes: 2 additions & 0 deletions .depend
Expand Up @@ -4,6 +4,7 @@ builtin-gconf.o:\
mce-dbus.h\
mce-io.h\
mce-log.h\
modules/filter-brightness-als.h\
modules/memnotify.h\
powerkey.h\

Expand All @@ -13,6 +14,7 @@ builtin-gconf.pic.o:\
mce-dbus.h\
mce-io.h\
mce-log.h\
modules/filter-brightness-als.h\
modules/memnotify.h\
powerkey.h\

Expand Down
13 changes: 13 additions & 0 deletions builtin-gconf.c
Expand Up @@ -25,6 +25,7 @@
#include "powerkey.h"

#include "modules/memnotify.h"
#include "modules/filter-brightness-als.h"

#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -1082,6 +1083,18 @@ static const setting_t gconf_defaults[] =
.type = "b",
.def = "true",
},
{
// MCE_GCONF_DISPLAY_ALS_INPUT_FILTER @ modules/display.h
.key = "/system/osso/dsm/display/als_input_filter",
.type = "s",
.def = ALS_INPUT_FILTER_DEFAULT,
},
{
// MCE_GCONF_DISPLAY_ALS_SAMPLE_TIME @ modules/display.h
.key = "/system/osso/dsm/display/als_sample_time",
.type = "i",
.def = G_STRINGIFY(ALS_SAMPLE_TIME_DEFAULT),
},
{
// MCE_GCONF_DISPLAY_COLOR_PROFILE @ modules/display.h
.key = "/system/osso/dsm/display/color_profile",
Expand Down
6 changes: 6 additions & 0 deletions modules/display.h
Expand Up @@ -105,6 +105,12 @@
/** Path to the ALS enabled GConf setting */
#define MCE_GCONF_DISPLAY_ALS_ENABLED MCE_GCONF_DISPLAY_PATH "/als_enabled"

/** ALS input filter GConf setting */
#define MCE_GCONF_DISPLAY_ALS_INPUT_FILTER MCE_GCONF_DISPLAY_PATH "/als_input_filter"

/** ALS sample time GConf setting */
#define MCE_GCONF_DISPLAY_ALS_SAMPLE_TIME MCE_GCONF_DISPLAY_PATH "/als_sample_time"

/** Path to the color profile GConf setting */
#define MCE_GCONF_DISPLAY_COLOR_PROFILE MCE_GCONF_DISPLAY_PATH "/color_profile"

Expand Down

0 comments on commit 9054d85

Please sign in to comment.