public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Linux Media Mailing List <linux-media@vger.kernel.org>
Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Subject: [PATCH] Improve Y16 color setup
Date: Mon, 01 Jun 2015 09:05:57 +0200	[thread overview]
Message-ID: <556C0455.30101@xs4all.nl> (raw)

Currently the colors for the Y16 and Y16_BE pixelformats are in the range
0x0000-0xff00. So pure white (0xffff) is never created.

Improve this by using the same byte for both LSB and MSB so the full range
is achieved.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

diff --git a/drivers/media/platform/vivid/vivid-tpg.c b/drivers/media/platform/vivid/vivid-tpg.c
index b1147f2..e28f32b 100644
--- a/drivers/media/platform/vivid/vivid-tpg.c
+++ b/drivers/media/platform/vivid/vivid-tpg.c
@@ -896,16 +896,12 @@ static void gen_twopix(struct tpg_data *tpg,
 	b_v = tpg->colors[color][2]; /* B or precalculated V */
 
 	switch (tpg->fourcc) {
-	case V4L2_PIX_FMT_GREY:
-		buf[0][offset] = r_y;
-		break;
 	case V4L2_PIX_FMT_Y16:
-		buf[0][offset] = 0;
-		buf[0][offset+1] = r_y;
-		break;
 	case V4L2_PIX_FMT_Y16_BE:
+		buf[0][offset+1] = r_y;
+		/* fall through */
+	case V4L2_PIX_FMT_GREY:
 		buf[0][offset] = r_y;
-		buf[0][offset+1] = 0;
 		break;
 	case V4L2_PIX_FMT_YUV422P:
 	case V4L2_PIX_FMT_YUV420:

             reply	other threads:[~2015-06-01  7:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01  7:05 Hans Verkuil [this message]
2015-06-01 21:11 ` [PATCH] Improve Y16 color setup Ricardo Ribalda Delgado

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=556C0455.30101@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=ricardo.ribalda@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox