diff options
| author | hans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain> | 2009-05-26 10:07:18 +0200 |
|---|---|---|
| committer | hans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain> | 2009-05-26 10:07:18 +0200 |
| commit | 08f4c9bb91fbc3e348322f140e1a0c1f662b7478 (patch) | |
| tree | c9b6ea88e4661f5f58b9392858ef71d4033cab7f /v4l2-apps/libv4l/libv4lconvert/control | |
| parent | 7b1960c67fb907d4885734c31a41898a9fe6dfa7 (diff) | |
| download | mediapointer-dvb-s2-08f4c9bb91fbc3e348322f140e1a0c1f662b7478.tar.gz mediapointer-dvb-s2-08f4c9bb91fbc3e348322f140e1a0c1f662b7478.tar.bz2 | |
libv4l: add gamma correction to video processing
From: Hans de Goede <hdegoede@redhat.com>
add gamma correction to the video processing, and enable it by default
(correct for a display gamma of 1.5) for pac207 based cams.
Priority: normal
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'v4l2-apps/libv4l/libv4lconvert/control')
3 files changed, 28 insertions, 5 deletions
diff --git a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol-priv.h b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol-priv.h index 14481a9a2..6211ee22a 100644 --- a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol-priv.h +++ b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol-priv.h @@ -26,6 +26,8 @@ #define V4LCONTROL_SUPPORTS_NEXT_CTRL 0x01 +struct v4lcontrol_flags_info; + struct v4lcontrol_data { int fd; /* Device fd */ int flags; /* Flags for this device */ @@ -33,6 +35,7 @@ struct v4lcontrol_data { int controls; /* Which controls to use for this device */ unsigned int *shm_values; /* shared memory control value store */ unsigned int old_values[V4LCONTROL_COUNT]; /* for controls_changed() */ + const struct v4lcontrol_flags_info *flags_info; }; struct v4lcontrol_flags_info { @@ -45,6 +48,7 @@ struct v4lcontrol_flags_info { const char *manufacturer; const char *product; */ int flags; + int default_gamma; }; #endif diff --git a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c index 3f57afb72..6bf5b6229 100644 --- a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c +++ b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c @@ -63,16 +63,16 @@ static const struct v4lcontrol_flags_info v4lcontrol_flags[] = { { 0x0471, 0x032d, 0, NULL, NULL, V4LCONTROL_HFLIPPED|V4LCONTROL_VFLIPPED }, /* Genius E-M 112 (also want whitebalance by default) */ { 0x093a, 0x2476, 0, NULL, NULL, - V4LCONTROL_HFLIPPED|V4LCONTROL_VFLIPPED|V4LCONTROL_WANTS_WB }, + V4LCONTROL_HFLIPPED|V4LCONTROL_VFLIPPED|V4LCONTROL_WANTS_WB, 1500 }, /* Asus N50Vn laptop */ { 0x04f2, 0xb106, 0, "ASUSTeK Computer Inc. ", "N50Vn ", V4LCONTROL_HFLIPPED|V4LCONTROL_VFLIPPED }, /* Second: devices which should use some software processing by default */ /* Pac207 based devices */ - { 0x041e, 0x4028, 0, NULL, NULL, V4LCONTROL_WANTS_WB }, - { 0x093a, 0x2460, 0x1f, NULL, NULL, V4LCONTROL_WANTS_WB }, - { 0x145f, 0x013a, 0, NULL, NULL, V4LCONTROL_WANTS_WB }, - { 0x2001, 0xf115, 0, NULL, NULL, V4LCONTROL_WANTS_WB }, + { 0x041e, 0x4028, 0, NULL, NULL, V4LCONTROL_WANTS_WB, 1500 }, + { 0x093a, 0x2460, 0x1f, NULL, NULL, V4LCONTROL_WANTS_WB, 1500 }, + { 0x145f, 0x013a, 0, NULL, NULL, V4LCONTROL_WANTS_WB, 1500 }, + { 0x2001, 0xf115, 0, NULL, NULL, V4LCONTROL_WANTS_WB, 1500 }, /* Pac7302 based devices */ { 0x093a, 0x2620, 0x0f, NULL, NULL, V4LCONTROL_ROTATED_90_JPEG|V4LCONTROL_WANTS_WB }, @@ -198,6 +198,7 @@ static void v4lcontrol_init_flags(struct v4lcontrol_data *data) (v4lcontrol_flags[i].dmi_board_name == NULL || !strcmp(v4lcontrol_flags[i].dmi_board_name, dmi_board_name))) { data->flags |= v4lcontrol_flags[i].flags; + data->flags_info = &v4lcontrol_flags[i]; break; } } @@ -283,6 +284,9 @@ struct v4lcontrol_data *v4lcontrol_create(int fd, int always_needs_conversion) if (data->flags & V4LCONTROL_WANTS_WB) data->shm_values[V4LCONTROL_WHITEBALANCE] = 1; + + if (data->flags_info && data->flags_info->default_gamma) + data->shm_values[V4LCONTROL_GAMMA] = data->flags_info->default_gamma; } return data; @@ -331,6 +335,16 @@ static const struct v4l2_queryctrl fake_controls[V4LCONTROL_COUNT] = { .default_value = 0, .flags = 0 }, +{ + .id = V4L2_CID_GAMMA, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Gamma (software)", + .minimum = 500, /* == 0.5 */ + .maximum = 3000, /* == 3.0 */ + .step = 1, + .default_value = 1000, /* == 1.0 */ + .flags = 0 +}, {}, /* Dummy place holder for V4LCONTROL_AUTO_ENABLE_COUNT */ { .id = V4L2_CID_AUTOGAIN, @@ -363,6 +377,10 @@ static void v4lcontrol_copy_queryctrl(struct v4lcontrol_data *data, if (ctrl->id == V4L2_CID_AUTO_WHITE_BALANCE && (data->flags & V4LCONTROL_WANTS_WB)) ctrl->default_value = 1; + + if (ctrl->id == V4L2_CID_GAMMA && data->flags_info && + data->flags_info->default_gamma) + ctrl->default_value = data->flags_info->default_gamma; } int v4lcontrol_vidioc_queryctrl(struct v4lcontrol_data *data, void *arg) diff --git a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.h b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.h index a3640038b..e29fde3d4 100644 --- a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.h +++ b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.h @@ -37,6 +37,7 @@ enum { V4LCONTROL_WHITEBALANCE, V4LCONTROL_HFLIP, V4LCONTROL_VFLIP, + V4LCONTROL_GAMMA, /* All fake controls above here are auto enabled when not present in hw */ V4LCONTROL_AUTO_ENABLE_COUNT, V4LCONTROL_AUTOGAIN, |
