no quantization when i use DT_UINT32 and DT_FLOAT32 (C++)
thanks for providing the source code for draco. I have a problem when im using the C++ encoder. when I use a different datatype for the second attribute there seem to be no quantization (e.g. POSITION = DT_FLOAT32 and GENERIC = DT_UINT32). the amount of specified bits have no impact on the size of the output of the encoder (always 1,8MB/s). but when i use only one datatype for all attributes (e.g. POSITION = DT_FLOAT32 and GENERIC = DT_FLOAT32) then im able to manipulate the outcome size by modifying the quantization bits. (the size is 380 kb/s when using 10 quantization bits ) I hope anyone can tell me why there seem to be no quantization when using multiple datatypes, here is my code:
int encode_speed = 7;
int decode_speed = 7;
int position_bits = 10;
int generic_bits = 10;
tcp_service::CustomMsgCompressed convert(const tcp_service::CustomMsg& msg){
draco::PointCloudBuilder builder;
builder.Start(msg.point_num);
const int pos_att = builder.AddAttribute(draco::GeometryAttribute::POSITION, 3, draco::DT_FLOAT32);
const int gen_att = builder.AddAttribute(draco::GeometryAttribute::GENERIC, 1, draco::DT_UINT32);
for (draco::PointIndex i(0); i < point_numbr; ++i) {
builder.SetAttributeValueForPoint( pos_att, i, &msg.points[i.value()].x);
builder.SetAttributeValueForPoint( gen_att, i, &msg.points[i.value()].offset_time);
}
std::unique_ptr<draco::PointCloud> draco_points = builder.Finalize(true);
draco::EncoderBuffer encode_buffer;
draco::Encoder encoder;
encoder.SetSpeedOptions(encode_speed, decode_speed);
encoder.SetAttributeQuantization(draco::GeometryAttribute::GENERIC, generic_bits);
encoder.SetAttributeQuantization(draco::GeometryAttribute::POSITION, position_bits);
encoder.SetEncodingMethod(draco::POINT_CLOUD_KD_TREE_ENCODING);
draco::Status status = encoder.EncodePointCloudToBuffer(*draco_points, &encode_buffer);
}
it seems that the problem is only regarding int datatype, is it true that draco doesn't compress integers lossy?
Yes quantization is applied only to attributes with DT_FLOAT32 data type. Integer attributes are supported for pre-quantized data (data quantized outside of draco).