Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>By its nature, spline is an approximation. You can reduce the number of splines you use to reach a higher compression ratio.</p> <p>You can also achieve lossless compression by using some kind of encoding scheme. I am just making this up as I am typing, using the range example in previous answer (1000 for x and 400 for y),</p> <ol> <li>Each point only needs 19 bits (10 for x, 9 for y). You can use 3 bytes to represent a coordinate.</li> <li>Use 2 byte to represent displacement up to +/- 63.</li> <li>Use 1 byte to represent short displacement up to +/- 7 for x, +/- 3 for y.</li> </ol> <p>To decode the sequence properly, you would need some prefix to identify the type of encoding. Let's say we use 110 for full point, 10 for displacement and 0 for short displacement.</p> <p>The bit layout will look like this,</p> <pre><code>Coordinates: 110xxxxxxxxxxxyyyyyyyyyy Dislacement: 10xxxxxxxyyyyyyy Short Displacement: 0xxxxyyy </code></pre> <p>Unless your sequence is totally random, you can easily achieve high compression ratio with this scheme.</p> <p>Let's see how it works using a short example.</p> <p>3 points: A(500, 400), B(550, 380), C(545, 381)</p> <p>Let's say you were using 2 byte for each coordinate. It will take 16 bytes to encode this without compression.</p> <p>To encode the sequence using the compression scheme,</p> <p>A is first point so full coordinate will be used. 3 bytes. B's displacement from A is (50, -20) and can be encoded as displacement. 2 bytes. C's displacement from B is (-5, 1) and it fits the range of short displacement 1 byte.</p> <p>So you save 10 bytes out of 16 bytes. Real compression ratio is totally depending on the data pattern. It works best on points forming a moving path. If the points are random, only 25% saving can be achieved.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload