avcodec/jpeg2000dec: make SOC finding code more robust