Cleanup of set_offsets function. Adding ALLOWED_REFS_PER_FRAME constant instead of hard coded number 3. Change-Id: I46146aa837896936f920c748c7d4aa4c27f026e4