generic.h File Reference
Generic. More...
#include "host.h"#include "random.h"#include <stdlib.h>#include <stddef.h>#include <time.h>#include <assert.h>#include <Windows.h>Go to the source code of this file.
Data Structures | |
| struct | _VlThreadSpecificState |
| VLFeat thread state. More... | |
| struct | _VlState |
| VLFeat global state. More... | |
Defines | |
| #define | VL_VERSION_STRING "0.9.8" |
| Library version string. | |
| #define | VL_ERR_MSG_LEN 1024 |
| Maximum length (in characters) of an error message. | |
Common operations | |
| #define | VL_MIN(x, y) (((x)<(y))?(x):(y)) |
| Min operation. | |
| #define | VL_MAX(x, y) (((x)>(y))?(x):(y)) |
| Max operation. | |
| #define | VL_SHIFT_LEFT(x, n) (((n)>=0)?((x)<<(n)):((x)>>-(n))) |
| Signed left shift operation. | |
Functions | |
Memory allocation | |
| void | vl_set_alloc_func (void *(*malloc_func)(size_t), void *(*realloc_func)(void *, size_t), void *(*calloc_func)(size_t, size_t), void(*free_func)(void *)) |
| Set memory allocation functions. | |
| void * | vl_malloc (size_t n) |
Call customizable malloc function. | |
| void * | vl_realloc (void *ptr, size_t n) |
Call customizable resize function. | |
| void * | vl_calloc (size_t n, size_t size) |
Call customizable calloc function. | |
| void | vl_free (void *ptr) |
Call customizable free function. | |
Measuring time | |
| void | vl_tic () |
| Reset processor time reference The function resets VLFeat TIC/TOC time reference. | |
| double | vl_toc () |
| Get elapsed time since tic. | |
| double | vl_get_cpu_time () |
| Get processor time. | |
Type identidifers for atomic data types | |
|
| |
| #define | VL_TYPE_FLOAT 1 |
| Get data type name. | |
| #define | VL_TYPE_DOUBLE 2 |
| Get data type name. | |
| #define | VL_TYPE_INT8 3 |
| Get data type name. | |
| #define | VL_TYPE_UINT8 4 |
| Get data type name. | |
| #define | VL_TYPE_INT16 5 |
| Get data type name. | |
| #define | VL_TYPE_UINT16 6 |
| Get data type name. | |
| #define | VL_TYPE_INT32 7 |
| Get data type name. | |
| #define | VL_TYPE_UINT32 8 |
| Get data type name. | |
| #define | VL_TYPE_INT64 9 |
| Get data type name. | |
| #define | VL_TYPE_UINT64 10 |
| Get data type name. | |
| typedef vl_uint32 | vl_type |
| Get data type name. | |
| char const * | vl_get_type_name (vl_type type) |
| Get data type name. | |
| vl_size | vl_get_type_size (vl_type type) |
| Get data type size. | |
Error handling | |
------------------------------------------------------------------ | |
| #define | VL_ERR_OK 0 |
| #define | VL_ERR_OVERFLOW 1 |
| #define | VL_ERR_ALLOC 2 |
| #define | VL_ERR_BAD_ARG 3 |
| #define | VL_ERR_IO 4 |
| #define | VL_ERR_EOF 5 |
| #define | VL_ERR_NO_MORE 5 |
| int | vl_get_last_error () |
| Get VLFeat last error code. | |
| char const * | vl_get_last_error_message () |
| Get VLFeat last error message. | |
| int | vl_set_last_error (int error, char const *errorMessage,...) |
| Set last VLFeat error. | |
Logging | |
------------------------------------------------------------------ | |
| #define | VL_PRINTF (*vl_get_state()->printf_func) |
Call user-customizable printf function. | |
| #define | VL_PRINT (*vl_get_state()->printf_func) |
| Same as VL_PRINTF (legacy code). | |
| typedef int(* | printf_func_t )(char const *format,...) |
| Customizable printf function pointer type. | |
| void | vl_set_printf_func (printf_func_t printf_func) |
| Set printf function. | |
State and configuration parameters | |
------------------------------------------------------------------ | |
| typedef struct _VlThreadSpecificState | VlThreadSpecificState |
| VLFeat thread state. | |
| typedef struct _VlState | VlState |
| VLFeat global state. | |
| VlState | _vl_state |
| VLFeat global state. | |
| VlState * | vl_get_state () |
| Return VLFeat global state. | |
| VlThreadSpecificState * | vl_get_thread_specific_state () |
| Get VLFeat thread state. | |
| void | vl_lock_state () |
| Lock VLFeat state. | |
| void | vl_unlock_state () |
| Unlock VLFeat state. | |
| VlThreadSpecificState * | vl_thread_specific_state_new () |
| VLFeat thread state. | |
| void | vl_thread_specific_state_delete (VlThreadSpecificState *self) |
| VLFeat thread state. | |
| char const * | vl_get_version_string () |
| Get version string. | |
| char * | vl_configuration_to_string_copy () |
| Human readable library configuration. | |
| void | vl_set_simd_enabled (vl_bool x) |
| Toggle usage of SIMD instructions. | |
| vl_bool | vl_get_simd_enabled () |
| Are SIMD instructons enabled? | |
| vl_bool | vl_cpu_has_sse3 () |
| Check for SSE3 instruction set. | |
| vl_bool | vl_cpu_has_sse2 () |
| Check for SSE2 instruction set. | |
| int | vl_get_num_cpus () |
| VLFeat thread state. | |
| VlRand * | vl_get_rand () |
| Get the random number generator for this thread. | |
Detailed Description
This module provides the following functionalities:
- C preprocessor
- State and configuration parameters
- Error handling
- Memory allocation
- Logging
- Measuring time
C preprocessor
VLFeat provides a few C preprocessor macros of general utility. These include stringification (VL_STRINGIFY, VL_XSTRINGIFY) and concatenation (VL_CAT, VL_XCAT) of symbols.
State and configuration parameters
VLFeat has some global configuration parameters that can changed. Changing the configuration is thread unsave (Multi-threading). Use vl_set_simd to toggle the use of a SIMD unit (Intel SSE code), vl_set_alloc_func to change the memory allocation functions, and vl_set_printf_func to change the logging function.
Error handling
Some VLFeat functions signal errors in a way similar to the standard C library. In case of error, a VLFeat function may return an error code directly, or an invalid result (for instance a negative file descriptor or a null pointer). Then vl_get_last_error and vl_get_last_error_message can be used to retrieve further details about the error (these functions should be used right after an error has occurred, before any other VLFeat call).
Memory allocation
VLFeat uses the vl_malloc, vl_realloc, vl_calloc and vl_free functions to allocate memory. Normally these functions are mapped to the underlying standard C library implementations. However vl_set_alloc_func can be used to map them to other implementations. For instance, in MATALB MEX files these functions are mapped to the MATLAB equivalent which has a garbage collection mechanism to cope with interruptions during execution.
Logging
VLFeat uses the macros VL_PRINT and VL_PRINTF to print progress or debug informations. These functions are normally mapped to the printf function of the underlying standard C library. However vl_set_printf_func can be used to map it to a different implementation. For instance, in MATLAB MEX files this function is mapped to mexPrintf. Setting the function to NULL disables logging.
Measuring time
VLFeat provides vl_tic and vl_toc as an easy way of measuring elapsed time.
Definition in file generic.h.
Define Documentation
| #define VL_ERR_BAD_ARG 3 |
Bad argument or illegal data error
Definition at line 195 of file generic.h.
Referenced by vl_pgm_read_new().
| #define VL_ERR_EOF 5 |
End-of-file or end-of-sequence error
Definition at line 197 of file generic.h.
Referenced by vl_sift_process_first_octave(), and vl_sift_process_next_octave().
| #define VL_ERR_NO_MORE 5 |
| #define VL_ERR_OK 0 |
No error
Definition at line 192 of file generic.h.
Referenced by vl_sift_process_first_octave(), and vl_sift_process_next_octave().
| #define VL_MAX | ( | x, | |||
| y | ) | (((x)>(y))?(x):(y)) |
- Parameters:
-
x value. y value.
- Returns:
- the maximum of x and y.
Definition at line 266 of file generic.h.
Referenced by _vl_sift_smooth(), vl_ikm_set_verbosity(), vl_irodrigues(), vl_mser_process(), vl_pgm_write_f(), vl_quickshift_new(), vl_quickshift_process(), vl_sift_calc_keypoint_descriptor(), vl_sift_calc_keypoint_orientations(), vl_sift_calc_raw_descriptor(), vl_sift_keypoint_init(), and vl_sift_new().
| #define VL_MIN | ( | x, | |||
| y | ) | (((x)<(y))?(x):(y)) |
- Parameters:
-
x value y value
- Returns:
- the minimum of x and y.
Definition at line 259 of file generic.h.
Referenced by vl_hikm_train(), vl_kdtree_build_recursively(), vl_pgm_write_f(), vl_quickshift_process(), vl_sift_calc_keypoint_descriptor(), vl_sift_calc_keypoint_orientations(), vl_sift_calc_raw_descriptor(), vl_sift_keypoint_init(), vl_sift_new(), vl_sift_process_next_octave(), vl_string_copy(), vl_string_copy_sub(), vl_string_replace_wildcard(), and xmeans().
| #define VL_PRINTF (*vl_get_state()->printf_func) |
The function calls the user customizable printf.
Definition at line 241 of file generic.h.
Referenced by vl_aib_process(), vl_ikm_train(), vl_ikm_train_elkan(), and xmeans().
| #define VL_SHIFT_LEFT | ( | x, | |||
| n | ) | (((n)>=0)?((x)<<(n)):((x)>>-(n))) |
The macro is equivalent to the builtin << operator, but it supports negative shifts too.
- Parameters:
-
x value. n number of shift positions.
- Returns:
x<< n .
Definition at line 277 of file generic.h.
Referenced by vl_sift_new(), vl_sift_process_first_octave(), and vl_sift_process_next_octave().
| #define VL_TYPE_DOUBLE 2 |
- Parameters:
-
type data type.
- Returns:
- data type symbolic name.
type is one of VL_TYPE_FLOAT, VL_TYPE_DOUBLE, VL_TYPE_INT8, VL_TYPE_INT16, VL_TYPE_INT32, VL_TYPE_INT64, VL_TYPE_UINT8, VL_TYPE_UINT16, VL_TYPE_UINT32, VL_TYPE_UINT64.
Definition at line 42 of file generic.h.
Referenced by vl_get_type_name(), vl_get_type_size(), vl_kdforest_new(), vl_kdforest_query_recursively(), and vl_kdtree_build_recursively().
| #define VL_TYPE_FLOAT 1 |
- Parameters:
-
type data type.
- Returns:
- data type symbolic name.
type is one of VL_TYPE_FLOAT, VL_TYPE_DOUBLE, VL_TYPE_INT8, VL_TYPE_INT16, VL_TYPE_INT32, VL_TYPE_INT64, VL_TYPE_UINT8, VL_TYPE_UINT16, VL_TYPE_UINT32, VL_TYPE_UINT64.
Definition at line 41 of file generic.h.
Referenced by vl_get_type_name(), vl_get_type_size(), vl_kdforest_new(), vl_kdforest_query_recursively(), and vl_kdtree_build_recursively().
| #define VL_TYPE_INT16 5 |
- Parameters:
-
type data type.
- Returns:
- data type symbolic name.
type is one of VL_TYPE_FLOAT, VL_TYPE_DOUBLE, VL_TYPE_INT8, VL_TYPE_INT16, VL_TYPE_INT32, VL_TYPE_INT64, VL_TYPE_UINT8, VL_TYPE_UINT16, VL_TYPE_UINT32, VL_TYPE_UINT64.
Definition at line 45 of file generic.h.
Referenced by vl_get_type_name(), and vl_get_type_size().
| #define VL_TYPE_INT32 7 |
- Parameters:
-
type data type.
- Returns:
- data type symbolic name.
type is one of VL_TYPE_FLOAT, VL_TYPE_DOUBLE, VL_TYPE_INT8, VL_TYPE_INT16, VL_TYPE_INT32, VL_TYPE_INT64, VL_TYPE_UINT8, VL_TYPE_UINT16, VL_TYPE_UINT32, VL_TYPE_UINT64.
Definition at line 47 of file generic.h.
Referenced by vl_get_type_name(), and vl_get_type_size().
| #define VL_TYPE_INT64 9 |
- Parameters:
-
type data type.
- Returns:
- data type symbolic name.
type is one of VL_TYPE_FLOAT, VL_TYPE_DOUBLE, VL_TYPE_INT8, VL_TYPE_INT16, VL_TYPE_INT32, VL_TYPE_INT64, VL_TYPE_UINT8, VL_TYPE_UINT16, VL_TYPE_UINT32, VL_TYPE_UINT64.
Definition at line 49 of file generic.h.
Referenced by vl_get_type_name(), and vl_get_type_size().
| #define VL_TYPE_INT8 3 |
- Parameters:
-
type data type.
- Returns:
- data type symbolic name.
type is one of VL_TYPE_FLOAT, VL_TYPE_DOUBLE, VL_TYPE_INT8, VL_TYPE_INT16, VL_TYPE_INT32, VL_TYPE_INT64, VL_TYPE_UINT8, VL_TYPE_UINT16, VL_TYPE_UINT32, VL_TYPE_UINT64.
Definition at line 43 of file generic.h.
Referenced by vl_get_type_name(), and vl_get_type_size().
| #define VL_TYPE_UINT16 6 |
- Parameters:
-
type data type.
- Returns:
- data type symbolic name.
type is one of VL_TYPE_FLOAT, VL_TYPE_DOUBLE, VL_TYPE_INT8, VL_TYPE_INT16, VL_TYPE_INT32, VL_TYPE_INT64, VL_TYPE_UINT8, VL_TYPE_UINT16, VL_TYPE_UINT32, VL_TYPE_UINT64.
Definition at line 46 of file generic.h.
Referenced by vl_get_type_name(), and vl_get_type_size().
| #define VL_TYPE_UINT32 8 |
- Parameters:
-
type data type.
- Returns:
- data type symbolic name.
type is one of VL_TYPE_FLOAT, VL_TYPE_DOUBLE, VL_TYPE_INT8, VL_TYPE_INT16, VL_TYPE_INT32, VL_TYPE_INT64, VL_TYPE_UINT8, VL_TYPE_UINT16, VL_TYPE_UINT32, VL_TYPE_UINT64.
Definition at line 48 of file generic.h.
Referenced by vl_get_type_name(), and vl_get_type_size().
| #define VL_TYPE_UINT64 10 |
- Parameters:
-
type data type.
- Returns:
- data type symbolic name.
type is one of VL_TYPE_FLOAT, VL_TYPE_DOUBLE, VL_TYPE_INT8, VL_TYPE_INT16, VL_TYPE_INT32, VL_TYPE_INT64, VL_TYPE_UINT8, VL_TYPE_UINT16, VL_TYPE_UINT32, VL_TYPE_UINT64.
Definition at line 50 of file generic.h.
Referenced by vl_get_type_name(), and vl_get_type_size().
| #define VL_TYPE_UINT8 4 |
- Parameters:
-
type data type.
- Returns:
- data type symbolic name.
type is one of VL_TYPE_FLOAT, VL_TYPE_DOUBLE, VL_TYPE_INT8, VL_TYPE_INT16, VL_TYPE_INT32, VL_TYPE_INT64, VL_TYPE_UINT8, VL_TYPE_UINT16, VL_TYPE_UINT32, VL_TYPE_UINT64.
Definition at line 44 of file generic.h.
Referenced by vl_get_type_name(), and vl_get_type_size().
Typedef Documentation
| typedef int(* printf_func_t)(char const *format,...) |
- Parameters:
-
type data type.
- Returns:
- data type symbolic name.
type is one of VL_TYPE_FLOAT, VL_TYPE_DOUBLE, VL_TYPE_INT8, VL_TYPE_INT16, VL_TYPE_INT32, VL_TYPE_INT64, VL_TYPE_UINT8, VL_TYPE_UINT16, VL_TYPE_UINT32, VL_TYPE_UINT64.
| typedef struct _VlThreadSpecificState VlThreadSpecificState |
For internal use only.
Function Documentation
| void * vl_calloc | ( | size_t | n, | |
| size_t | size | |||
| ) | [inline] |
- Parameters:
-
n size of each element in byte. size size of the array to allocate (number of elements).
The function calls the user-customizable calloc.
- Returns:
- result of the user-customizable
calloc.
Definition at line 394 of file generic.h.
References vl_get_state().
Referenced by vl_kdforest_query(), vl_mser_new(), vl_quickshift_new(), and vl_quickshift_process().
| char* vl_configuration_to_string_copy | ( | ) |
------------------------------------------------------------------
- Returns:
- a new string with the library configuration.
The function returns a new string with a human readable rendition of the library configuration.
Definition at line 361 of file generic.c.
References vl_free(), vl_get_num_cpus(), vl_get_state(), vl_get_version_string(), vl_malloc(), and vl_static_configuration_to_string_copy().
| vl_bool vl_cpu_has_sse2 | ( | ) | [inline] |
- Returns:
trueif SSE2 is present.
Definition at line 355 of file generic.h.
References vl_get_state().
| vl_bool vl_cpu_has_sse3 | ( | ) | [inline] |
- Returns:
trueif SSE3 is present.
Definition at line 345 of file generic.h.
References vl_get_state().
| void vl_free | ( | void * | ptr | ) | [inline] |
- Parameters:
-
ptr buffer to free.
The function calls the user customizable free.
Definition at line 400 of file generic.h.
References vl_get_state().
Referenced by _vl_dsift_free_buffers(), _vl_dsift_with_gaussian_window(), _vl_sift_smooth(), alloc(), vl_aib_delete(), vl_aib_update_beta(), vl_configuration_to_string_copy(), vl_dsift_delete(), vl_hikm_delete(), vl_homogeneouskernelmap_delete(), vl_homogeneouskernelmap_new(), vl_ikm_delete(), vl_ikm_init_elkan(), vl_ikm_init_rand_data(), vl_ikm_train_elkan(), vl_ikm_train_lloyd(), vl_kdforest_delete(), vl_kdforest_query(), vl_kmeans_delete(), vl_kmeans_reset(), vl_mser_delete(), vl_mser_ell_fit(), vl_mser_process(), vl_pgm_insert(), vl_pgm_read_new(), vl_pgm_read_new_f(), vl_pgm_write_f(), vl_quickshift_delete(), vl_quickshift_process(), vl_sift_delete(), xdelete(), and xmeans().
| double vl_get_cpu_time | ( | ) |
------------------------------------------------------------------
- Returns:
- processor time.
Definition at line 644 of file generic.c.
References vl_get_thread_specific_state().
| int vl_get_last_error | ( | ) | [inline] |
The function returns the code of the last error generated by VLFeat.
- Returns:
- laste error code.
Definition at line 371 of file generic.h.
References vl_get_thread_specific_state().
| char const * vl_get_last_error_message | ( | ) | [inline] |
For internal use only.
The function returns the message of the last error generated by VLFeat.
- Returns:
- last error message.
Definition at line 376 of file generic.h.
References vl_get_thread_specific_state().
| int vl_get_num_cpus | ( | ) | [inline] |
For internal use only.
Definition at line 365 of file generic.h.
References vl_get_state().
Referenced by vl_configuration_to_string_copy().
| VlRand* vl_get_rand | ( | ) |
------------------------------------------------------------------
- Returns:
- random number generator.
The function returns a pointer to the random number genrator for this thread.
Definition at line 712 of file generic.c.
References vl_get_thread_specific_state().
Referenced by vl_ikm_init_rand(), vl_ikm_init_rand_data(), and vl_kdforest_new().
| vl_bool vl_get_simd_enabled | ( | ) | [inline] |
- Returns:
trueis SIMD instructions are enabled.
Definition at line 339 of file generic.h.
References vl_get_state().
| VlState * vl_get_state | ( | ) | [inline] |
For internal use only.
The function returns a pointer to VLFeat global state.
- Returns:
- pointer to the global state structure.
Definition at line 294 of file generic.h.
References _vl_state.
Referenced by vl_calloc(), vl_configuration_to_string_copy(), vl_cpu_has_sse2(), vl_cpu_has_sse3(), vl_destructor(), vl_free(), vl_get_num_cpus(), vl_get_simd_enabled(), vl_get_thread_specific_state(), vl_lock_state(), vl_malloc(), vl_realloc(), vl_set_alloc_func(), vl_set_printf_func(), vl_set_simd_enabled(), and vl_unlock_state().
| VlThreadSpecificState * vl_get_thread_specific_state | ( | ) | [inline] |
For internal use only.
The function returns a pointer to VLFeat thread state.
- Returns:
- pointer to the thread state structure.
Definition at line 300 of file generic.h.
References vl_get_state(), vl_lock_state(), vl_thread_specific_state_new(), and vl_unlock_state().
Referenced by vl_get_cpu_time(), vl_get_last_error(), vl_get_last_error_message(), vl_get_rand(), vl_pgm_extract_data(), vl_pgm_extract_head(), vl_pgm_insert(), vl_pgm_read_new(), vl_pgm_write(), vl_set_last_error(), vl_tic(), and vl_toc().
| char const* vl_get_type_name | ( | vl_type | type | ) | [inline] |
- Parameters:
-
type data type.
- Returns:
- data type symbolic name.
type is one of VL_TYPE_FLOAT, VL_TYPE_DOUBLE, VL_TYPE_INT8, VL_TYPE_INT16, VL_TYPE_INT32, VL_TYPE_INT64, VL_TYPE_UINT8, VL_TYPE_UINT16, VL_TYPE_UINT32, VL_TYPE_UINT64.
Definition at line 64 of file generic.h.
References VL_TYPE_DOUBLE, VL_TYPE_FLOAT, VL_TYPE_INT16, VL_TYPE_INT32, VL_TYPE_INT64, VL_TYPE_INT8, VL_TYPE_UINT16, VL_TYPE_UINT32, VL_TYPE_UINT64, and VL_TYPE_UINT8.
- Parameters:
-
type data type.
- Returns:
- size (in byte)
type is one of VL_TYPE_FLOAT, VL_TYPE_DOUBLE, VL_TYPE_INT8, VL_TYPE_INT16, VL_TYPE_INT32, VL_TYPE_INT64, VL_TYPE_UINT8, VL_TYPE_UINT16, VL_TYPE_UINT32, VL_TYPE_UINT64.
Definition at line 91 of file generic.h.
References VL_TYPE_DOUBLE, VL_TYPE_FLOAT, VL_TYPE_INT16, VL_TYPE_INT32, VL_TYPE_INT64, VL_TYPE_INT8, VL_TYPE_UINT16, VL_TYPE_UINT32, VL_TYPE_UINT64, and VL_TYPE_UINT8.
Referenced by vl_kmeans_new_copy().
| char const* vl_get_version_string | ( | ) |
------------------------------------------------------------------
- Returns:
- library version string
Definition at line 347 of file generic.c.
References VL_VERSION_STRING.
Referenced by vl_configuration_to_string_copy().
| void vl_lock_state | ( | ) |
------------------------------------------------------------------
For internal use only.
The function locks VLFeat global state mutex.The mutex is recursive: locking multiple times from the same thread is a valid operations, but requires an equivalent number of calls to vl_unlock_state.
- See also:
- vl_unlock_state
Definition at line 417 of file generic.c.
References vl_get_state().
Referenced by vl_get_thread_specific_state(), and vl_set_alloc_func().
| void * vl_malloc | ( | size_t | n | ) | [inline] |
- Parameters:
-
n number of bytes to allocate.
The function calls the user customizable malloc.
- Returns:
- result of
malloc
Definition at line 382 of file generic.h.
References vl_get_state().
Referenced by _vl_dsift_alloc_buffers(), _vl_dsift_new_kernel(), _vl_sift_smooth(), alloc(), vl_aib_new(), vl_aib_new_nodelist(), vl_aib_new_Pc(), vl_aib_new_Px(), vl_aib_update_beta(), vl_configuration_to_string_copy(), vl_dsift_new(), vl_hikm_copy_subset(), vl_hikm_new(), vl_homogeneouskernelmap_new(), vl_ikm_init_elkan(), vl_ikm_init_rand_data(), vl_ikm_new(), vl_ikm_train_elkan(), vl_ikm_train_lloyd(), vl_kdforest_build(), vl_kdforest_new(), vl_kdforest_query(), vl_kmeans_new(), vl_kmeans_new_copy(), vl_mser_ell_fit(), vl_mser_new(), vl_mser_process(), vl_pgm_insert(), vl_pgm_read_new(), vl_pgm_read_new_f(), vl_pgm_write_f(), vl_quickshift_new(), vl_sift_detect(), vl_sift_new(), vl_static_configuration_to_string_copy(), and xmeans().
| void * vl_realloc | ( | void * | ptr, | |
| size_t | n | |||
| ) | [inline] |
- Parameters:
-
ptr buffer to reallocate. n number of bytes to allocate.
The function calls the user-customizable realloc.
- Returns:
- result of the user-customizable
realloc.
Definition at line 388 of file generic.h.
References vl_get_state().
Referenced by vl_sift_detect().
| void vl_set_alloc_func | ( | void *(*)(size_t) | malloc_func, | |
| void *(*)(void *, size_t) | realloc_func, | |||
| void *(*)(size_t, size_t) | calloc_func, | |||
| void(*)(void *) | free_func | |||
| ) |
------------------------------------------------------------------
- Parameters:
-
malloc_func pointer to malloc.realloc_func pointer to realloc.calloc_func pointer to calloc.free_func pointer to free.
Definition at line 615 of file generic.c.
References vl_get_state(), vl_lock_state(), and vl_unlock_state().
| int vl_set_last_error | ( | int | error, | |
| char const * | errorMessage, | |||
| ... | ||||
| ) |
------------------------------------------------------------------
For internal use only.
The function sets the code and optionally the error message of the last encountered error. errorMessage is the message format. It uses the printf convention and is followed by the format arguments. The maximum lenght of the error message is given by VL_ERR_MSG_LEN (longer messages are truncated).Passing NULL as errorMessage sets the error message to the empty string.
- Parameters:
-
error error code. errorMessage error message format string. ... format string arguments.
- Returns:
- error code.
Definition at line 585 of file generic.c.
References vl_get_thread_specific_state().
| void vl_set_printf_func | ( | printf_func_t | printf_func | ) |
- Parameters:
-
printf_func pointer to printf. Letprint_funcbe NULL to disable printf.
Definition at line 631 of file generic.c.
References do_nothing_printf(), and vl_get_state().
| void vl_set_simd_enabled | ( | vl_bool | x | ) | [inline] |
- Parameters:
-
x trueif SIMD instructions are used.
Notice that SIMD instructions are used only if the CPU model supports them. Note also that data alignment may restrict the use of such instructions.
- See also:
- vl_cpu_has_sse2(), vl_cpu_has_sse3(), etc.
Definition at line 333 of file generic.h.
References vl_get_state().
| void vl_thread_specific_state_delete | ( | VlThreadSpecificState * | self | ) |
| VlThreadSpecificState* vl_thread_specific_state_new | ( | ) |
For internal use only.
Definition at line 722 of file generic.c.
References vl_rand_init().
Referenced by vl_get_thread_specific_state().
| void vl_tic | ( | ) |
------------------------------------------------------------------
- See also:
- vl_get_cup_time, vl_toc
Definition at line 663 of file generic.c.
References vl_get_thread_specific_state().
| double vl_toc | ( | ) |
------------------------------------------------------------------ The function returns the processor time elapsed since vl_tic was called last.
- Remarks:
- In multi-threaded applications, there is an independent timer for each execution thread.
-
On UNIX, this function uses the
clock()system call. On Windows, it uses theQueryPerformanceCounter()system call, which is more accurate thanclock()on this platform.
- Returns:
- elapsed time in seconds.
Definition at line 690 of file generic.c.
References vl_get_thread_specific_state().
| void vl_unlock_state | ( | ) |
------------------------------------------------------------------
For internal use only.
The function unlocks VLFeat global state mutex.
- See also:
- vl_lock_state
Definition at line 450 of file generic.c.
References vl_get_state().
Referenced by vl_get_thread_specific_state(), and vl_set_alloc_func().
Variable Documentation
For internal use only.
---------------------------------------------------------------
Definition at line 402 of file generic.c.
Referenced by vl_get_state().