Handling of colorspace fields in image format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Hans

This has come about from a discussion with Laurent over how to handle
colorspace fields, whether a particular configuration is legitimate,
and whether we're looking at the correct behaviour. You're the go-to
person for that sort of question :-)

- CAPTURE queue (in this case on a M2M ISP device, but that doesn't
really matter).
- Limited colorspace options are available from the device (standard
SDTV BT601 limited range, HDTV BT709 limited range, and JPEG's BT601
full range).
- VIDIOC_ENUM_FMT flags returns V4L2_FMT_FLAG_CSC_COLORSPACE. It does
NOT set V4L2_FMT_FLAG_CSC_XFER_FUNC, V4L2_FMT_FLAG_CSC_YCBCR_ENC, or
V4L2_FMT_FLAG_CSC_QUANTIZATION. (No documentation saying this isn't
permitted, and why have 4 flags if they aren't independent).
- VIDIOC_S_FMT called with V4L2_PIX_FMT_FLAG_SET_CSC set.

Which colourspace fields from the format are applied?

The driver is saying that only colorspace is supported, and [1] says that
"The first is the colorspace identifier (enum v4l2_colorspace) which
defines the chromaticities, the default transfer function, the default
Y’CbCr encoding and the default quantization method"
so we have all 4 parameters defined via the defaults.
I read it that the ycbcr_enc, quantization, and xfer_func values
passed in should be ignored and replaced with the "default" values
derived from the colorspace value (use V4L2_MAP_XFER_FUNC_DEFAULT,
V4L2_MAP_YCBCR_ENC_DEFAULT, and V4L2_MAP_QUANTIZATION_DEFAULT)
Is this a valid interpretation?

Confusion comes from [2] for V4L2_PIX_FMT_FLAG_SET_CSC saying:
"If the colorimetry field (colorspace, xfer_func, ycbcr_enc, hsv_enc
or quantization) is set to *_DEFAULT, then that colorimetry setting
will remain unchanged from what was received."
What is "received" in this case? There is no inherent colourspace for
the device as it is M2M, so does that come back to being default
anyway, or reflecting the OUTPUT queue which might be Bayer and have
no range? Can we still ignore them all as the relevant
V4L2_FMT_FLAG_CSC_* flags aren't set?

Hopefully you can enlighten us.

Cheers
  Dave

[1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/colorspaces-defs.html
[2] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/pixfmt-v4l2.html#v4l2-pix-fmt-flag-set-csc




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux