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>
107 const uint32_t imageSize =
static_cast<uint32_t
> (std::ceil(((
double) API_BITS_PER_PIXEL / 8.0) * width * height));
111 message.write(dataP, imageSize);
115 dataP = message.peek();
116 message.seek(message.tell() + imageSize);
124 const uint8_t *dataP,
135 stream.
write(dataP, META_LENGTH);
143 const uint8_t *sP = dataP;
144 const uint32_t sourceOffset = offset - META_LENGTH;
145 const uint32_t count = (8 * length) / WIRE_BITS_PER_PIXEL;
146 const uint32_t destOffset = META_LENGTH + (((8 * sourceOffset) / WIRE_BITS_PER_PIXEL) *
147 (API_BITS_PER_PIXEL / 8));
151 stream.
seek(destOffset);
153 #if MULTISENSE_WIRE_BITS_PER_PIXEL == 12 && MULTISENSE_API_BITS_PER_PIXEL == 16 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) );
164 #elif MULTISENSE_WIRE_BITS_PER_PIXEL == 12 && MULTISENSE_API_BITS_PER_PIXEL == 32 168 float *dP =
reinterpret_cast<float*
>(stream.
peek());
170 for(uint32_t i=0; i<count; i+=2, sP+=3) {
172 dP[i] =
static_cast<float>((sP[0] ) | ((sP[1] & 0x0F) << 8)) / 16.0f;
173 dP[i+1] =
static_cast<float>((sP[1] >> 4) | (sP[2] << 4) ) / 16.0
f;
177 #error MULTISENSE_WIRE_BITS_PER_PIXEL and MULTISENSE_API_BITS_PER_PIXEL not supported 183 #endif // !SENSORPOD_FIRMWARE
#define MULTISENSE_WIRE_BITS_PER_PIXEL
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)
#define MULTISENSE_API_BITS_PER_PIXEL
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)