Skip to content

Commit e82822f

Browse files
ribaldamchehab
authored andcommitted
media: uvcvideo: Set the colorspace as sRGB if undefined
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> Tested-by: James Hilliard <james.hilliard1@gmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1 parent 8aa637b commit e82822f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎drivers/media/usb/uvc/uvc_driver.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static struct uvc_format_desc *uvc_format_by_guid(const u8 guid[16])
256256
static enum v4l2_colorspace uvc_colorspace(const u8 primaries)
257257
{
258258
static const enum v4l2_colorspace colorprimaries[] = {
259-
V4L2_COLORSPACE_DEFAULT, /* Unspecified */
259+
V4L2_COLORSPACE_SRGB, /* Unspecified */
260260
V4L2_COLORSPACE_SRGB,
261261
V4L2_COLORSPACE_470_SYSTEM_M,
262262
V4L2_COLORSPACE_470_SYSTEM_BG,
@@ -267,7 +267,7 @@ static enum v4l2_colorspace uvc_colorspace(const u8 primaries)
267267
if (primaries < ARRAY_SIZE(colorprimaries))
268268
return colorprimaries[primaries];
269269

270-
return V4L2_COLORSPACE_DEFAULT; /* Reserved */
270+
return V4L2_COLORSPACE_SRGB; /* Reserved */
271271
}
272272

273273
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,
769769

770770
buflen -= buffer[0];
771771
buffer += buffer[0];
772+
} else {
773+
format->colorspace = V4L2_COLORSPACE_SRGB;
772774
}
773775

774776
return buffer - start;

0 commit comments

Comments
 (0)