Files
external_libcamera/include/libcamera/ipa/ipa_controls.h
Paul Elder cfdc281100 libcamera: control_serializer: Add array info to serialized ControlValue
Array controls (eg. ColourCorrectionMatrix, FrameDurationLimits,
ColourGains) are serialized properly by the ControlSerializer, but are
not deserialized properly. This is because their arrayness and size are
not considered during deserialization.

Fix this by adding arrayness and size to the serialized form of all
ControlValues. This is achieved by fully serializing the min/max/def
ControlValue's metadata associated with each ControlInfo entry in the
ControlInfoMap.

While at it, clean up the serialization format of ControlValues and
ControlLists:
- ControlValue's id is only used by ControlList, so add a new struct for
  ControlList entries to contain it, and remove id from ControlValue
- Remove offset from ControlInfo's entry, as it is no longer needed,
  since the serialized data of a ControlInfo has now been converted to
  simply three serialized ControlValues
- Remove the type from the serialized data of ControlValue, as it is
  already in the metadata entry

The issue regarding array controls was not noticed before because the
default value of the ControlInfo of other array controls had been set to
scalar values similar to how min/max are set, and ColourCorrectionMatrix
was the first control to properly define a non-scalar default value.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=285
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> # rkisp1
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-11-26 16:52:19 +00:00

64 lines
1.0 KiB
C++

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* IPA Control handling
*/
#pragma once
#include <stdint.h>
#ifdef __cplusplus
namespace libcamera {
extern "C" {
#endif
#define IPA_CONTROLS_FORMAT_VERSION 2
enum ipa_controls_id_map_type {
IPA_CONTROL_ID_MAP_CONTROLS,
IPA_CONTROL_ID_MAP_PROPERTIES,
IPA_CONTROL_ID_MAP_V4L2,
};
struct ipa_controls_header {
uint32_t version;
uint32_t handle;
uint32_t entries;
uint32_t size;
uint32_t data_offset;
enum ipa_controls_id_map_type id_map_type;
uint32_t reserved[2];
};
struct ipa_control_value_entry {
uint8_t type;
uint8_t is_array;
uint16_t count;
uint32_t offset;
uint32_t reserved[2];
};
struct ipa_control_list_entry {
uint32_t id;
struct ipa_control_value_entry value;
};
struct ipa_control_info_entry {
uint32_t id;
uint32_t type;
uint8_t direction;
uint8_t padding[7];
struct ipa_control_value_entry min;
struct ipa_control_value_entry max;
struct ipa_control_value_entry def;
};
#ifdef __cplusplus
} /* namespace libcamera */
}
#endif