libcamera
v0.8.0
Supporting cameras in Linux since 2019
Toggle main menu visibility
Loading...
Searching...
No Matches
v4l2_stats.h
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2
/*
3
* Copyright (C) 2026, Ideas On Board
4
*
5
* V4L2 ISP Statistics
6
*/
7
8
#pragma once
9
10
#include <map>
11
#include <span>
12
#include <stdint.h>
13
14
#include <linux/media/v4l2-isp.h>
15
16
namespace
libcamera
{
17
18
namespace
ipa
{
19
20
class
V4L2StatsBase
21
{
22
public
:
23
V4L2StatsBase
(std::span<uint8_t> data,
unsigned
int
version);
24
25
std::span<const uint8_t>
block
(
unsigned
int
blockType,
size_t
blockSize)
const
;
26
constexpr
explicit
operator
bool()
27
{
28
return
valid_;
29
}
30
31
private
:
32
std::map<uint16_t, std::span<const uint8_t>> cache_;
33
std::span<uint8_t> data_;
34
bool
valid_;
35
};
36
37
template
<
typename
Traits>
38
class
V4L2Stats
:
public
V4L2StatsBase
39
{
40
public
:
41
static_assert
(std::is_same_v<std::underlying_type_t<typename Traits::id_type>, uint16_t>);
42
43
V4L2Stats
(std::span<uint8_t> data,
unsigned
int
version)
44
:
V4L2StatsBase
(data, version)
45
{
46
}
47
48
template
<
typename
Traits::
id
_type Id>
49
const
typename
Traits::template id_to_details<Id>::type *
50
block
()
const
51
{
52
using
Details =
typename
Traits::template id_to_details<Id>;
53
54
using
Type =
typename
Details::type;
55
constexpr
auto
kernelId = Details::blockType;
56
57
auto
data =
V4L2StatsBase::block
(kernelId,
sizeof
(Type));
58
59
return
data.size() > 0 ?
60
reinterpret_cast<
const
Type *
>
(data.data()) :
nullptr
;
61
}
62
};
63
64
}
/* namespace ipa */
65
66
}
/* namespace libcamera */
libcamera::ipa::V4L2StatsBase::V4L2StatsBase
V4L2StatsBase(std::span< uint8_t > data, unsigned int version)
Construct an instance of V4L2StatsBase.
Definition
v4l2_stats.cpp:57
libcamera::ipa::V4L2StatsBase::block
std::span< const uint8_t > block(unsigned int blockType, size_t blockSize) const
Retrieve an ISP statistics block and return a reference to it.
Definition
v4l2_stats.cpp:122
libcamera::ipa::V4L2Stats::V4L2Stats
V4L2Stats(std::span< uint8_t > data, unsigned int version)
Construct an instance of V4L2Stats.
Definition
v4l2_stats.h:43
libcamera::ipa::V4L2Stats::block
const Traits::template id_to_details< Id >::type * block() const
Retrieve a pointer to an ISP statistics block.
Definition
v4l2_stats.h:50
libcamera::ipa
The IPA (Image Processing Algorithm) namespace.
Definition
af.cpp:58
libcamera
Top-level libcamera namespace.
Definition
backtrace.h:17
src
ipa
libipa
v4l2_stats.h
Generated by
1.17.0