All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] media: uvcvideo: Set the colorspace as sRGB if undefined
@ 2021-11-12 19:57 Ricardo Ribalda
  2021-11-12 21:54 ` James Hilliard
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Ricardo Ribalda @ 2021-11-12 19:57 UTC (permalink / raw)
  To: Hans Verkuil, James Hilliard, Laurent Pinchart, linux-media
  Cc: Ricardo Ribalda

Never return V4L2_COLORSPACE_DEFAULT. From the standard:

"""
In the absence of this descriptor, or in the case of
“Unspecified” values within the descriptor, color matching
defaults will be assumed. The color matching defaults are
compliant with sRGB since the BT.709 transfer function and
the sRGB transfer function are very similar.
"""

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
@James: Can you try this version? Thanks!

 drivers/media/usb/uvc/uvc_driver.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 29befcb229b2..27234fe60a48 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -256,7 +256,7 @@ static struct uvc_format_desc *uvc_format_by_guid(const u8 guid[16])
 static enum v4l2_colorspace uvc_colorspace(const u8 primaries)
 {
 	static const enum v4l2_colorspace colorprimaries[] = {
-		V4L2_COLORSPACE_DEFAULT,  /* Unspecified */
+		V4L2_COLORSPACE_SRGB,  /* Unspecified */
 		V4L2_COLORSPACE_SRGB,
 		V4L2_COLORSPACE_470_SYSTEM_M,
 		V4L2_COLORSPACE_470_SYSTEM_BG,
@@ -267,7 +267,7 @@ static enum v4l2_colorspace uvc_colorspace(const u8 primaries)
 	if (primaries < ARRAY_SIZE(colorprimaries))
 		return colorprimaries[primaries];
 
-	return V4L2_COLORSPACE_DEFAULT;  /* Reserved */
+	return V4L2_COLORSPACE_SRGB;  /* Reserved */
 }
 
 static enum v4l2_xfer_func uvc_xfer_func(const u8 transfer_characteristics)
@@ -769,6 +769,8 @@ static int uvc_parse_format(struct uvc_device *dev,
 
 		buflen -= buffer[0];
 		buffer += buffer[0];
+	} else {
+		format->colorspace = V4L2_COLORSPACE_SRGB;
 	}
 
 	return buffer - start;
-- 
2.34.0.rc1.387.gb447b232ab-goog


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

end of thread, other threads:[~2021-11-15  9:59 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 19:57 [PATCH v2] media: uvcvideo: Set the colorspace as sRGB if undefined Ricardo Ribalda
2021-11-12 21:54 ` James Hilliard
2021-11-12 21:58   ` Ricardo Ribalda
2021-11-12 22:07     ` James Hilliard
2021-11-12 22:23       ` Ricardo Ribalda
2021-11-12 22:46         ` James Hilliard
2021-11-12 23:50           ` Ricardo Ribalda
2021-11-12 23:58             ` James Hilliard
2021-11-13  0:02               ` Ricardo Ribalda
2021-11-13  0:07                 ` James Hilliard
2021-11-13  0:11                   ` Ricardo Ribalda
2021-11-13  0:25                     ` James Hilliard
2021-11-14  8:59                   ` James Hilliard
2021-11-12 22:02 ` James Hilliard
2021-11-15  9:59 ` Laurent Pinchart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.