I've finally got round to making a Base64 decoder using the information from Base64 Decode Algorithm | Base64 Algorithm | Learn | Base64
It's very naive and takes 22 seconds to decode a 100x100 encoded image on my computer!
So, if anyone fancies improving it (no JS of course) I'd be really grateful
The final image should look like this (it's a tile of part of an earthnullschool.net wind map) but the decoder must decode the simple ones as well in order to be compliant
[edit Originally it was taking 300 secs but I'd made a mistake with encoding the data in the 1st place - all OK now - output bytes should be 40,000 long if processing the tile image]
And I don't need it myself at the moment but if someone fancies writing an encoder to go with it that would be very nice
With conversion 4 => 3 bytes "unrolled" as a single expression.
X mod 2^n - extract n low bits
X / 2^n - drop n low bits
X * 2 ^n - shift left n bit
Actually does it in 679ms on mine
Now going thru it to make see how you've done it [edit - Done that - great idea not to have to convert to binary and then back again ]
Thank you very much
Compiled map makes it twice as fast on my computer
I've made a few cosmetic variable name changes, added padding if needed and made a custom reporter out of it.
I've left the map un-compiled at the moment as I've sometimes had issues with compiled blocks
Thank you once again
Although the new version
is twice as fast as the previous one, it still pales in comparison to JS
Because the complied version doesn't yield while its running, I'm not using it on large images
But I've added it as seperate block for anyone who wants to use it
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.