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