18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci.. _v4l2-meta-fmt-vsp1-hgt:
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci*******************************
68c2ecf20Sopenharmony_ciV4L2_META_FMT_VSP1_HGT ('VSPT')
78c2ecf20Sopenharmony_ci*******************************
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciRenesas R-Car VSP1 2-D Histogram Data
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciDescription
138c2ecf20Sopenharmony_ci===========
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciThis format describes histogram data generated by the Renesas R-Car VSP1
168c2ecf20Sopenharmony_ci2-D Histogram (HGT) engine.
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciThe VSP1 HGT is a histogram computation engine that operates on HSV
198c2ecf20Sopenharmony_cidata. It operates on a possibly cropped and subsampled input image and
208c2ecf20Sopenharmony_cicomputes the sum, maximum and minimum of the S component as well as a
218c2ecf20Sopenharmony_ciweighted frequency histogram based on the H and S components.
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ciThe histogram is a matrix of 6 Hue and 32 Saturation buckets, 192 in
248c2ecf20Sopenharmony_citotal. Each HSV value is added to one or more buckets with a weight
258c2ecf20Sopenharmony_cibetween 1 and 16 depending on the Hue areas configuration. Finding the
268c2ecf20Sopenharmony_cicorresponding buckets is done by inspecting the H and S value independently.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciThe Saturation position **n** (0 - 31) of the bucket in the matrix is
298c2ecf20Sopenharmony_cifound by the expression:
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci    n = S / 8
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ciThe Hue position **m** (0 - 5) of the bucket in the matrix depends on
348c2ecf20Sopenharmony_cihow the HGT Hue areas are configured. There are 6 user configurable Hue
358c2ecf20Sopenharmony_ciAreas which can be configured to cover overlapping Hue values:
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci.. raw:: latex
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci    \small
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci::
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci         Area 0       Area 1       Area 2       Area 3       Area 4       Area 5
448c2ecf20Sopenharmony_ci        ________     ________     ________     ________     ________     ________
458c2ecf20Sopenharmony_ci   \   /|      |\   /|      |\   /|      |\   /|      |\   /|      |\   /|      |\   /
468c2ecf20Sopenharmony_ci    \ / |      | \ / |      | \ / |      | \ / |      | \ / |      | \ / |      | \ /
478c2ecf20Sopenharmony_ci     X  |      |  X  |      |  X  |      |  X  |      |  X  |      |  X  |      |  X
488c2ecf20Sopenharmony_ci    / \ |      | / \ |      | / \ |      | / \ |      | / \ |      | / \ |      | / \
498c2ecf20Sopenharmony_ci   /   \|      |/   \|      |/   \|      |/   \|      |/   \|      |/   \|      |/   \
508c2ecf20Sopenharmony_ci  5U   0L      0U   1L      1U   2L      2U   3L      3U   4L      4U   5L      5U   0L
518c2ecf20Sopenharmony_ci        <0..............................Hue Value............................255>
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci.. raw:: latex
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci    \normalsize
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ciWhen two consecutive areas don't overlap (n+1L is equal to nU) the boundary
598c2ecf20Sopenharmony_civalue is considered as part of the lower area.
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ciPixels with a hue value included in the centre of an area (between nL and nU
628c2ecf20Sopenharmony_ciincluded) are attributed to that single area and given a weight of 16. Pixels
638c2ecf20Sopenharmony_ciwith a hue value included in the overlapping region between two areas (between
648c2ecf20Sopenharmony_cin+1L and nU excluded) are attributed to both areas and given a weight for each
658c2ecf20Sopenharmony_ciof these areas proportional to their position along the diagonal lines
668c2ecf20Sopenharmony_ci(rounded down).
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ciThe Hue area setup must match one of the following constrains:
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci::
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci    0L <= 0U <= 1L <= 1U <= 2L <= 2U <= 3L <= 3U <= 4L <= 4U <= 5L <= 5U
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci::
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci    0U <= 1L <= 1U <= 2L <= 2U <= 3L <= 3U <= 4L <= 4U <= 5L <= 5U <= 0L
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci**Byte Order.**
798c2ecf20Sopenharmony_ciAll data is stored in memory in little endian format. Each cell in the tables
808c2ecf20Sopenharmony_cicontains one byte.
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci.. flat-table:: VSP1 HGT Data - (776 bytes)
838c2ecf20Sopenharmony_ci    :header-rows:  2
848c2ecf20Sopenharmony_ci    :stub-columns: 0
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci    * - Offset
878c2ecf20Sopenharmony_ci      - :cspan:`4` Memory
888c2ecf20Sopenharmony_ci    * -
898c2ecf20Sopenharmony_ci      - [31:24]
908c2ecf20Sopenharmony_ci      - [23:16]
918c2ecf20Sopenharmony_ci      - [15:8]
928c2ecf20Sopenharmony_ci      - [7:0]
938c2ecf20Sopenharmony_ci    * - 0
948c2ecf20Sopenharmony_ci      - -
958c2ecf20Sopenharmony_ci      - S max [7:0]
968c2ecf20Sopenharmony_ci      - -
978c2ecf20Sopenharmony_ci      - S min [7:0]
988c2ecf20Sopenharmony_ci    * - 4
998c2ecf20Sopenharmony_ci      - :cspan:`4` S sum [31:0]
1008c2ecf20Sopenharmony_ci    * - 8
1018c2ecf20Sopenharmony_ci      - :cspan:`4` Histogram bucket (m=0, n=0) [31:0]
1028c2ecf20Sopenharmony_ci    * - 12
1038c2ecf20Sopenharmony_ci      - :cspan:`4` Histogram bucket (m=0, n=1) [31:0]
1048c2ecf20Sopenharmony_ci    * -
1058c2ecf20Sopenharmony_ci      - :cspan:`4` ...
1068c2ecf20Sopenharmony_ci    * - 132
1078c2ecf20Sopenharmony_ci      - :cspan:`4` Histogram bucket (m=0, n=31) [31:0]
1088c2ecf20Sopenharmony_ci    * - 136
1098c2ecf20Sopenharmony_ci      - :cspan:`4` Histogram bucket (m=1, n=0) [31:0]
1108c2ecf20Sopenharmony_ci    * -
1118c2ecf20Sopenharmony_ci      - :cspan:`4` ...
1128c2ecf20Sopenharmony_ci    * - 264
1138c2ecf20Sopenharmony_ci      - :cspan:`4` Histogram bucket (m=2, n=0) [31:0]
1148c2ecf20Sopenharmony_ci    * -
1158c2ecf20Sopenharmony_ci      - :cspan:`4` ...
1168c2ecf20Sopenharmony_ci    * - 392
1178c2ecf20Sopenharmony_ci      - :cspan:`4` Histogram bucket (m=3, n=0) [31:0]
1188c2ecf20Sopenharmony_ci    * -
1198c2ecf20Sopenharmony_ci      - :cspan:`4` ...
1208c2ecf20Sopenharmony_ci    * - 520
1218c2ecf20Sopenharmony_ci      - :cspan:`4` Histogram bucket (m=4, n=0) [31:0]
1228c2ecf20Sopenharmony_ci    * -
1238c2ecf20Sopenharmony_ci      - :cspan:`4` ...
1248c2ecf20Sopenharmony_ci    * - 648
1258c2ecf20Sopenharmony_ci      - :cspan:`4` Histogram bucket (m=5, n=0) [31:0]
1268c2ecf20Sopenharmony_ci    * -
1278c2ecf20Sopenharmony_ci      - :cspan:`4` ...
1288c2ecf20Sopenharmony_ci    * - 772
1298c2ecf20Sopenharmony_ci      - :cspan:`4` Histogram bucket (m=5, n=31) [31:0]
130