38 #ifndef LibMultiSense_DisparityMessage 39 #define LibMultiSense_DisparityMessage 47 namespace multisense {
62 #ifdef SENSORPOD_FIRMWARE 65 #endif // SENSORPOD_FIRMWARE 73 #ifdef SENSORPOD_FIRMWARE
82 #ifndef SENSORPOD_FIRMWARE 98 template<
class Archive>
106 const uint32_t imageSize =
static_cast<uint32_t
> (std::ceil(((
double) API_BITS_PER_PIXEL / 8.0) * width * height));
110 message.write(dataP, imageSize);
114 dataP = message.peek();
115 message.seek(message.tell() + imageSize);
123 const uint8_t *dataP,
134 stream.
write(dataP, META_LENGTH);
142 const uint8_t *sP = dataP;
143 const uint32_t sourceOffset = offset - META_LENGTH;
144 const uint32_t count = (8 * length) / WIRE_BITS_PER_PIXEL;
145 const uint32_t destOffset = META_LENGTH + (((8 * sourceOffset) / WIRE_BITS_PER_PIXEL) *
146 (API_BITS_PER_PIXEL / 8));
150 stream.
seek(destOffset);
155 if (12 == WIRE_BITS_PER_PIXEL && 16 == API_BITS_PER_PIXEL) {
157 uint16_t *dP =
reinterpret_cast<uint16_t*
>(stream.
peek());
159 for(uint32_t i=0; i<count; i+=2, sP+=3) {
160 dP[i] = ((sP[0] ) | ((sP[1] & 0x0F) << 8));
161 dP[i+1] = ((sP[1] >> 4) | (sP[2] << 4) );
167 }
else if (12 == WIRE_BITS_PER_PIXEL && 32 == API_BITS_PER_PIXEL) {
169 float *dP =
reinterpret_cast<float*
>(stream.
peek());
171 for(uint32_t i=0; i<count; i+=2, sP+=3) {
173 dP[i] =
static_cast<float>((sP[0] ) | ((sP[1] & 0x0F) << 8)) / 16.0f;
174 dP[i+1] =
static_cast<float>((sP[1] >> 4) | (sP[2] << 4) ) / 16.0
f;
179 WIRE_BITS_PER_PIXEL, API_BITS_PER_PIXEL);
183 #endif // !SENSORPOD_FIRMWARE
#define CRL_EXCEPTION(fmt,...)
virtual void write(const void *bufferP, std::size_t length)
Disparity(utility::BufferStreamReader &r, VersionType v)
std::string * frameId(M &m)
static CRL_CONSTEXPR IdType ID_DATA_DISPARITY
void serialize(Stream &stream, const T &t)
void seek(std::size_t idx)
#define WIRE_HEADER_ATTRIBS_
void serialize(Archive &message, const VersionType version)
static void assembler(utility::BufferStreamWriter &stream, const uint8_t *dataP, uint32_t offset, uint32_t length)