Merge pull request #6 from yan-verdavaine/master

update with WeakReference
Fixed allocating too large buffers, and too often.

Two fixes applied:

- The buffer length is in bytes.

- BeginProcessing may be called several times (because the block sizes can vary). It's ok if the current buffer is "large enough", so avoid recreating buffers dozens/hundreds of times per image and just keep the largest capacity seen. (Length is still a good property to track the needed size though.)
Merge pull request #7 from cadahl/patch-3

Fixed allocating too large buffers, and too often.
Merge pull request #8 from Nokia-Developer-Community-Projects/master

sync