libcamera: controls: Add zero-copy set API for ControlValue
Extend the ControlValue class with a reserve() function to set the value without actually copying data, and a non-const data() function that allows writing data directly to the ControlValue storage. This allows allocating memory directly in ControlValue, potentially removing a data copy. Note that this change was implemented before ByteStreamBuffer gained the zero-copy read() variant, and doesn't actually save a copy in the control serializer. It however still simplifies ControlSerializer::loadControlValue(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
@@ -40,9 +40,6 @@ private:
|
||||
static void store(const ControlValue &value, ByteStreamBuffer &buffer);
|
||||
static void store(const ControlInfo &info, ByteStreamBuffer &buffer);
|
||||
|
||||
template<typename T>
|
||||
ControlValue loadControlValue(ByteStreamBuffer &buffer, bool isArray,
|
||||
unsigned int count);
|
||||
ControlValue loadControlValue(ControlType type, ByteStreamBuffer &buffer,
|
||||
bool isArray = false, unsigned int count = 1);
|
||||
ControlInfo loadControlInfo(ControlType type, ByteStreamBuffer &buffer);
|
||||
|
||||
Reference in New Issue
Block a user