Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 14d66538 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab
Browse files

[media] v4l: Define a pixel format for the R-Car VSP1 1-D histogram engine



The format is used on the R-Car VSP1 video queues that carry
1-D histogram statistics data.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 98eee255
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
.. -*- coding: utf-8; mode: rst -*-

.. _meta-formats:

****************
Metadata Formats
****************

These formats are used for the :ref:`metadata` interface only.


.. toctree::
    :maxdepth: 1

    pixfmt-meta-vsp1-hgo
+168 −0
Original line number Diff line number Diff line
.. -*- coding: utf-8; mode: rst -*-

.. _v4l2-meta-fmt-vsp1-hgo:

*******************************
V4L2_META_FMT_VSP1_HGO ('VSPH')
*******************************

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.

**Byte Order.**
All data is stored in memory in little endian format. Each cell in the tables
contains one byte.

.. flat-table:: VSP1 HGO Data - 64 Bins, Normal Mode (792 bytes)
    :header-rows:  2
    :stub-columns: 0

    * - Offset
      - :cspan:`4` 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
      - :cspan:`4` R/Cr/H sum [31:0]
    * - 16
      - :cspan:`4` G/Y/S sum [31:0]
    * - 20
      - :cspan:`4` B/Cb/V sum [31:0]
    * - 24
      - :cspan:`4` R/Cr/H bin 0 [31:0]
    * -
      - :cspan:`4` ...
    * - 276
      - :cspan:`4` R/Cr/H bin 63 [31:0]
    * - 280
      - :cspan:`4` G/Y/S bin 0 [31:0]
    * -
      - :cspan:`4` ...
    * - 532
      - :cspan:`4` G/Y/S bin 63 [31:0]
    * - 536
      - :cspan:`4` B/Cb/V bin 0 [31:0]
    * -
      - :cspan:`4` ...
    * - 788
      - :cspan:`4` B/Cb/V bin 63 [31:0]

.. flat-table:: VSP1 HGO Data - 64 Bins, Max Mode (264 bytes)
    :header-rows:  2
    :stub-columns: 0

    * - Offset
      - :cspan:`4` 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
      - :cspan:`4` max(R,G,B) sum [31:0]
    * - 8
      - :cspan:`4` max(R,G,B) bin 0 [31:0]
    * -
      - :cspan:`4` ...
    * - 260
      - :cspan:`4` max(R,G,B) bin 63 [31:0]

.. flat-table:: VSP1 HGO Data - 256 Bins, Normal Mode (1032 bytes)
    :header-rows:  2
    :stub-columns: 0

    * - Offset
      - :cspan:`4` Memory
    * -
      - [31:24]
      - [23:16]
      - [15:8]
      - [7:0]
    * - 0
      - -
      - Y max [7:0]
      - -
      - Y min [7:0]
    * - 4
      - :cspan:`4` Y sum [31:0]
    * - 8
      - :cspan:`4` Y bin 0 [31:0]
    * -
      - :cspan:`4` ...
    * - 1028
      - :cspan:`4` Y bin 255 [31:0]

.. flat-table:: VSP1 HGO Data - 256 Bins, Max Mode (1032 bytes)
    :header-rows:  2
    :stub-columns: 0

    * - Offset
      - :cspan:`4` 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
      - :cspan:`4` max(R,G,B) sum [31:0]
    * - 8
      - :cspan:`4` max(R,G,B) bin 0 [31:0]
    * -
      - :cspan:`4` ...
    * - 1028
      - :cspan:`4` max(R,G,B) bin 255 [31:0]
+1 −0
Original line number Diff line number Diff line
@@ -34,4 +34,5 @@ see also :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>`.)
    pixfmt-013
    sdr-formats
    tch-formats
    meta-formats
    pixfmt-reserved
+1 −0
Original line number Diff line number Diff line
@@ -1233,6 +1233,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
	case V4L2_TCH_FMT_DELTA_TD08:	descr = "8-bit signed deltas"; break;
	case V4L2_TCH_FMT_TU16:		descr = "16-bit unsigned touch data"; break;
	case V4L2_TCH_FMT_TU08:		descr = "8-bit unsigned touch data"; break;
	case V4L2_META_FMT_VSP1_HGO:	descr = "R-Car VSP1 1-D Histogram"; break;

	default:
		/* Compressed formats */
+3 −0
Original line number Diff line number Diff line
@@ -676,6 +676,9 @@ struct v4l2_pix_format {
#define V4L2_TCH_FMT_TU16	v4l2_fourcc('T', 'U', '1', '6') /* 16-bit unsigned touch data */
#define V4L2_TCH_FMT_TU08	v4l2_fourcc('T', 'U', '0', '8') /* 8-bit unsigned touch data */

/* 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