Download include/colmap/lib/VLFeat/host.h from camenduru/ceres-solver: direct link, hf CLI and curl.
- Browser
- Download file 17 kB
-
https://huggingface.co/camenduru/ceres-solver/resolve/main/include/colmap/lib/VLFeat/host.h
- Command line
-
hf download hf://camenduru/ceres-solver/include/colmap/lib/VLFeat/host.h
-
curl -L -o host.h https://huggingface.co/camenduru/ceres-solver/resolve/main/include/colmap/lib/VLFeat/host.h
17 kB
| /** @file host.h | |
| ** @brief Host | |
| ** @author Andrea Vedaldi | |
| ** @sa @ref portability | |
| **/ | |
| /* | |
| Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. | |
| All rights reserved. | |
| This file is part of the VLFeat library and is made available under | |
| the terms of the BSD license (see the COPYING file). | |
| */ | |
| /** ------------------------------------------------------------------ | |
| ** @name Configuration options | |
| ** @{ */ | |
| /** @} */ | |
| /** ------------------------------------------------------------------ | |
| ** @name Defining functions | |
| ** @{ */ | |
| /** @} */ | |
| /** ------------------------------------------------------------------ | |
| ** @name C preprocessor helper macros | |
| ** @{ */ | |
| /** @brief Convert the argument to a string | |
| ** @param x value to be stringified. | |
| ** | |
| ** This macro stringifies the argument @a x by means of the | |
| ** <code>#</code> prerpocessor operator. | |
| ** | |
| ** The standard C preprocessor does not prescan arguments which are | |
| ** stringified, so | |
| ** | |
| ** @code | |
| ** #define A B | |
| ** char const * str = VL_STRINGIFY(A) ; | |
| ** @endcode | |
| ** | |
| ** initializes <code>str</code> with a pointer to the string | |
| ** <code>"A"</code>, which mihgt be unexpected. To fix this issue, | |
| ** you can use ::VL_XSTRINGIFY. | |
| ** | |
| ** @sa ::VL_XSTRINGIFY | |
| **/ | |
| /** @brief Expand and then convert the argument to a string | |
| ** @param x value to be macro-expanded and converted. | |
| ** | |
| ** This macro macro-expands the argument @a x and stringifies the | |
| ** result of the expansion. For instance | |
| ** | |
| ** @code | |
| ** #define A B | |
| ** char const * str = VL_STRINGIFY(A) ; | |
| ** @endcode | |
| ** | |
| ** initializes <code>str</code> with a pointer to the string | |
| ** <code>"B"</code>. | |
| ** | |
| ** @sa ::VL_STRINGIFY | |
| **/ | |
| /** @brief Concatenate two arguments into a lexical unit | |
| ** @param x first argument to be concatenated. | |
| ** @param y second argument to be concatenated. | |
| ** | |
| ** This macro concatenates its arguments into a single lexical unit | |
| ** by means of the <code>##</code> preprocessor operator. Notice that | |
| ** arguments concatenated by <code>##</code> are not pre-expanded by | |
| ** the C preprocessor. To macro-expand the arguments and then | |
| ** concatenate them,use ::VL_XCAT. | |
| ** | |
| ** @see ::VL_XCAT | |
| **/ | |
| /** @brief Expand and then concatenate two arguments into a lexical unit | |
| ** @param x first argument to be concatenated. | |
| ** @param y second argument to be concatenated. | |
| ** | |
| ** This macro is the same as ::VL_CAT, except that the arguments are | |
| ** macro expanded before being concatenated. | |
| ** | |
| ** @see ::VL_CAT | |
| **/ | |
| /** @brief Expand and then concatenate three arguments into a lexical unit | |
| ** @param x first argument to be concatenated. | |
| ** @param y second argument to be concatenated. | |
| ** @param z third argument to be concatenated. | |
| ** | |
| ** This macro is the same as ::VL_XCAT, except that it has three arguments. | |
| ** | |
| ** @see ::VL_XCAT | |
| **/ | |
| /** @brief Expand and then concatenate four arguments into a lexical unit | |
| ** @param x first argument to be concatenated. | |
| ** @param y second argument to be concatenated. | |
| ** @param z third argument to be concatenated. | |
| ** @param u fourth argument to be concatenated. | |
| ** | |
| ** This macro is the same as ::VL_XCAT, except that it has four arguments. | |
| ** | |
| ** @see ::VL_XCAT | |
| **/ | |
| /** @brief Expand and then concatenate five arguments into a lexical unit | |
| ** @param x first argument to be concatenated. | |
| ** @param y second argument to be concatenated. | |
| ** @param z third argument to be concatenated. | |
| ** @param u fourth argument to be concatenated. | |
| ** @param v fifth argument to be concatenated. | |
| ** | |
| ** This macro is the same as ::VL_XCAT, except that it has five arguments. | |
| ** | |
| ** @see ::VL_XCAT | |
| **/ | |
| /** @brief Convert a boolean to "yes" or "no" strings | |
| ** @param x boolean to convert. | |
| ** | |
| ** A pointer to either the string "yes" (if @a x is true) | |
| ** or the string "no". | |
| ** | |
| ** @par Example | |
| ** @code | |
| ** VL_PRINTF("Is x true? %s.", VL_YESNO(x)) | |
| ** @endcode | |
| **/ | |
| /** @} */ | |
| /* | |
| The following macros identify the host OS, architecture and compiler. | |
| They are derived from http://predef.sourceforge.net/ | |
| */ | |
| /** @name Identifying the host operating system | |
| ** @{ */ | |
| /** @} */ | |
| /** @name Identifying the host threading library | |
| ** @{ */ | |
| /** @} */ | |
| /** @name Identifying the host compiler | |
| ** @{ */ | |
| /** @} */ | |
| /** @name Identifying the host CPU architecture | |
| ** @{ */ | |
| /** @} */ | |
| /** @name Identifying the host data model | |
| ** @{ */ | |
| /** @} */ | |
| /** @name Identifying the host endianness | |
| ** @{ */ | |
| /** @} */ | |
| VL_INLINE float fabsf(float x) { return (float) fabs((double) x) ; } | |
| VL_EXPORT char * vl_static_configuration_to_string_copy () ; | |
| /** ------------------------------------------------------------------ | |
| ** @name Atomic data types | |
| ** @{ | |
| **/ | |
| typedef long long vl_int64 ; /**< @brief Signed 64-bit integer. */ | |
| typedef int vl_int32 ; /**< @brief Signed 32-bit integer. */ | |
| typedef short vl_int16 ; /**< @brief Signed 16-bit integer. */ | |
| typedef char vl_int8 ; /**< @brief Signed 8-bit integer. */ | |
| typedef long long unsigned vl_uint64 ; /**< @brief Unsigned 64-bit integer. */ | |
| typedef int unsigned vl_uint32 ; /**< @brief Unsigned 32-bit integer. */ | |
| typedef short unsigned vl_uint16 ; /**< @brief Unsigned 16-bit integer. */ | |
| typedef char unsigned vl_uint8 ; /**< @brief Unsigned 8-bit integer. */ | |
| typedef int vl_int ; /**< @brief Same as @c int. */ | |
| typedef unsigned int vl_uint ; /**< @brief Same as <code>unsigned int</code>. */ | |
| typedef int vl_bool ; /**< @brief Boolean. */ | |
| typedef vl_int64 vl_intptr ; /**< @brief Integer holding a pointer. */ | |
| typedef vl_uint64 vl_uintptr ; /**< @brief Unsigned integer holding a pointer. */ | |
| typedef vl_uint64 vl_size ; /**< @brief Unsigned integer holding the size of a memory block. */ | |
| typedef vl_int64 vl_index ; /**< @brief Signed version of ::vl_size and ::vl_uindex */ | |
| typedef vl_uint64 vl_uindex ; /**< @brief Same as ::vl_size */ | |
| typedef __int64 vl_int64 ; | |
| typedef long long vl_int64 ; | |
| typedef int vl_int32 ; | |
| typedef short vl_int16 ; | |
| typedef char vl_int8 ; | |
| typedef __int64 unsigned vl_uint64 ; | |
| typedef long long unsigned vl_uint64 ; | |
| typedef int unsigned vl_uint32 ; | |
| typedef short unsigned vl_uint16 ; | |
| typedef char unsigned vl_uint8 ; | |
| typedef int vl_int ; | |
| typedef unsigned int vl_uint ; | |
| typedef int vl_bool ; | |
| typedef vl_int32 vl_intptr ; | |
| typedef vl_uint32 vl_uintptr ; | |
| typedef vl_uint32 vl_size ; | |
| typedef vl_int32 vl_index ; | |
| typedef vl_uint32 vl_uindex ; | |
| /** @} */ | |
| /** @name Creating integer constants | |
| ** @{ */ | |
| /** @} */ | |
| /** ------------------------------------------------------------------ | |
| ** @name Printing the atomic data types | |
| ** @{ */ | |
| /* Lengths only: */ | |
| /** @def VL_FL_INT64 | |
| ** @brief @c printf length flag for ::vl_int64 and ::vl_uint64. | |
| **/ | |
| /** @def VL_FL_INT32 | |
| ** @brief @c printf length flag for ::vl_int32 and ::vl_uint32. | |
| **/ | |
| /** @def VL_FL_INT16 | |
| ** @brief @c printf length flag for ::vl_int16 and ::vl_uint16. | |
| **/ | |
| /** @def VL_FL_INT8 | |
| ** @brief @c printf length flag for ::vl_int8 and ::vl_uint8. | |
| **/ | |
| /** @def VL_FL_INDEX | |
| ** @brief @c printf length flag for ::vl_index and ::vl_uindex | |
| **/ | |
| /* Formats (but not conversions!): */ | |
| /** @def VL_FMT_SIZE | |
| ** @brief @c printf flag for ::vl_size | |
| **/ | |
| /** @def VL_FMT_INDEX | |
| ** @brief @c printf flag for ::vl_index | |
| **/ | |
| /** @def VL_FMT_UINDEX | |
| ** @brief @c printf flag for ::vl_uindex | |
| **/ | |
| /** @def VL_FMT_INTPTR | |
| ** @brief @c printf flag for ::vl_intptr | |
| **/ | |
| /** @def VL_FMT_UINTPTR | |
| ** @brief @c printf flag for ::vl_uintptr | |
| **/ | |
| /** @} */ | |
| /** ------------------------------------------------------------------ | |
| ** @name Atomic data types limits | |
| ** @{ */ | |
| /** @brief Largest integer (math constant) */ | |
| /** @brief Smallest integer (math constant) */ | |
| /** @brief Largest unsigned integer (math constant) */ | |
| /** @} */ | |
| /** ------------------------------------------------------------------ | |
| ** @name Endianness detection and conversion | |
| ** @{ | |
| **/ | |
| VL_INLINE void vl_swap_host_big_endianness_8 (void *dst, void* src) ; | |
| VL_INLINE void vl_swap_host_big_endianness_4 (void *dst, void* src) ; | |
| VL_INLINE void vl_swap_host_big_endianness_2 (void *dst, void* src) ; | |
| /** @} */ | |
| /** ------------------------------------------------------------------ | |
| ** @name Obtaining host info at run time | |
| ** @{ */ | |
| typedef struct _VlX86CpuInfo | |
| { | |
| union { | |
| char string [0x20] ; | |
| vl_uint32 words [0x20 / 4] ; | |
| } vendor ; | |
| vl_bool hasAVX ; | |
| vl_bool hasSSE42 ; | |
| vl_bool hasSSE41 ; | |
| vl_bool hasSSE3 ; | |
| vl_bool hasSSE2 ; | |
| vl_bool hasSSE ; | |
| vl_bool hasMMX ; | |
| } VlX86CpuInfo ; | |
| void _vl_x86cpu_info_init (VlX86CpuInfo *self) ; | |
| char * _vl_x86cpu_info_to_string_copy (VlX86CpuInfo const *self) ; | |
| /** @} */ | |
| /** ------------------------------------------------------------------ | |
| ** @brief Host <-> big endian transformation for 8-bytes value | |
| ** | |
| ** @param dst destination 8-byte buffer. | |
| ** @param src source 8-byte bufffer. | |
| ** @see @ref host-arch-endianness. | |
| **/ | |
| VL_INLINE void | |
| vl_swap_host_big_endianness_8 (void *dst, void* src) | |
| { | |
| char *dst_ = (char*) dst ; | |
| char *src_ = (char*) src ; | |
| dst_ [0] = src_ [0] ; | |
| dst_ [1] = src_ [1] ; | |
| dst_ [2] = src_ [2] ; | |
| dst_ [3] = src_ [3] ; | |
| dst_ [4] = src_ [4] ; | |
| dst_ [5] = src_ [5] ; | |
| dst_ [6] = src_ [6] ; | |
| dst_ [7] = src_ [7] ; | |
| dst_ [0] = src_ [7] ; | |
| dst_ [1] = src_ [6] ; | |
| dst_ [2] = src_ [5] ; | |
| dst_ [3] = src_ [4] ; | |
| dst_ [4] = src_ [3] ; | |
| dst_ [5] = src_ [2] ; | |
| dst_ [6] = src_ [1] ; | |
| dst_ [7] = src_ [0] ; | |
| } | |
| /** ------------------------------------------------------------------ | |
| ** @brief Host <-> big endian transformation for 4-bytes value | |
| ** | |
| ** @param dst destination 4-byte buffer. | |
| ** @param src source 4-byte bufffer. | |
| ** @sa @ref host-arch-endianness. | |
| **/ | |
| VL_INLINE void | |
| vl_swap_host_big_endianness_4 (void *dst, void* src) | |
| { | |
| char *dst_ = (char*) dst ; | |
| char *src_ = (char*) src ; | |
| dst_ [0] = src_ [0] ; | |
| dst_ [1] = src_ [1] ; | |
| dst_ [2] = src_ [2] ; | |
| dst_ [3] = src_ [3] ; | |
| dst_ [0] = src_ [3] ; | |
| dst_ [1] = src_ [2] ; | |
| dst_ [2] = src_ [1] ; | |
| dst_ [3] = src_ [0] ; | |
| } | |
| /** ------------------------------------------------------------------ | |
| ** @brief Host <-> big endian transformation for 2-bytes value | |
| ** | |
| ** @param dst destination 2-byte buffer. | |
| ** @param src source 2-byte bufffer. | |
| ** @see @ref host-arch-endianness. | |
| **/ | |
| VL_INLINE void | |
| vl_swap_host_big_endianness_2 (void *dst, void* src) | |
| { | |
| char *dst_ = (char*) dst ; | |
| char *src_ = (char*) src ; | |
| dst_ [0] = src_ [0] ; | |
| dst_ [1] = src_ [1] ; | |
| dst_ [0] = src_ [1] ; | |
| dst_ [1] = src_ [0] ; | |
| } | |
| /* VL_HOST_H */ | |