Move MJPEG's input buffer preprocessing in separate public function