Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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

parent 07ae4918
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -6014,8 +6014,8 @@ static void setcontrast(struct gspca_dev *gspca_dev)
	int g, i, k, adj, gp;
	u8 gr[16];
	static const u8 delta_tb[16] =		/* delta for contrast */
		{0x15, 0x0d, 0x0a, 0x09, 0x08, 0x08, 0x08, 0x08,
		 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08};
		{0x2c, 0x1a, 0x12, 0x0c, 0x0a, 0x06, 0x06, 0x06,
		 0x04, 0x06, 0x04, 0x04, 0x03, 0x03, 0x02, 0x02};
	static const u8 gamma_tb[6][16] = {
		{0x00, 0x00, 0x03, 0x0d, 0x1b, 0x2e, 0x45, 0x5f,
		 0x79, 0x93, 0xab, 0xc1, 0xd4, 0xe5, 0xf3, 0xff},
@@ -6037,11 +6037,11 @@ static void setcontrast(struct gspca_dev *gspca_dev)
	adj = 0;
	gp = 0;
	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)
			g = 0xff;
		else if (g <= 0)
			g = 1;
		else if (g < 0)
			g = 0;
		reg_w(dev, g, 0x0120 + i);	/* gamma */
		if (k > 0)
			adj--;