avcodec/jpeg2000dec: Fix term_cnt check