MIRA
Toolbox CommonCodecs


CommonCodecs

This toolbox contains a list of commonly used codecs for encoding and decoding data using a mira::BinarySerializer and mira::BinaryDeserializer .

Currently there exist 4 codecs for encoding images:

Example for serializing data with JPEG Codec:

BinaryBufferSerializer serializer(&buf);
// add a JpegCodec to the serializer
serializer.registerCodec(BinarySerializerCodecPtr(new JpegCodec(95)));
Img8U3 img;
...
// serialize the image using the JpegCodec
serializer.serialize(img);

Example for deserializing encoded data

... load encoded data into buf
BinaryBufferDeserializer deserializer(&buf);
Img8U3 img;
...
// deserialize the image (JpegCodec will be used automatically if necessary)
serializer.serialize(img);

Please note, that for the deserialization no special handling is necessary. If the deserializer detects encoded data, it will automatically use the correct codec (that is identified by the FOURCC code) to decode the data.