micro JPEG encoder in C++