From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from galahad.ideasonboard.com ([185.26.127.97]:50107 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932845AbcIFOy0 (ORCPT ); Tue, 6 Sep 2016 10:54:26 -0400 From: Laurent Pinchart To: Niklas =?ISO-8859-1?Q?S=F6derlund?= Cc: linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org, corbet@lwn.net, mchehab@kernel.org, sakari.ailus@linux.intel.com, hans.verkuil@cisco.com Subject: Re: [PATCHv2 1/2] v4l: Define a pixel format for the R-Car VSP1 2-D histogram engine Date: Tue, 06 Sep 2016 17:54:54 +0300 Message-ID: <3416430.OTgLkcDMr1@avalon> In-Reply-To: <20160906143856.27564-2-niklas.soderlund+renesas@ragnatech.se> References: <20160906143856.27564-1-niklas.soderlund+renesas@ragnatech.se> <20160906143856.27564-2-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" Sender: linux-media-owner@vger.kernel.org List-ID: Hi Niklas, Thank you for the patch. On Tuesday 06 Sep 2016 16:38:55 Niklas S=F6derlund wrote: > The format is used on the R-Car VSP1 video queues that carry > 2-D histogram statistics data. >=20 > Signed-off-by: Niklas S=F6derlund > --- > Documentation/media/uapi/v4l/meta-formats.rst | 1 + > .../media/uapi/v4l/pixfmt-meta-vsp1-hgt.rst | 122 +++++++++++= +++++++ > drivers/media/v4l2-core/v4l2-ioctl.c | 1 + > include/uapi/linux/videodev2.h | 3 +- > 4 files changed, 126 insertions(+), 1 deletion(-) > create mode 100644 Documentation/media/uapi/v4l/pixfmt-meta-vsp1-hgt= .rst >=20 > diff --git a/Documentation/media/uapi/v4l/meta-formats.rst > b/Documentation/media/uapi/v4l/meta-formats.rst index 05ab91e..01e24e= 3 > 100644 > --- a/Documentation/media/uapi/v4l/meta-formats.rst > +++ b/Documentation/media/uapi/v4l/meta-formats.rst > @@ -13,3 +13,4 @@ These formats are used for the :ref:`metadata` inte= rface > only. > :maxdepth: 1 >=20 > pixfmt-meta-vsp1-hgo > + pixfmt-meta-vsp1-hgt > diff --git a/Documentation/media/uapi/v4l/pixfmt-meta-vsp1-hgt.rst > b/Documentation/media/uapi/v4l/pixfmt-meta-vsp1-hgt.rst new file mode= > 100644 > index 0000000..0393148 > --- /dev/null > +++ b/Documentation/media/uapi/v4l/pixfmt-meta-vsp1-hgt.rst > @@ -0,0 +1,122 @@ > +.. -*- coding: utf-8; mode: rst -*- > + > +.. _v4l2-meta-fmt-vsp1-hgt: > + > +******************************* > +V4L2_META_FMT_VSP1_HGT ('VSPT') > +******************************* > + > +*man V4L2_META_FMT_VSP1_HGT(2)* > + > +Renesas R-Car VSP1 2-D Histogram Data > + > + > +Description > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +This format describes histogram data generated by the Renesas R-Car = VSP1 > +2-D Histogram (HGT) engine. > + > +The VSP1 HGT is a histogram computation engine that operates on HSV > +data. It operates on a possibly cropped and subsampled input image a= nd > +computes the sum, maximum and minimum of the S component as well as = a > +weighted frequency histogram based on the H and S components. > + > +The histogram is a matrix of 6 Hue and 32 Saturation buckets, 192 in= > +total. Each HSV value is added to one or more buckets with a weight > +between 1 and 16 depending on the Hue areas configuration. Finding t= he > +corresponding buckets is done by inspecting the H and S value > independently. + > +The Saturation position **n** (0 - 31) of the bucket in the matrix i= s > +found by the expression: > + > + n =3D S / 8 > + > +The Hue position **m** (0 - 5) of the bucket in the matrix depends o= n > +how the HGT Hue areas are configured. There are 6 user configurable = Hue > +Areas which can be configured to cover overlapping Hue values: > + > +:: > + > + Area 0 Area 1 Area 2 Area 3 Area 4 = =20 > Area 5 + ________ ________ ________ ________ =20= > ________ ________ + \ /| |\ /| |\ /| |\ = /| =20 > |\ /| |\ /| |\ / + \ / | | \ / | | \ / = | =20 > | \ / | | \ / | | \ / | | \ / + X | | X | = | > X | | X | | X | | X | | X + / \ | = | / > \ | | / \ | | / \ | | / \ | | / \ | | / \ + = / =20 > \| |/ \| |/ \| |/ \| |/ \| |/ \| = |/ > \ + 5U 0L 0U 1L 1U 2L 2U 3L 3U 4L = 4U=20 > 5L 5U 0L + <0..............................Hue > Value............................255> + > +When two consecutive areas don't overlap (n+1L is equal to nU) the b= oundary > +value is considered as part of the lower area. > + > +Pixels with a hue value included in the centre of an area (between n= L and > nU +included) are are attributed to that single area and given a weig= ht of s/are are/are/ > 16. +Pixels with a hue value included in the overlapping region betwe= en two > areas +(between n+1L and nU excluded) are attributed to both areas an= d > given a weight +for each of these areas proportional to their positio= n > along the diagonal +lines (rounded down)." s/"// Apart from that, Reviewed-by: Laurent Pinchart and applied to my tree with the above fixes. > + > +The Hue area setup must match one of the following constrains: > + > +:: > + > + 0L <=3D 0U <=3D 1L <=3D 1U <=3D 2L <=3D 2U <=3D 3L <=3D 3U <=3D = 4L <=3D 4U <=3D 5L <=3D 5U > + > +:: > + > + 0U <=3D 1L <=3D 1U <=3D 2L <=3D 2U <=3D 3L <=3D 3U <=3D 4L <=3D = 4U <=3D 5L <=3D 5U <=3D 0L > + > +**Byte Order.** > +All data is stored in memory in little endian format. Each cell in t= he > tables +contains one byte. > + > +.. flat-table:: VSP1 HGT Data - (776 bytes) > + :header-rows: 2 > + :stub-columns: 0 > + > + * - Offset > + - :cspan:`4` Memory > + * - > + - [31:24] > + - [23:16] > + - [15:8] > + - [7:0] > + * - 0 > + - - > + - S max [7:0] > + - - > + - S min [7:0] > + * - 4 > + - :cspan:`4` S sum [31:0] > + * - 8 > + - :cspan:`4` Histogram bucket (m=3D0, n=3D0) [31:0] > + * - 12 > + - :cspan:`4` Histogram bucket (m=3D0, n=3D1) [31:0] > + * - > + - :cspan:`4` ... > + * - 132 > + - :cspan:`4` Histogram bucket (m=3D0, n=3D31) [31:0] > + * - 136 > + - :cspan:`4` Histogram bucket (m=3D1, n=3D0) [31:0] > + * - > + - :cspan:`4` ... > + * - 264 > + - :cspan:`4` Histogram bucket (m=3D2, n=3D0) [31:0] > + * - > + - :cspan:`4` ... > + * - 392 > + - :cspan:`4` Histogram bucket (m=3D3, n=3D0) [31:0] > + * - > + - :cspan:`4` ... > + * - 520 > + - :cspan:`4` Histogram bucket (m=3D4, n=3D0) [31:0] > + * - > + - :cspan:`4` ... > + * - 648 > + - :cspan:`4` Histogram bucket (m=3D5, n=3D0) [31:0] > + * - > + - :cspan:`4` ... > + * - 772 > + - :cspan:`4` Histogram bucket (m=3D5, n=3D31) [31:0] > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c > b/drivers/media/v4l2-core/v4l2-ioctl.c index b7f7d5f..f459c4f 100644 > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > @@ -1259,6 +1259,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdes= c *fmt) > case V4L2_SDR_FMT_CS14LE:=09descr =3D "Complex S14LE"; break; > =09case V4L2_SDR_FMT_RU12LE:=09descr =3D "Real U12LE"; break; > =09case V4L2_META_FMT_VSP1_HGO:=09descr =3D "R-Car VSP1 1-D Histogra= m";=20 break; > +=09case V4L2_META_FMT_VSP1_HGT:=09descr =3D "R-Car VSP1 2-D Histogra= m";=20 break; >=20 > =09default: > =09=09/* Compressed formats */ > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/vide= odev2.h > index 1dbe52a..c8c046c 100644 > --- a/include/uapi/linux/videodev2.h > +++ b/include/uapi/linux/videodev2.h > @@ -638,7 +638,8 @@ struct v4l2_pix_format { > #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /*= real > u12le */ >=20 > /* Meta-data formats */ > -#define V4L2_META_FMT_VSP1_HGO v4l2_fourcc('V', 'S', 'P', 'H') /*= R-Car > VSP1 Histogram */ +#define V4L2_META_FMT_VSP1_HGO v4l2_fourcc('V',= 'S', > 'P', 'H') /* R-Car VSP1 1-D Histogram */ +#define V4L2_META_FMT_VSP1_= HGT =20 > v4l2_fourcc('V', 'S', 'P', 'T') /* R-Car VSP1 2-D Histogram */ >=20 > /* priv field value to indicates that subsequent fields are valid. *= / > #define V4L2_PIX_FMT_PRIV_MAGIC=09=090xfeedcafe --=20 Regards, Laurent Pinchart