You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The officially provided sample code is as follows:
draco::DecoderBuffer buffer;
buffer.Init(data.data(), data.size());
const draco::EncodedGeometryType geom_type =
draco::GetEncodedGeometryType(&buffer);
if (geom_type == draco::TRIANGULAR_MESH) {
unique_ptr<draco::Mesh> mesh = draco::DecodeMeshFromBuffer(&buffer);
} else if (geom_type == draco::POINT_CLOUD) {
unique_ptr<draco::PointCloud> pc = draco::DecodePointCloudFromBuffer(&buffer);
}
After calling unique_ptr<draco::PointCloud> pc = draco::DecodePointCloudFromBuffer(&buffer);, the code: DRACO_ASSIGN_OR_RETURN(std::unique_ptr<PointCloudDecoder> decoder, CreatePointCloudDecoder(header.encoder_method)) will be called.
Eventually the following code will be called:
bool DataBuffer::Update(const void *data, int64_t size, int64_t offset) {
if (data == nullptr) {
if (size + offset < 0)
return false;
// If no data is provided, just resize the buffer.
data_.resize(size + offset);
} else {
if (size < 0)
return false;
if (size + offset > static_cast<int64_t>(data_.size())) {
data_.resize(size + offset);
}
const uint8_t *const byte_data = static_cast<const uint8_t *>(data);
std::copy(byte_data, byte_data + size, data_.data() + offset);
}
descriptor_.buffer_update_count++;
return true;
}
Each time a PointCloudDecoder object is created, it will eventually result in calling data_.resize(size + offset);, resulting in a large amount of dynamic memory allocation. Why do we need to create a new PointCloudDecoder object every time?
The text was updated successfully, but these errors were encountered:
The officially provided sample code is as follows:
After calling
unique_ptr<draco::PointCloud> pc = draco::DecodePointCloudFromBuffer(&buffer);
, the code:DRACO_ASSIGN_OR_RETURN(std::unique_ptr<PointCloudDecoder> decoder, CreatePointCloudDecoder(header.encoder_method))
will be called.Eventually the following code will be called:
Each time a
PointCloudDecoder
object is created, it will eventually result in callingdata_.resize(size + offset);
, resulting in a large amount of dynamic memory allocation. Why do we need to create a newPointCloudDecoder
object every time?The text was updated successfully, but these errors were encountered: