Commit a8567531 authored by Jean-François Moine's avatar Jean-François Moine Committed by Mauro Carvalho Chehab

V4L/DVB: gspca - zc3xx: Fix the gamma calculation from the contrast

Signed-off-by: default avatarJean-François Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 07ae4918
...@@ -6014,8 +6014,8 @@ static void setcontrast(struct gspca_dev *gspca_dev) ...@@ -6014,8 +6014,8 @@ static void setcontrast(struct gspca_dev *gspca_dev)
int g, i, k, adj, gp; int g, i, k, adj, gp;
u8 gr[16]; u8 gr[16];
static const u8 delta_tb[16] = /* delta for contrast */ static const u8 delta_tb[16] = /* delta for contrast */
{0x15, 0x0d, 0x0a, 0x09, 0x08, 0x08, 0x08, 0x08, {0x2c, 0x1a, 0x12, 0x0c, 0x0a, 0x06, 0x06, 0x06,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08}; 0x04, 0x06, 0x04, 0x04, 0x03, 0x03, 0x02, 0x02};
static const u8 gamma_tb[6][16] = { static const u8 gamma_tb[6][16] = {
{0x00, 0x00, 0x03, 0x0d, 0x1b, 0x2e, 0x45, 0x5f, {0x00, 0x00, 0x03, 0x0d, 0x1b, 0x2e, 0x45, 0x5f,
0x79, 0x93, 0xab, 0xc1, 0xd4, 0xe5, 0xf3, 0xff}, 0x79, 0x93, 0xab, 0xc1, 0xd4, 0xe5, 0xf3, 0xff},
...@@ -6037,11 +6037,11 @@ static void setcontrast(struct gspca_dev *gspca_dev) ...@@ -6037,11 +6037,11 @@ static void setcontrast(struct gspca_dev *gspca_dev)
adj = 0; adj = 0;
gp = 0; gp = 0;
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
g = Tgamma[i] - delta_tb[i] * k / 128 - adj / 2; g = Tgamma[i] - delta_tb[i] * k / 256 - adj / 2;
if (g > 0xff) if (g > 0xff)
g = 0xff; g = 0xff;
else if (g <= 0) else if (g < 0)
g = 1; g = 0;
reg_w(dev, g, 0x0120 + i); /* gamma */ reg_w(dev, g, 0x0120 + i); /* gamma */
if (k > 0) if (k > 0)
adj--; adj--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment