libcamera: control_serializer: Remove unnecessary allocation

In between versions of the patch "libcamera: control_serializer: Add
array info to serialized ControlValue", ipa_control_value_entry was
changed to be members of ipa_control_info_entry as opposed to being
serialized at the same level. The binarySize/entriesSize computation was
not updated, however, leaving some extra memory allocated for the
serialized form of ControlInfoMap.

Fix this by removing the extra size for 3 * ipa_control_value_entry.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Paul Elder
2025-12-27 10:38:28 +09:00
parent aaa48bb276
commit 5e59969dbb

View File

@@ -164,8 +164,7 @@ size_t ControlSerializer::binarySize(const ControlInfo &info)
size_t ControlSerializer::binarySize(const ControlInfoMap &infoMap)
{
size_t size = sizeof(struct ipa_controls_header)
+ infoMap.size() * (sizeof(struct ipa_control_info_entry) +
3 * sizeof(struct ipa_control_value_entry));
+ infoMap.size() * sizeof(struct ipa_control_info_entry);
for (const auto &ctrl : infoMap)
size += binarySize(ctrl.second);
@@ -234,8 +233,7 @@ int ControlSerializer::serialize(const ControlInfoMap &infoMap,
/* Compute entries and data required sizes. */
size_t entriesSize = infoMap.size()
* (sizeof(struct ipa_control_info_entry) +
3 * sizeof(struct ipa_control_value_entry));
* sizeof(struct ipa_control_info_entry);
size_t valuesSize = 0;
for (const auto &ctrl : infoMap)
valuesSize += binarySize(ctrl.second);