@tshering: I'm fairly certain this won't be that useful compared to the upstream version since Kobo uses 16bpp fb, but
here's the tweaked version I came up with to handle the whole range of weird Kindle fbs
(If you do end up needing to tweak the code, I'd be happy to merge those changes).