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.)