From patchwork Mon Jun 20 19:10:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 9188551 X-Patchwork-Delegate: geert@linux-m68k.org 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 295796089D for ; Mon, 20 Jun 2016 19:12:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10DF027D5E for ; Mon, 20 Jun 2016 19:12:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05A6E27D4D; Mon, 20 Jun 2016 19:12:28 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 3ACDB27D5E for ; Mon, 20 Jun 2016 19:12:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933070AbcFTTMO (ORCPT ); Mon, 20 Jun 2016 15:12:14 -0400 Received: from galahad.ideasonboard.com ([185.26.127.97]:52953 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753427AbcFTTLn (ORCPT ); Mon, 20 Jun 2016 15:11:43 -0400 Received: from avalon.bb.dnainternet.fi (85-23-193-79.bb.dnainternet.fi [85.23.193.79]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 9E03620391; Mon, 20 Jun 2016 21:08:07 +0200 (CEST) From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org Subject: [PATCH 02/24] v4l: Define a pixel format for the R-Car VSP1 1-D histogram engine Date: Mon, 20 Jun 2016 22:10:20 +0300 Message-Id: <1466449842-29502-3-git-send-email-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1466449842-29502-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> References: <1466449842-29502-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The format is used on the R-Car VSP1 video queues that carry 1-D histogram statistics data. Signed-off-by: Laurent Pinchart Acked-by: Sakari Ailus --- .../DocBook/media/v4l/pixfmt-meta-vsp1-hgo.xml | 307 +++++++++++++++++++++ Documentation/DocBook/media/v4l/pixfmt.xml | 9 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 3 + 4 files changed, 320 insertions(+) create mode 100644 Documentation/DocBook/media/v4l/pixfmt-meta-vsp1-hgo.xml diff --git a/Documentation/DocBook/media/v4l/pixfmt-meta-vsp1-hgo.xml b/Documentation/DocBook/media/v4l/pixfmt-meta-vsp1-hgo.xml new file mode 100644 index 000000000000..b40bd10695d2 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-meta-vsp1-hgo.xml @@ -0,0 +1,307 @@ + + + V4L2_META_FMT_VSP1_HGO ('VSPH') + &manvol; + + + + V4L2_META_FMT_VSP1_HGO + + Renesas R-Car VSP1 1-D Histogram Data + + + Description + +This format describes histogram data generated by the Renesas R-Car VSP1 1-D +Histogram (HGO) engine. + + +The VSP1 HGO is a histogram computation engine that can operate on RGB, YCrCb +or HSV data. It operates on a possibly cropped and subsampled input image and +computes the minimum, maximum and sum of all pixels as well as per-channel +histograms. + +The HGO can compute histograms independently per channel, on the maximum of the +three channels (RGB data only) or on the Y channel only (YCbCr only). It can +additionally output the histogram with 64 or 256 bins, resulting in four +possible modes of operation. + + + + In 64 bins normal mode, the HGO operates + on the three channels independently to compute three 64-bins + histograms. RGB, YCbCr and HSV image formats are supported. + + + + + In 64 bins maximum mode, the HGO operates + on the maximum of the (R, G, B) channels to compute a single + 64-bins histogram. Only the RGB image format is supported. + + + + + In 256 bins normal mode, the HGO operates + on the Y channel to compute a single 256-bins histogram. Only the + YCbCr image format is supported. + + + + + In 256 bins maximum mode, the HGO operates + on the maximum of the (R, G, B) channels to compute a single + 256-bins histogram. Only the RGB image format is supported. + + + + + + +All data is stored in memory in little endian format. Each cell in the tables +below contains one byte. + + + VSP1 HGO Data - 64 Bins, Normal Mode (792 bytes) + + + + + + + + + + Offset + Memory + + + + [31:24] + [23:16] + [15:8] + [7:0] + + + + + 0 + - + R/Cr/H max [7:0] + - + R/Cr/H min [7:0] + + + 4 + - + G/Y/S max [7:0] + - + G/Y/S min [7:0] + + + 8 + - + B/Cb/V max [7:0] + - + B/Cb/V min [7:0] + + + 12 + R/Cr/H sum [31:0] + + + 16 + G/Y/S sum [31:0] + + + 20 + B/Cb/V sum [31:0] + + + 24 + R/Cr/H bin 0 [31:0] + + + + ... + + + 276 + R/Cr/H bin 63 [31:0] + + + 280 + G/Y/S bin 0 [31:0] + + + + ... + + + 532 + G/Y/S bin 63 [31:0] + + + 536 + B/Cb/V bin 0 [31:0] + + + + ... + + + 788 + B/Cb/V bin 63 [31:0] + + + +
+ + VSP1 HGO Data - 64 Bins, Max Mode (264 bytes) + + + + + + + + + + Offset + Memory + + + + [31:24] + [23:16] + [15:8] + [7:0] + + + + + 0 + - + max(R,G,B) max [7:0] + - + max(R,G,B) min [7:0] + + + 4 + max(R,G,B) sum [31:0] + + + 8 + max(R,G,B) bin 0 [31:0] + + + + ... + + + 260 + max(R,G,B) bin 63 [31:0] + + + +
+ + VSP1 HGO Data - 256 Bins, Normal Mode (1032 bytes) + + + + + + + + + + Offset + Memory + + + + [31:24] + [23:16] + [15:8] + [7:0] + + + + + 0 + - + Y max [7:0] + - + Y min [7:0] + + + 4 + Y sum [31:0] + + + 8 + Y bin 0 [31:0] + + + + ... + + + 1028 + Y bin 255 [31:0] + + + +
+ + VSP1 HGO Data - 256 Bins, Max Mode (1032 bytes) + + + + + + + + + + Offset + Memory + + + + [31:24] + [23:16] + [15:8] + [7:0] + + + + + 0 + - + max(R,G,B) max [7:0] + - + max(R,G,B) min [7:0] + + + 4 + max(R,G,B) sum [31:0] + + + 8 + max(R,G,B) bin 0 [31:0] + + + + ... + + + 1028 + max(R,G,B) bin 255 [31:0] + + + +
+
+
diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml b/Documentation/DocBook/media/v4l/pixfmt.xml index 5a08aeea4360..bd67539abf47 100644 --- a/Documentation/DocBook/media/v4l/pixfmt.xml +++ b/Documentation/DocBook/media/v4l/pixfmt.xml @@ -1740,6 +1740,15 @@ extended control V4L2_CID_MPEG_STREAM_TYPE, see +
+ Metadata Formats + + These formats are used for metadata. + + &sub-meta-vsp1-hgo; + +
+
SDR Formats diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 5d003152ff68..6a74dcac738e 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1258,6 +1258,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_SDR_FMT_CS8: descr = "Complex S8"; break; case V4L2_SDR_FMT_CS14LE: descr = "Complex S14LE"; break; case V4L2_SDR_FMT_RU12LE: descr = "Real U12LE"; break; + case V4L2_META_FMT_VSP1_HGO: descr = "R-Car VSP1 1-D Histogram"; break; default: /* Compressed formats */ diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 5fbd30ca9b1e..0c72202525c6 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -635,6 +635,9 @@ struct v4l2_pix_format { #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */ #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */ +/* Meta-data formats */ +#define V4L2_META_FMT_VSP1_HGO v4l2_fourcc('V', 'S', 'P', 'H') /* R-Car VSP1 Histogram */ + /* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe