From: Helen Koike <helen.koike@collabora.com>
To: linux-media@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-kernel@vger.kernel.org
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
jgebben@codeaurora.org, mchehab@osg.samsung.com,
Sakari Ailus <sakari.ailus@iki.fi>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: [PATCH v5 06/12] [media] vimc: common: Add vimc_colorimetry_clamp
Date: Mon, 19 Jun 2017 14:00:15 -0300 [thread overview]
Message-ID: <1497891629-1562-7-git-send-email-helen.koike@collabora.com> (raw)
In-Reply-To: <1497891629-1562-1-git-send-email-helen.koike@collabora.com>
Colorimetry value will always be checked in the same way. Adding a
helper macro for that
Signed-off-by: Helen Koike <helen.koike@collabora.com>
---
Changes in v5: None
Changes in v4:
[media] vimc: common: Add vimc_colorimetry_clamp
- this is a new patch in the series
Changes in v3: None
Changes in v2: None
---
drivers/media/platform/vimc/vimc-common.h | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/media/platform/vimc/vimc-common.h b/drivers/media/platform/vimc/vimc-common.h
index 60ebde2..43483ee 100644
--- a/drivers/media/platform/vimc/vimc-common.h
+++ b/drivers/media/platform/vimc/vimc-common.h
@@ -23,6 +23,32 @@
#include <media/v4l2-device.h>
/**
+ * struct vimc_colorimetry_clamp - Adjust colorimetry parameters
+ *
+ * @fmt: the pointer to struct v4l2_pix_format or
+ * struct v4l2_mbus_framefmt
+ *
+ * Entities must check if colorimetry given by the userspace is valid, if not
+ * then set them as DEFAULT
+ */
+#define vimc_colorimetry_clamp(fmt) \
+do { \
+ if ((fmt)->colorspace == V4L2_COLORSPACE_DEFAULT \
+ || (fmt)->colorspace > V4L2_COLORSPACE_DCI_P3) { \
+ (fmt)->colorspace = V4L2_COLORSPACE_DEFAULT; \
+ (fmt)->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; \
+ (fmt)->quantization = V4L2_QUANTIZATION_DEFAULT; \
+ (fmt)->xfer_func = V4L2_XFER_FUNC_DEFAULT; \
+ } \
+ if ((fmt)->ycbcr_enc > V4L2_YCBCR_ENC_SMPTE240M) \
+ (fmt)->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; \
+ if ((fmt)->quantization > V4L2_QUANTIZATION_LIM_RANGE) \
+ (fmt)->quantization = V4L2_QUANTIZATION_DEFAULT; \
+ if ((fmt)->xfer_func > V4L2_XFER_FUNC_SMPTE2084) \
+ (fmt)->xfer_func = V4L2_XFER_FUNC_DEFAULT; \
+} while (0)
+
+/**
* struct vimc_pix_map - maps media bus code with v4l2 pixel format
*
* @code: media bus format code defined by MEDIA_BUS_FMT_* macros
--
2.7.4
next prev parent reply other threads:[~2017-06-19 17:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1497891629-1562-1-git-send-email-helen.koike@collabora.com>
2017-06-19 17:00 ` [PATCH v5 01/12] [media] vimc: sen: Integrate the tpg on the sensor Helen Koike
2017-06-19 17:00 ` [PATCH v5 02/12] [media] vimc: Move common code from the core Helen Koike
2017-06-19 17:00 ` [PATCH v5 03/12] [media] vimc: common: Add vimc_ent_sd_* helper Helen Koike
2017-06-19 17:00 ` [PATCH v5 04/12] [media] vimc: common: Add vimc_pipeline_s_stream helper Helen Koike
2017-06-19 17:00 ` [PATCH v5 05/12] [media] vimc: common: Add vimc_link_validate Helen Koike
2017-06-19 17:00 ` Helen Koike [this message]
2017-06-19 17:00 ` [PATCH v5 07/12] [media] vimc: sen: Support several image formats Helen Koike
2017-06-19 17:00 ` [PATCH v5 08/12] [media] vimc: cap: " Helen Koike
2017-06-19 17:00 ` [PATCH v5 09/12] [media] vimc: Subdevices as modules Helen Koike
2017-06-19 17:00 ` [PATCH v5 10/12] [media] vimc: deb: Add debayer filter Helen Koike
2017-06-19 17:00 ` [PATCH v5 11/12] [media] vimc: sca: Add scaler Helen Koike
2017-06-19 17:00 ` [PATCH v5 12/12] [media] vimc: sen: Declare vimc_sen_video_ops as static Helen Koike
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=1497891629-1562-7-git-send-email-helen.koike@collabora.com \
--to=helen.koike@collabora.com \
--cc=hverkuil@xs4all.nl \
--cc=jgebben@codeaurora.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mchehab@osg.samsung.com \
--cc=sakari.ailus@iki.fi \
/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
all inboxes | Powered by JetHome®