Moved local static function from main file to cvutil.{h,cpp}