# V4L2_META_FMT_VSP1_HGT ('VSPT')

_Peios Kernel / Userspace interfaces / System and device interfaces / Video4Linux_

> Renesas R-Car VSP1 2-D Histogram Data

<a id="rst-v4l2-meta-fmt-vsp1-hgt-vspt"></a>
<a id="rst-v4l2-meta-fmt-vsp1-hgt"></a>

<!-- SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later -->

<!-- c:namespace: V4L -->

Renesas R-Car VSP1 2-D Histogram Data

<a id="rst-description"></a>

## Description

This format describes histogram data generated by the Renesas R-Car VSP1 2-D Histogram (HGT) engine.

The VSP1 HGT is a histogram computation engine that operates on HSV data. It operates on a possibly cropped and subsampled input image and computes the sum, maximum and minimum of the S component as well as a weighted frequency histogram based on the H and S components.

The histogram is a matrix of 6 Hue and 32 Saturation buckets, 192 in total. Each HSV value is added to one or more buckets with a weight between 1 and 16 depending on the Hue areas configuration. Finding the corresponding buckets is done by inspecting the H and S value independently.

The Saturation position <strong>n</strong> (0 - 31) of the bucket in the matrix is found by the expression:

> n = S / 8

The Hue position <strong>m</strong> (0 - 5) of the bucket in the matrix depends on how the HGT Hue areas are configured. There are 6 user configurable Hue Areas which can be configured to cover overlapping Hue values:

<!-- Source LaTeX layout: \small -->



```text
       Area 0       Area 1       Area 2       Area 3       Area 4       Area 5
      ________     ________     ________     ________     ________     ________
 \   /|      |\   /|      |\   /|      |\   /|      |\   /|      |\   /|      |\   /
  \ / |      | \ / |      | \ / |      | \ / |      | \ / |      | \ / |      | \ /
   X  |      |  X  |      |  X  |      |  X  |      |  X  |      |  X  |      |  X
  / \ |      | / \ |      | / \ |      | / \ |      | / \ |      | / \ |      | / \
 /   \|      |/   \|      |/   \|      |/   \|      |/   \|      |/   \|      |/   \
5U   0L      0U   1L      1U   2L      2U   3L      3U   4L      4U   5L      5U   0L
      <0..............................Hue Value............................255>
```

<!-- Source LaTeX layout: \normalsize -->

When two consecutive areas don't overlap (n+1L is equal to nU) the boundary value is considered as part of the lower area.

Pixels with a hue value included in the centre of an area (between nL and nU included) are attributed to that single area and given a weight of 16. Pixels with a hue value included in the overlapping region between two areas (between n+1L and nU excluded) are attributed to both areas and given a weight for each of these areas proportional to their position along the diagonal lines (rounded down).

The Hue area setup must match one of the following constrains:



```text
0L <= 0U <= 1L <= 1U <= 2L <= 2U <= 3L <= 3U <= 4L <= 4U <= 5L <= 5U
```



```text
0U <= 1L <= 1U <= 2L <= 2U <= 3L <= 3U <= 4L <= 4U <= 5L <= 5U <= 0L
```

<strong>Byte Order.</strong> All data is stored in memory in little endian format. Each cell in the tables contains one byte.


<table>
<caption>

VSP1 HGT Data - (776 bytes)

</caption>
<thead>
<tr>
<th>



Offset

</th>
<th colspan="5">



 Memory

</th>
</tr>
<tr>
<th>





</th>
<th>



\[31:24\]

</th>
<th>



\[23:16\]

</th>
<th>



\[15:8\]

</th>
<th colspan="2">



\[7:0\]

</th>
</tr>
</thead>
<tbody>
<tr>
<td>



0

</td>
<td>



- <!-- empty source list item -->

</td>
<td>



S max \[7:0\]

</td>
<td>



- <!-- empty source list item -->

</td>
<td colspan="2">



S min \[7:0\]

</td>
</tr>
<tr>
<td>



4

</td>
<td colspan="5">



 S sum \[31:0\]

</td>
</tr>
<tr>
<td>



8

</td>
<td colspan="5">



 Histogram bucket (m=0, n=0) \[31:0\]

</td>
</tr>
<tr>
<td>



12

</td>
<td colspan="5">



 Histogram bucket (m=0, n=1) \[31:0\]

</td>
</tr>
<tr>
<td>





</td>
<td colspan="5">



 ...

</td>
</tr>
<tr>
<td>



132

</td>
<td colspan="5">



 Histogram bucket (m=0, n=31) \[31:0\]

</td>
</tr>
<tr>
<td>



136

</td>
<td colspan="5">



 Histogram bucket (m=1, n=0) \[31:0\]

</td>
</tr>
<tr>
<td>





</td>
<td colspan="5">



 ...

</td>
</tr>
<tr>
<td>



264

</td>
<td colspan="5">



 Histogram bucket (m=2, n=0) \[31:0\]

</td>
</tr>
<tr>
<td>





</td>
<td colspan="5">



 ...

</td>
</tr>
<tr>
<td>



392

</td>
<td colspan="5">



 Histogram bucket (m=3, n=0) \[31:0\]

</td>
</tr>
<tr>
<td>





</td>
<td colspan="5">



 ...

</td>
</tr>
<tr>
<td>



520

</td>
<td colspan="5">



 Histogram bucket (m=4, n=0) \[31:0\]

</td>
</tr>
<tr>
<td>





</td>
<td colspan="5">



 ...

</td>
</tr>
<tr>
<td>



648

</td>
<td colspan="5">



 Histogram bucket (m=5, n=0) \[31:0\]

</td>
</tr>
<tr>
<td>





</td>
<td colspan="5">



 ...

</td>
</tr>
<tr>
<td>



772

</td>
<td colspan="5">



 Histogram bucket (m=5, n=31) \[31:0\]

</td>
</tr>
</tbody>
</table>
