Fix calculation of num ref frames
Merge pull request #741 from varunbpatil/ref_frames

Fix calculation of num ref frames