1
votes

I am working on algorithm for compressing texture coordinates of 3D mesh efficiently. I care about good compression ratio and maximum decompression speed.

Right now, I have predictor for UV coordinates based on 3D positions of mesh. I want do encode differences between predicted and real UV coords. This works nicely and result is, that I have vector of integer values (quantized deltas), where small values have highest probability of occurrence.

Now I want to perform some kind of entropy coding of these integral values. I thought, that if I feed this vector of integers to some general compression encoder (I tried ZStd), it will take care of efficient encoding. However, this does not seem to be the case :) Is this idea of feeding vector of integers representing quantized deltas into general compression even valid ? Or it does not work this way ? What do you suggest to compress such sequence efficiently ?

Thanks for any tips !

2
In what form are you encoding the deltas?Mark Adler
I tried two approaches. In first approach, I just passed std::vector<int> to ZStd compressor. In second approach, I encoded residual integer values into bitstream using 'variable int encoding' and passed resulting bitstream to compressor. In some cases first method got better compression, but in some cases second method won.born49

2 Answers

1
votes

You are doing what I would do. Encode the deltas into a byte sequence using variable-length integer coding. Hopefully your data is smooth enough and your predictor is good enough that the vast majority of your deltas fit in one byte. Then I would feed that to a standard compressor, such as zstd or lz4, in order to get fast decompression.

What do you mean by "However, this does not seem to be the case"? Are you not getting compression at all from the delta-encoded representation?

You should make a histogram of the deltas and provide that in the question so we can see what the potential for compression is.

1
votes

You can try a transpose before calling zstd or other compressor. See for example TurboTranspose