Implemented Encode method in JPEG C# class (need to implement in C++ also)