Merge tag 'v5.0-rc5' of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds...
[sfrench/cifs-2.6.git] / Documentation / media / uapi / v4l / pixfmt-meta-vsp1-hgt.rst
1 .. Permission is granted to copy, distribute and/or modify this
2 .. document under the terms of the GNU Free Documentation License,
3 .. Version 1.1 or any later version published by the Free Software
4 .. Foundation, with no Invariant Sections, no Front-Cover Texts
5 .. and no Back-Cover Texts. A copy of the license is included at
6 .. Documentation/media/uapi/fdl-appendix.rst.
7 ..
8 .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
9
10 .. _v4l2-meta-fmt-vsp1-hgt:
11
12 *******************************
13 V4L2_META_FMT_VSP1_HGT ('VSPT')
14 *******************************
15
16 Renesas R-Car VSP1 2-D Histogram Data
17
18
19 Description
20 ===========
21
22 This format describes histogram data generated by the Renesas R-Car VSP1
23 2-D Histogram (HGT) engine.
24
25 The VSP1 HGT is a histogram computation engine that operates on HSV
26 data. It operates on a possibly cropped and subsampled input image and
27 computes the sum, maximum and minimum of the S component as well as a
28 weighted frequency histogram based on the H and S components.
29
30 The histogram is a matrix of 6 Hue and 32 Saturation buckets, 192 in
31 total. Each HSV value is added to one or more buckets with a weight
32 between 1 and 16 depending on the Hue areas configuration. Finding the
33 corresponding buckets is done by inspecting the H and S value independently.
34
35 The Saturation position **n** (0 - 31) of the bucket in the matrix is
36 found by the expression:
37
38     n = S / 8
39
40 The Hue position **m** (0 - 5) of the bucket in the matrix depends on
41 how the HGT Hue areas are configured. There are 6 user configurable Hue
42 Areas which can be configured to cover overlapping Hue values:
43
44 ::
45
46          Area 0       Area 1       Area 2       Area 3       Area 4       Area 5
47         ________     ________     ________     ________     ________     ________
48    \   /|      |\   /|      |\   /|      |\   /|      |\   /|      |\   /|      |\   /
49     \ / |      | \ / |      | \ / |      | \ / |      | \ / |      | \ / |      | \ /
50      X  |      |  X  |      |  X  |      |  X  |      |  X  |      |  X  |      |  X
51     / \ |      | / \ |      | / \ |      | / \ |      | / \ |      | / \ |      | / \
52    /   \|      |/   \|      |/   \|      |/   \|      |/   \|      |/   \|      |/   \
53   5U   0L      0U   1L      1U   2L      2U   3L      3U   4L      4U   5L      5U   0L
54         <0..............................Hue Value............................255>
55
56 When two consecutive areas don't overlap (n+1L is equal to nU) the boundary
57 value is considered as part of the lower area.
58
59 Pixels with a hue value included in the centre of an area (between nL and nU
60 included) are attributed to that single area and given a weight of 16. Pixels
61 with a hue value included in the overlapping region between two areas (between
62 n+1L and nU excluded) are attributed to both areas and given a weight for each
63 of these areas proportional to their position along the diagonal lines
64 (rounded down).
65
66 The Hue area setup must match one of the following constrains:
67
68 ::
69
70     0L <= 0U <= 1L <= 1U <= 2L <= 2U <= 3L <= 3U <= 4L <= 4U <= 5L <= 5U
71
72 ::
73
74     0U <= 1L <= 1U <= 2L <= 2U <= 3L <= 3U <= 4L <= 4U <= 5L <= 5U <= 0L
75
76 **Byte Order.**
77 All data is stored in memory in little endian format. Each cell in the tables
78 contains one byte.
79
80 .. flat-table:: VSP1 HGT Data - (776 bytes)
81     :header-rows:  2
82     :stub-columns: 0
83
84     * - Offset
85       - :cspan:`4` Memory
86     * -
87       - [31:24]
88       - [23:16]
89       - [15:8]
90       - [7:0]
91     * - 0
92       - -
93       - S max [7:0]
94       - -
95       - S min [7:0]
96     * - 4
97       - :cspan:`4` S sum [31:0]
98     * - 8
99       - :cspan:`4` Histogram bucket (m=0, n=0) [31:0]
100     * - 12
101       - :cspan:`4` Histogram bucket (m=0, n=1) [31:0]
102     * -
103       - :cspan:`4` ...
104     * - 132
105       - :cspan:`4` Histogram bucket (m=0, n=31) [31:0]
106     * - 136
107       - :cspan:`4` Histogram bucket (m=1, n=0) [31:0]
108     * -
109       - :cspan:`4` ...
110     * - 264
111       - :cspan:`4` Histogram bucket (m=2, n=0) [31:0]
112     * -
113       - :cspan:`4` ...
114     * - 392
115       - :cspan:`4` Histogram bucket (m=3, n=0) [31:0]
116     * -
117       - :cspan:`4` ...
118     * - 520
119       - :cspan:`4` Histogram bucket (m=4, n=0) [31:0]
120     * -
121       - :cspan:`4` ...
122     * - 648
123       - :cspan:`4` Histogram bucket (m=5, n=0) [31:0]
124     * -
125       - :cspan:`4` ...
126     * - 772
127       - :cspan:`4` Histogram bucket (m=5, n=31) [31:0]