nigeltao / qoi2-bikeshed

"Quite OK Image" version 2 discussions
33 stars 0 forks source link

Secondary index cache with two-byte encoding #26

Open chocolate42 opened 2 years ago

chocolate42 commented 2 years ago

Another possible opcode, QOI_OP_INDEX2. This is a two byte encoding with eight bit opcode, that acts as an index into a secondary index cache with 256 values.

Pro:

Con:

Comparison to current master build:

@phoboslab If this or any other opcode change is deemed suitable I'll do proper pull requests as and when

qoi-index2.h.txt

chocolate42 commented 2 years ago

Testing some combinations of primary and secondary index cache sizes:

Grand total for ./qoi/qoi_benchmark_suite/images

         decode  encode  decode   encode  size    rate spare_tags
             ms      ms    mpps     mpps    kb

qoi-ind0: 1.719 2.237 269.99 207.50 509 28.1% 66 qoi-ind2: 2.063 2.423 225.02 191.60 504 27.8% 64 qoi-ind4: 2.103 2.484 220.75 186.89 498 27.5% 62 qoi-ind8: 2.107 2.580 220.25 179.89 492 27.2% 58 qoi-ind16: 2.044 2.509 227.14 185.02 484 26.7% 50 qoi-ind32: 2.165 2.494 214.35 186.12 474 26.2% 34 qoi-ind64: 2.181 2.488 212.83 186.58 463 25.6% 2

qoi-ind0.2: 2.113 2.314 219.71 200.61 486 26.8% 65 qoi-ind2.2: 2.328 2.620 199.40 177.16 484 26.7% 63 qoi-ind4.2: 2.342 2.643 198.21 175.60 480 26.5% 61 qoi-ind8.2: 2.434 2.542 190.70 182.59 475 26.2% 57 qoi-ind16.2: 2.367 2.624 196.12 176.88 469 25.9% 49 qoi-ind32.2: 2.431 2.550 190.94 182.02 463 25.5% 33 qoi-ind64.2: 2.421 2.524 191.70 183.93 456 25.2% 1

qoi-ind0.2a: 2.144 2.287 216.49 203.00 483 26.7% 64 qoi-ind2.2a: 2.426 2.561 191.35 181.23 481 26.5% 62 qoi-ind4.2a: 2.440 2.573 190.20 180.43 477 26.3% 60 qoi-ind8.2a: 2.430 2.586 191.01 179.51 472 26.1% 56 qoi-ind16.2a: 2.406 2.546 192.95 182.35 466 25.7% 48 qoi-ind32.2a: 2.510 2.610 184.91 177.87 460 25.4% 32 qoi-ind64.2a: 2.505 2.591 185.26 179.15 453 25.0% 0



I like the look of ind32.2, compresses on par with the baseline ind64 but uses 31 less tags. There's also something to be said about ind16.2 if those extra 16 ops can be better used elsewhere, maybe in a variant that limits itself to MASK_2 and MASK_4.