From patchwork Mon Aug 22 09:28:07 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: 9293295 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 4E15560574 for ; Mon, 22 Aug 2016 09:28:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F9FD28781 for ; Mon, 22 Aug 2016 09:28:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34985287AC; Mon, 22 Aug 2016 09:28:32 +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=unavailable 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 DBF4728781 for ; Mon, 22 Aug 2016 09:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754398AbcHVJ2N (ORCPT ); Mon, 22 Aug 2016 05:28:13 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:33148 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754154AbcHVJ2M (ORCPT ); Mon, 22 Aug 2016 05:28:12 -0400 Received: by mail-lf0-f66.google.com with SMTP id f93so5865841lfi.0; Mon, 22 Aug 2016 02:28:11 -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; bh=pJCKd2i+y9sjf0nV70omuUIuSYq+Y8A84Mggb5+37iM=; b=GeUMPaSWa2MgHMi3jwVsi0dSr1vVEq8DMtcdckAwiQ2z4ng5MUhMpTaeEPTqc2eUMY f2G+wH8gsNZSzdK0UWn6ZdQxzUR0pfRi5/nDhB0NrBwEz7r7ftn7FcE8NDXCxSocNbn+ G8xbVyFBUh6erAurmOrGrVCjYFCqKPqRbhveqorXJQukIkdk4DfQLnXyXsKGmjUgsT6J oVMBfz7E87M2gRrlZVJ4lLQO8ER1HeHQXiKGhiebbxbljo5Ncn8X/jo6/bHg+B9pkqUj iB/mmiu4nVomXAMRy4MpCp+uuUzXY7zR3j+uld+powwpxKnAauLSgEgcYsu5vTh7JJvK AhOw== 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; bh=pJCKd2i+y9sjf0nV70omuUIuSYq+Y8A84Mggb5+37iM=; b=mtW8Cu3mPwwI87LuWWqCd7TaqKSAsdhUKfBQDM/Mzu0jDS1A0gdUIZgPp5MhD5caO+ s1G93roOWL4TwNCBM1kY+1kvq5qS5T+8aT8MNcWlzng+tWDguwNywzzL96PRCdEzpGHX TKe9KiS9o68QjEMNGlJ5kuKk+3//EX0hynzmuR+vB9z60/pk6CzT0K3fC0hbEi1tviXb eV+r5qptmt0YjRDKtqy7tBcJaVJZ/eYtGDksEMOONljAC10jtIgRc/Ns3cWxJV/unoaX uRY6U3eT6vQlBNHoeIPKFGQ+DbAllsLQp3cV6uc4fLxTLu2NdUCX7NMe63m55CfnNfUU OEMQ== X-Gm-Message-State: AEkoousfTk/74lFOpH/0i9ON7byKXECvHEzm5RAvhwkBG2cP27DG/HDBZd+6msb3Mnd2MA== X-Received: by 10.25.17.228 with SMTP id 97mr5637727lfr.154.1471858090028; Mon, 22 Aug 2016 02:28:10 -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 93sm3602344ljb.20.2016.08.22.02.28.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Aug 2016 02:28:08 -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_2 10/12] [media] videodev2.h Add HSV encoding Date: Mon, 22 Aug 2016 11:28:07 +0200 Message-Id: <1471858087-24528-1-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.8.1 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 Acked-by: Hans Verkuil --- v5_2: s/s_rgb_or_yuv/s_rgb_or_hsv/ Thanks Hans!! 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..baa874d91299 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_hsv, colsp, ycbcr_enc) \ + (((is_rgb_or_hsv) && (colsp) == V4L2_COLORSPACE_BT2020) ? \ + V4L2_QUANTIZATION_LIM_RANGE : \ + (((is_rgb_or_hsv) || (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];