avoid LTR reference frames overflow
Merge pull request #1321 from ruil2/ltr_check

avoid LTR reference frames overflow