fix crash on mvd cost calculation
format update
Merge pull request #1299 from ruil2/mvcost_check_1

fix crash on mvd cost calculation