Refactor searching for the SOI marker of inline JPEG image streams