public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 15/31] media: use parity8 in vivid-vbi-gen.c
       [not found] <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com>
@ 2016-03-27  7:06 ` zhaoxiu.zeng
  2016-03-27  7:10 ` [PATCH 16/31] media: saa7115: use parity functions zhaoxiu.zeng
  1 sibling, 0 replies; 2+ messages in thread
From: zhaoxiu.zeng @ 2016-03-27  7:06 UTC (permalink / raw)
  To: Hans Verkuil, Mauro Carvalho Chehab; +Cc: linux-kernel, linux-media

From: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
---
 drivers/media/platform/vivid/vivid-vbi-gen.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/vivid/vivid-vbi-gen.c b/drivers/media/platform/vivid/vivid-vbi-gen.c
index a2159de..d5ba0fc 100644
--- a/drivers/media/platform/vivid/vivid-vbi-gen.c
+++ b/drivers/media/platform/vivid/vivid-vbi-gen.c
@@ -175,14 +175,9 @@ static const u8 vivid_cc_sequence2[30] = {
 	0x14, 0x2f,	/* End of Caption */
 };
 
-static u8 calc_parity(u8 val)
+static inline u8 calc_parity(u8 val)
 {
-	unsigned i;
-	unsigned tot = 0;
-
-	for (i = 0; i < 7; i++)
-		tot += (val & (1 << i)) ? 1 : 0;
-	return val | ((tot & 1) ? 0 : 0x80);
+	return (!parity8(val) << 7) | val;
 }
 
 static void vivid_vbi_gen_set_time_of_day(u8 *packet)
-- 
2.5.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 16/31] media: saa7115: use parity functions
       [not found] <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com>
  2016-03-27  7:06 ` [PATCH 15/31] media: use parity8 in vivid-vbi-gen.c zhaoxiu.zeng
@ 2016-03-27  7:10 ` zhaoxiu.zeng
  1 sibling, 0 replies; 2+ messages in thread
From: zhaoxiu.zeng @ 2016-03-27  7:10 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Arnd Bergmann, Krzysztof Kozlowski,
	Hans Verkuil
  Cc: linux-kernel, linux-media

From: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
---
 drivers/media/i2c/saa7115.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index d2a1ce2..4c22df8 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -672,15 +672,6 @@ static const unsigned char saa7115_init_misc[] = {
 	0x00, 0x00
 };
 
-static int saa711x_odd_parity(u8 c)
-{
-	c ^= (c >> 4);
-	c ^= (c >> 2);
-	c ^= (c >> 1);
-
-	return c & 1;
-}
-
 static int saa711x_decode_vps(u8 *dst, u8 *p)
 {
 	static const u8 biphase_tbl[] = {
@@ -733,7 +724,6 @@ static int saa711x_decode_wss(u8 *p)
 	static const int wss_bits[8] = {
 		0, 0, 0, 1, 0, 1, 1, 1
 	};
-	unsigned char parity;
 	int wss = 0;
 	int i;
 
@@ -745,11 +735,8 @@ static int saa711x_decode_wss(u8 *p)
 			return -1;
 		wss |= b2 << i;
 	}
-	parity = wss & 15;
-	parity ^= parity >> 2;
-	parity ^= parity >> 1;
 
-	if (!(parity & 1))
+	if (!parity4(wss))
 		return -1;
 
 	return wss;
@@ -1235,7 +1222,7 @@ static int saa711x_decode_vbi_line(struct v4l2_subdev *sd, struct v4l2_decode_vb
 		vbi->type = V4L2_SLICED_TELETEXT_B;
 		break;
 	case 4:
-		if (!saa711x_odd_parity(p[0]) || !saa711x_odd_parity(p[1]))
+		if (!parity8(p[0]) || !parity8(p[1]))
 			return 0;
 		vbi->type = V4L2_SLICED_CAPTION_525;
 		break;
-- 
2.5.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-27  7:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com>
2016-03-27  7:06 ` [PATCH 15/31] media: use parity8 in vivid-vbi-gen.c zhaoxiu.zeng
2016-03-27  7:10 ` [PATCH 16/31] media: saa7115: use parity functions zhaoxiu.zeng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox