* [PATCHv2] Improve Y16 color setup
@ 2015-06-05 6:45 Hans Verkuil
2015-06-05 6:59 ` Ricardo Ribalda Delgado
0 siblings, 1 reply; 2+ messages in thread
From: Hans Verkuil @ 2015-06-05 6:45 UTC (permalink / raw)
To: Linux Media Mailing List; +Cc: Ricardo Ribalda Delgado
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 making white really white. For other colors the lsb remains 0
so vivid can be used to detect endian problems.
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..1b94503 100644
--- a/drivers/media/platform/vivid/vivid-tpg.c
+++ b/drivers/media/platform/vivid/vivid-tpg.c
@@ -900,12 +900,19 @@ static void gen_twopix(struct tpg_data *tpg,
buf[0][offset] = r_y;
break;
case V4L2_PIX_FMT_Y16:
- buf[0][offset] = 0;
+ /*
+ * Ideally both bytes should be set to r_y, but then you won't
+ * be able to detect endian problems. So keep it 0 except for
+ * the corner case where r_y is 0xff so white really will be
+ * white (0xffff).
+ */
+ buf[0][offset] = r_y == 0xff ? r_y : 0;
buf[0][offset+1] = r_y;
break;
case V4L2_PIX_FMT_Y16_BE:
+ /* See comment for V4L2_PIX_FMT_Y16 above */
buf[0][offset] = r_y;
- buf[0][offset+1] = 0;
+ buf[0][offset+1] = r_y == 0xff ? r_y : 0;
break;
case V4L2_PIX_FMT_YUV422P:
case V4L2_PIX_FMT_YUV420:
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCHv2] Improve Y16 color setup
2015-06-05 6:45 [PATCHv2] Improve Y16 color setup Hans Verkuil
@ 2015-06-05 6:59 ` Ricardo Ribalda Delgado
0 siblings, 0 replies; 2+ messages in thread
From: Ricardo Ribalda Delgado @ 2015-06-05 6:59 UTC (permalink / raw)
To: Hans Verkuil; +Cc: Linux Media Mailing List
Reviewed-by: Ricardo Ribalda <ricardo.ribalda@gmail.com>
Thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-05 6:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-05 6:45 [PATCHv2] Improve Y16 color setup Hans Verkuil
2015-06-05 6:59 ` Ricardo Ribalda Delgado
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox