[libcamera-devel] [RFC PATCH 02/10] libcamera: ipa_data_serializer: Modify (de)serialization for offset
Jacopo Mondi
jacopo at jmondi.org
Wed Aug 18 11:58:29 CEST 2021
Hello,
On Mon, Aug 16, 2021 at 01:31:30PM +0900, Hirokazu Honda wrote:
> The offset variable is added to FrameBuffer::Plane. This modifies
> the serialization and deserialization code for the offset variable.
>
> Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
> ---
> src/libcamera/ipa_data_serializer.cpp | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/libcamera/ipa_data_serializer.cpp b/src/libcamera/ipa_data_serializer.cpp
> index fb941e6b..144c3248 100644
> --- a/src/libcamera/ipa_data_serializer.cpp
> +++ b/src/libcamera/ipa_data_serializer.cpp
> @@ -562,6 +562,7 @@ FileDescriptor IPADataSerializer<FileDescriptor>::deserialize(const std::vector<
> * FrameBuffer::Plane is serialized as:
> *
> * 1 byte - FileDescriptor
> + * 4 bytes - uint32_t Offset
> * 4 bytes - uint32_t Length
> */
> template<>
> @@ -580,6 +581,7 @@ IPADataSerializer<FrameBuffer::Plane>::serialize(const FrameBuffer::Plane &data,
> fdsVec.insert(fdsVec.end(), fdFds.begin(), fdFds.end());
>
> appendPOD<uint32_t>(dataVec, data.length);
> + appendPOD<uint32_t>(dataVec, data.offset);
>
> return { dataVec, fdsVec };
> }
> @@ -596,7 +598,8 @@ IPADataSerializer<FrameBuffer::Plane>::deserialize(std::vector<uint8_t>::const_i
>
> ret.fd = IPADataSerializer<FileDescriptor>::deserialize(dataBegin, dataBegin + 1,
> fdsBegin, fdsBegin + 1);
> - ret.length = readPOD<uint32_t>(dataBegin, 1, dataEnd);
> + ret.offset = readPOD<uint32_t>(dataBegin, 1, dataBegin + 2);
> + ret.length = readPOD<uint32_t>(dataBegin + 1, 1, dataEnd);
Am I wrong ot offset is appeneded at the end of dataVec (after lenght) and
then read from the beginning (before lenght) ?
>
> return ret;
> }
> --
> 2.33.0.rc1.237.g0d66db33f3-goog
>
More information about the libcamera-devel
mailing list