Skip to content

Commit

Permalink
feat: Exposing both encode and decode speed for better fine-tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
atteneder committed Mar 3, 2021
1 parent edc12fd commit 2ceedf7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/draco/unity/draco_unity_enc_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ namespace draco {
delete encoder;
}

void dracoEncoderSetCompressionSpeed(DracoEncoder *encoder, uint32_t speedLevel) {
encoder->speed = speedLevel;
void dracoEncoderSetCompressionSpeed(DracoEncoder *encoder, uint32_t encodingSpeed, uint32_t decodingSpeed) {
encoder->encodingSpeed = encodingSpeed;
encoder->decodingSpeed = decodingSpeed;
}

void dracoEncoderSetQuantizationBits(DracoEncoder *encoder, uint32_t position, uint32_t normal, uint32_t uv, uint32_t color, uint32_t generic)
Expand All @@ -49,7 +50,7 @@ namespace draco {
bool dracoEncoderEncode(DracoEncoder *encoder, uint8_t preserveTriangleOrder)
{
draco::Encoder dracoEncoder;
dracoEncoder.SetSpeedOptions(encoder->speed, encoder->speed);
dracoEncoder.SetSpeedOptions(encoder->encodingSpeed, encoder->decodingSpeed);
dracoEncoder.SetAttributeQuantization(draco::GeometryAttribute::POSITION, encoder->quantization.position);
dracoEncoder.SetAttributeQuantization(draco::GeometryAttribute::NORMAL, encoder->quantization.normal);
dracoEncoder.SetAttributeQuantization(draco::GeometryAttribute::TEX_COORD, encoder->quantization.uv);
Expand Down
5 changes: 3 additions & 2 deletions src/draco/unity/draco_unity_enc_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ namespace draco {
uint32_t encodedIndices;
std::vector<std::unique_ptr<draco::DataBuffer>> buffers;
draco::EncoderBuffer encoderBuffer;
uint32_t speed = 0;
uint32_t encodingSpeed = 0;
uint32_t decodingSpeed = 0;
std::size_t rawSize = 0;
struct
{
Expand All @@ -60,7 +61,7 @@ extern "C" {

EXPORT_API DracoEncoder * dracoEncoderCreate(uint32_t vertexCount);
void EXPORT_API dracoEncoderRelease(DracoEncoder *encoder);
void EXPORT_API dracoEncoderSetCompressionSpeed(DracoEncoder *encoder, uint32_t speedLevel);
void EXPORT_API dracoEncoderSetCompressionSpeed(DracoEncoder *encoder, uint32_t encodingSpeed, uint32_t decodingSpeed);
void EXPORT_API dracoEncoderSetQuantizationBits(DracoEncoder *encoder, uint32_t position, uint32_t normal, uint32_t uv, uint32_t color, uint32_t generic);
bool EXPORT_API dracoEncoderEncode(DracoEncoder *encoder, uint8_t preserveTriangleOrder);
uint32_t EXPORT_API dracoEncoderGetEncodedVertexCount(DracoEncoder *encoder);
Expand Down

0 comments on commit 2ceedf7

Please sign in to comment.