Initial working stiv-jpeg C rewrite