From patchwork Thu Aug 18 14:33:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 9288285 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 80752607FF for ; Thu, 18 Aug 2016 14:36:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73C612929C for ; Thu, 18 Aug 2016 14:36:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68AF92929F; Thu, 18 Aug 2016 14:36:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E537292A4 for ; Thu, 18 Aug 2016 14:36:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1768223AbcHROgE (ORCPT ); Thu, 18 Aug 2016 10:36:04 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:35035 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1768357AbcHROfq (ORCPT ); Thu, 18 Aug 2016 10:35:46 -0400 Received: by mail-lf0-f65.google.com with SMTP id l89so1873162lfi.2; Thu, 18 Aug 2016 07:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MrGQfYom0sDs5kwqANapXPUKjTUDemZ4LOlqfEVJQpw=; b=KapY/2HvxOzFl6brjKAPAKPtc0BzNqAMwEP+NlYbB+9RN2lPx+gfAZKChuPHJRgJno f7e13fKMzQXuGF9wVo2JjTE7nF4wAzwIcKrxOOiTFOomWzQbEvkBnifurHEI18HcuPM1 Ru6QutN5GCoz2KSlEAmSzyRyDXZmlq+cV6p9ox9Bd6DhH910sm1AIf2ve5ZZH+Szq9y/ yLvsRnTxA84jMIcSPZQ1+BOLrzDkn16vK8J1RAYHXFbaxdfxo27Tm2TlmJd8Is4rwpqy NHmvs97ImZ51YtST2MB0YkC2Kc2nB+7j6CcBD4mBN3T5YZbc1hncnBnSCKjzQEPNQcsT 8XeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MrGQfYom0sDs5kwqANapXPUKjTUDemZ4LOlqfEVJQpw=; b=V9PFZliWWWn5CfzY0eviUXZCuV4qq6SzgbV+2Yfn1nt4GYXQLV9rF/OKU/ZIIiKPWM lRkXTBCReKX0HAJs+j8sM4qMoCCyEoj1MQMDauzzIYct0h9nMGzqsOIQd59ej97dTvdq pPWYu5y2zcpkSL2Ze2MzqpH1JH4F23aRTi4iqPBP7EB1rwC/HDsX9da6y+AP5yCBaLI6 ii6roh7ZdvYu/GjYQFaL9dRvoKdZ/oW/d7v38333i2ZeFifI7l9ab8s6sl0yYwoHWsQ1 PfIbhuG/ui+gPFWlkSrF/AxzPWdBRLX/3LW5CueVHJ/Iov13ZCET8qoPtYk6rqwlM0VC KwqQ== X-Gm-Message-State: AEkoouuHNFf7TN/66fsSjgw63FFOUDGTCqQg0NDOstgyVQ3CC/6kIKVaxdefeA5UnRDovg== X-Received: by 10.25.91.149 with SMTP id p143mr650709lfb.39.1471530835511; Thu, 18 Aug 2016 07:33:55 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id p21sm389218lfp.4.2016.08.18.07.33.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Aug 2016 07:33:54 -0700 (PDT) From: Ricardo Ribalda Delgado To: Mauro Carvalho Chehab , Hans Verkuil , Markus Heiser , Laurent Pinchart , Helen Mae Koike Fornazier , Antti Palosaari , Philipp Zabel , Shuah Khan , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Ricardo Ribalda Delgado Subject: [PATCH v5 10/12] [media] videodev2.h Add HSV encoding Date: Thu, 18 Aug 2016 16:33:36 +0200 Message-Id: <1471530818-7928-11-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1471530818-7928-1-git-send-email-ricardo.ribalda@gmail.com> References: <1471530818-7928-1-git-send-email-ricardo.ribalda@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some hardware maps the Hue between 0 and 255 instead of 0-179. Support this format with a new field hsv_enc. Signed-off-by: Ricardo Ribalda Delgado --- include/uapi/linux/videodev2.h | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 58ed8aedc196..71a4c3c13ee0 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -335,6 +335,19 @@ enum v4l2_ycbcr_encoding { }; /* + * enum v4l2_hsv_encoding values should not collide with the ones from + * enum v4l2_ycbcr_encoding. + */ +enum v4l2_hsv_encoding { + + /* Hue mapped to 0 - 179 */ + V4L2_HSV_ENC_180 = 128, + + /* Hue mapped to 0-255 */ + V4L2_HSV_ENC_256 = 129, +}; + +/* * Determine how YCBCR_ENC_DEFAULT should map to a proper Y'CbCr encoding. * This depends on the colorspace. */ @@ -362,9 +375,10 @@ enum v4l2_quantization { * This depends on whether the image is RGB or not, the colorspace and the * Y'CbCr encoding. */ -#define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb, colsp, ycbcr_enc) \ - (((is_rgb) && (colsp) == V4L2_COLORSPACE_BT2020) ? V4L2_QUANTIZATION_LIM_RANGE : \ - (((is_rgb) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \ +#define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb_or_yuv, colsp, ycbcr_enc) \ + (((is_rgb_or_yuv) && (colsp) == V4L2_COLORSPACE_BT2020) ? \ + V4L2_QUANTIZATION_LIM_RANGE : \ + (((is_rgb_or_yuv) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \ (ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == V4L2_COLORSPACE_JPEG) || \ (colsp) == V4L2_COLORSPACE_ADOBERGB || (colsp) == V4L2_COLORSPACE_SRGB ? \ V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE)) @@ -460,7 +474,12 @@ struct v4l2_pix_format { __u32 colorspace; /* enum v4l2_colorspace */ __u32 priv; /* private data, depends on pixelformat */ __u32 flags; /* format flags (V4L2_PIX_FMT_FLAG_*) */ - __u32 ycbcr_enc; /* enum v4l2_ycbcr_encoding */ + union { + /* enum v4l2_ycbcr_encoding */ + __u32 ycbcr_enc; + /* enum v4l2_hsv_encoding */ + __u32 hsv_enc; + }; __u32 quantization; /* enum v4l2_quantization */ __u32 xfer_func; /* enum v4l2_xfer_func */ }; @@ -1993,7 +2012,10 @@ struct v4l2_pix_format_mplane { struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; __u8 num_planes; __u8 flags; - __u8 ycbcr_enc; + union { + __u8 ycbcr_enc; + __u8 hsv_enc; + }; __u8 quantization; __u8 xfer_func; __u8 reserved[7];