selfcustody / krux

Open-source signing device firmware for Bitcoin
https://selfcustody.github.io/krux/
Other
179 stars 36 forks source link

Increase UR memory efficiency #259

Closed ghost closed 7 months ago

ghost commented 1 year ago

Do some profiling on the urtypes library and the UR library from Foundation Devices to see how we can improve RAM usage

odudex commented 11 months ago

Did two things that reduced resources usage and increased speed a lot, without changing UR

  1. Used binary images (1 bit per pixel) instead os "01" strings (8 bits per pixel) to store and handle QR codes. b56a33f85842a67348c98ac70d11a00e56634c76 (and some subsequent commits)

  2. Inspecting both Krux and UR I figured out Krux would was calculating QR code sizes through iterations, starting with huge QR codes, and encoding them on each iteration. So I replaced the iterations by equations. de99bfe9c692068cc9262c8773101b4e01d8aa44

Learned that UR not efficient on information density, and is terrible for small screens. But let's try to use it the best way possible.

tadeubas commented 7 months ago

Can we consider this done in release 24.03.0 ?

odudex commented 7 months ago

Yes, done in Release v24.03.0