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