Fixed mozjpeg build with Visual C++ 2010

Moved several variable declarations out of inner scopes to the function scope to compile C code with Visual C++ 2010