Generic (Preprocssor, library state, etc.)
More...
#include "host.h"
#include "random.h"
#include <stdlib.h>
#include <stddef.h>
#include <time.h>
#include <assert.h>
#include <Windows.h>
Macros |
#define | VL_VERSION_STRING "0.9.16" |
| Library version string.
|
#define | VL_ERR_MSG_LEN 1024 |
| Maximum length (in characters) of an error message.
|
|
#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 |
|
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.
|
|
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.
|
Detailed Description
Macro Definition Documentation
Resource allocation error
Bad argument or illegal data error
End-of-file or end-of-sequence error
#define VL_ERR_OVERFLOW 1 |
#define VL_MAX |
( |
|
x, |
|
|
|
y |
|
) |
| (((x)>(y))?(x):(y)) |
- Parameters:
-
- Returns:
- the maximum of x and y.
#define VL_MIN |
( |
|
x, |
|
|
|
y |
|
) |
| (((x)<(y))?(x):(y)) |
- Parameters:
-
- Returns:
- the minimum of x and y.
The function calls the user customizable printf
.
#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 .
#define VL_TYPE_UINT64 10 |
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
.
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.
- Returns:
true
if SSE2 is present.
- Returns:
true
if SSE3 is present.
void vl_free |
( |
void * |
ptr | ) |
|
|
inline |
- Parameters:
-
The function calls the user customizable free
.
double vl_get_cpu_time |
( |
| ) |
|
int vl_get_last_error |
( |
| ) |
|
|
inline |
The function returns the code of the last error generated by VLFeat.
- Returns:
- laste error code.
char const * vl_get_last_error_message |
( |
| ) |
|
|
inline |
The function returns the message of the last error generated by VLFeat.
- Returns:
- last error message.
- Returns:
- random number generator.
The function returns a pointer to the random number genrator for this thread.
- Returns:
true
is SIMD instructions are enabled.
The function returns a pointer to VLFeat global state.
- Returns:
- pointer to the global state structure.
The function returns a pointer to VLFeat thread state.
- Returns:
- pointer to the thread state structure.
char const* vl_get_type_name |
( |
vl_type |
type | ) |
|
|
inline |
vl_size vl_get_type_size |
( |
vl_type |
type | ) |
|
|
inline |
char const* vl_get_version_string |
( |
| ) |
|
- Returns:
- library version string
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
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
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
.
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 . |
int vl_set_last_error |
( |
int |
error, |
|
|
char const * |
errorMessage, |
|
|
|
... |
|
) |
| |
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.
- Parameters:
-
printf_func | pointer to printf . Let print_func be NULL to disable printf. |
void vl_set_simd_enabled |
( |
vl_bool |
x | ) |
|
|
inline |
- Parameters:
-
x | true if 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.
The function returns the processor time elapsed since vl_tic was called last.
- Returns:
- elapsed time in seconds.
The function unlocks VLFeat global state mutex.
- See also:
- vl_lock_state
Variable Documentation