xref: /OK3568_Linux_fs/kernel/Documentation/userspace-api/media/v4l/pixfmt-meta-vsp1-hgt.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun.. _v4l2-meta-fmt-vsp1-hgt:
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun*******************************
6*4882a593SmuzhiyunV4L2_META_FMT_VSP1_HGT ('VSPT')
7*4882a593Smuzhiyun*******************************
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunRenesas R-Car VSP1 2-D Histogram Data
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunDescription
13*4882a593Smuzhiyun===========
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunThis format describes histogram data generated by the Renesas R-Car VSP1
16*4882a593Smuzhiyun2-D Histogram (HGT) engine.
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunThe VSP1 HGT is a histogram computation engine that operates on HSV
19*4882a593Smuzhiyundata. It operates on a possibly cropped and subsampled input image and
20*4882a593Smuzhiyuncomputes the sum, maximum and minimum of the S component as well as a
21*4882a593Smuzhiyunweighted frequency histogram based on the H and S components.
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunThe histogram is a matrix of 6 Hue and 32 Saturation buckets, 192 in
24*4882a593Smuzhiyuntotal. Each HSV value is added to one or more buckets with a weight
25*4882a593Smuzhiyunbetween 1 and 16 depending on the Hue areas configuration. Finding the
26*4882a593Smuzhiyuncorresponding buckets is done by inspecting the H and S value independently.
27*4882a593Smuzhiyun
28*4882a593SmuzhiyunThe Saturation position **n** (0 - 31) of the bucket in the matrix is
29*4882a593Smuzhiyunfound by the expression:
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun    n = S / 8
32*4882a593Smuzhiyun
33*4882a593SmuzhiyunThe Hue position **m** (0 - 5) of the bucket in the matrix depends on
34*4882a593Smuzhiyunhow the HGT Hue areas are configured. There are 6 user configurable Hue
35*4882a593SmuzhiyunAreas which can be configured to cover overlapping Hue values:
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun.. raw:: latex
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun    \small
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun::
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun         Area 0       Area 1       Area 2       Area 3       Area 4       Area 5
44*4882a593Smuzhiyun        ________     ________     ________     ________     ________     ________
45*4882a593Smuzhiyun   \   /|      |\   /|      |\   /|      |\   /|      |\   /|      |\   /|      |\   /
46*4882a593Smuzhiyun    \ / |      | \ / |      | \ / |      | \ / |      | \ / |      | \ / |      | \ /
47*4882a593Smuzhiyun     X  |      |  X  |      |  X  |      |  X  |      |  X  |      |  X  |      |  X
48*4882a593Smuzhiyun    / \ |      | / \ |      | / \ |      | / \ |      | / \ |      | / \ |      | / \
49*4882a593Smuzhiyun   /   \|      |/   \|      |/   \|      |/   \|      |/   \|      |/   \|      |/   \
50*4882a593Smuzhiyun  5U   0L      0U   1L      1U   2L      2U   3L      3U   4L      4U   5L      5U   0L
51*4882a593Smuzhiyun        <0..............................Hue Value............................255>
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun.. raw:: latex
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun    \normalsize
57*4882a593Smuzhiyun
58*4882a593SmuzhiyunWhen two consecutive areas don't overlap (n+1L is equal to nU) the boundary
59*4882a593Smuzhiyunvalue is considered as part of the lower area.
60*4882a593Smuzhiyun
61*4882a593SmuzhiyunPixels with a hue value included in the centre of an area (between nL and nU
62*4882a593Smuzhiyunincluded) are attributed to that single area and given a weight of 16. Pixels
63*4882a593Smuzhiyunwith a hue value included in the overlapping region between two areas (between
64*4882a593Smuzhiyunn+1L and nU excluded) are attributed to both areas and given a weight for each
65*4882a593Smuzhiyunof these areas proportional to their position along the diagonal lines
66*4882a593Smuzhiyun(rounded down).
67*4882a593Smuzhiyun
68*4882a593SmuzhiyunThe Hue area setup must match one of the following constrains:
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun::
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun    0L <= 0U <= 1L <= 1U <= 2L <= 2U <= 3L <= 3U <= 4L <= 4U <= 5L <= 5U
73*4882a593Smuzhiyun
74*4882a593Smuzhiyun::
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun    0U <= 1L <= 1U <= 2L <= 2U <= 3L <= 3U <= 4L <= 4U <= 5L <= 5U <= 0L
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun**Byte Order.**
79*4882a593SmuzhiyunAll data is stored in memory in little endian format. Each cell in the tables
80*4882a593Smuzhiyuncontains one byte.
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun.. flat-table:: VSP1 HGT Data - (776 bytes)
83*4882a593Smuzhiyun    :header-rows:  2
84*4882a593Smuzhiyun    :stub-columns: 0
85*4882a593Smuzhiyun
86*4882a593Smuzhiyun    * - Offset
87*4882a593Smuzhiyun      - :cspan:`4` Memory
88*4882a593Smuzhiyun    * -
89*4882a593Smuzhiyun      - [31:24]
90*4882a593Smuzhiyun      - [23:16]
91*4882a593Smuzhiyun      - [15:8]
92*4882a593Smuzhiyun      - [7:0]
93*4882a593Smuzhiyun    * - 0
94*4882a593Smuzhiyun      - -
95*4882a593Smuzhiyun      - S max [7:0]
96*4882a593Smuzhiyun      - -
97*4882a593Smuzhiyun      - S min [7:0]
98*4882a593Smuzhiyun    * - 4
99*4882a593Smuzhiyun      - :cspan:`4` S sum [31:0]
100*4882a593Smuzhiyun    * - 8
101*4882a593Smuzhiyun      - :cspan:`4` Histogram bucket (m=0, n=0) [31:0]
102*4882a593Smuzhiyun    * - 12
103*4882a593Smuzhiyun      - :cspan:`4` Histogram bucket (m=0, n=1) [31:0]
104*4882a593Smuzhiyun    * -
105*4882a593Smuzhiyun      - :cspan:`4` ...
106*4882a593Smuzhiyun    * - 132
107*4882a593Smuzhiyun      - :cspan:`4` Histogram bucket (m=0, n=31) [31:0]
108*4882a593Smuzhiyun    * - 136
109*4882a593Smuzhiyun      - :cspan:`4` Histogram bucket (m=1, n=0) [31:0]
110*4882a593Smuzhiyun    * -
111*4882a593Smuzhiyun      - :cspan:`4` ...
112*4882a593Smuzhiyun    * - 264
113*4882a593Smuzhiyun      - :cspan:`4` Histogram bucket (m=2, n=0) [31:0]
114*4882a593Smuzhiyun    * -
115*4882a593Smuzhiyun      - :cspan:`4` ...
116*4882a593Smuzhiyun    * - 392
117*4882a593Smuzhiyun      - :cspan:`4` Histogram bucket (m=3, n=0) [31:0]
118*4882a593Smuzhiyun    * -
119*4882a593Smuzhiyun      - :cspan:`4` ...
120*4882a593Smuzhiyun    * - 520
121*4882a593Smuzhiyun      - :cspan:`4` Histogram bucket (m=4, n=0) [31:0]
122*4882a593Smuzhiyun    * -
123*4882a593Smuzhiyun      - :cspan:`4` ...
124*4882a593Smuzhiyun    * - 648
125*4882a593Smuzhiyun      - :cspan:`4` Histogram bucket (m=5, n=0) [31:0]
126*4882a593Smuzhiyun    * -
127*4882a593Smuzhiyun      - :cspan:`4` ...
128*4882a593Smuzhiyun    * - 772
129*4882a593Smuzhiyun      - :cspan:`4` Histogram bucket (m=5, n=31) [31:0]
130