Qualcomm FastCV Library  1.7.1
Memory Management

Functions

FASTCV_API int fcvPyramidAllocate (fcvPyramidLevel *pyr, unsigned int baseWidth, unsigned int baseHeight, unsigned int bytesPerPixel, unsigned int numLevels, int allocateBase)
 Allocates memory for Pyramid.
FASTCV_API int fcvPyramidAllocate_v2 (fcvPyramidLevel_v2 *pyr, uint32_t baseWidth, uint32_t baseHeight, uint32_t baseStride, uint32_t bytesPerPixel, uint32_t numLevels, int32_t allocateBase)
 Allocates memory for Pyramid.
FASTCV_API fcvStatus fcvPyramidAllocate_v3 (fcvPyramidLevel_v2 *__restrict pyr, uint32_t baseWidth, uint32_t baseHeight, uint32_t baseStride, uint32_t bytesPerPixel, uint32_t alignment, uint32_t numLevels, fcvPyramidScale scale, int32_t allocateBase)
 Allocates memory for Pyramid DO NOT USE THIS API unless for testing purposes. This API can be removed without notice.
FASTCV_API void fcvPyramidDelete (fcvPyramidLevel *pyr, unsigned int numLevels, unsigned int startLevel)
 Deallocates an array of fcvPyramidLevel. Can be used for any type(f32/s8/u8).
FASTCV_API void fcvPyramidDelete_v2 (fcvPyramidLevel_v2 *pyr, uint32_t numLevels, uint32_t startLevel)
 Deallocates an array of fcvPyramidLevel. Can be used for any type(f32/s8/u8).
FASTCV_API void * fcvMemAlloc (unsigned int nBytes, unsigned int byteAlignment)
 Allocates aligned memory.
FASTCV_API void fcvMemFree (void *ptr)
 Frees memory allocated by fcvMemAlloc().
FASTCV_API void fcvMemInit (void)
 Initialize the Memory sub-system in FastCV. The sub-system handles temporary/scratch memory requirements from several FastCV functions that do not have parameters to have this supplied by the users of those functions.
FASTCV_API void fcvMemInitPreAlloc (uint32_t preAllocBytes)
 Initialize the Memory sub-system in FastCV with pre-allocated buffer. The sub-system handles temporary/scratch memory requirements from several FastCV functions that do not have parameters to have this supplied by the users of those functions.
FASTCV_API void fcvMemDeInit (void)
 De-Initialize the Memory sub-system initialized by fcvMemInit() function.

Detailed Description

Functions to allocate and deallocate memory for use with fastCV.


Function Documentation

FASTCV_API void* fcvMemAlloc ( unsigned int  nBytes,
unsigned int  byteAlignment 
)

Allocates aligned memory.

Parameters:
nBytesNumber of bytes.
byteAlignmentAlignment specified in bytes (e.g., 16 = 128-bit alignment).
WARNING: must be < 255 bytes
Returns:
SUCCESS: pointer to aligned memory FAILURE: 0
FASTCV_API void fcvMemDeInit ( void  )

De-Initialize the Memory sub-system initialized by fcvMemInit() function.

Important:
1. Call to this function without a corresponding call to fcvMemInit will result in no-op.

FASTCV_API void fcvMemFree ( void *  ptr)

Frees memory allocated by fcvMemAlloc().

Parameters:
ptrPointer to memory.
FASTCV_API void fcvMemInit ( void  )

Initialize the Memory sub-system in FastCV. The sub-system handles temporary/scratch memory requirements from several FastCV functions that do not have parameters to have this supplied by the users of those functions.

Important:
1. Every call to this function should be followed by a call to fcvMemDeInit().
2. This function (and the fcvMemDeInit) only needs to called once per process.
3. Any call to FastCV functions that uses internal temporary memory outside of fcvMemInit and fcvMemDeInit pair will use non-optimum memory allocation.
4. A call to this function without a corresponding call to fcvMemDeInit can result in memory leak.

FASTCV_API void fcvMemInitPreAlloc ( uint32_t  preAllocBytes)

Initialize the Memory sub-system in FastCV with pre-allocated buffer. The sub-system handles temporary/scratch memory requirements from several FastCV functions that do not have parameters to have this supplied by the users of those functions.

Important:
1. Every call to this function should be followed by a call to fcvMemDeInit().
2. This function (and the fcvMemDeInit) only needs to called once per process.
3. Any call to FastCV functions that uses internal temporary memory outside of fcvMemInit and fcvMemDeInit pair will use non-optimum memory allocation.
4. A call to this function without a corresponding call to fcvMemDeInit can result in memory leak.

Parameters:
preAllocBytesNumber of bytes for the pre-allocated buffer.
FASTCV_API int fcvPyramidAllocate ( fcvPyramidLevel pyr,
unsigned int  baseWidth,
unsigned int  baseHeight,
unsigned int  bytesPerPixel,
unsigned int  numLevels,
int  allocateBase 
)

Allocates memory for Pyramid.


ATTENTION: This function's signature will become OBSOLETE in a future release of this library (2.0.0). The new interface is specified in the function: fcvPyramidAllocate_v2(). In the 2.0.0 release, fcvPyramidAllocate_v2 will be renamed to fcvPyramidAllocate and the signature of fcvPyramidAllocate as it appears now, will be removed.

Parameters:
pyrPointer to an array of fcvPyramidLevel
baseWidthWidth of the base level: the value assigned to pyr[0].width
baseHeightHeight of the base level: the value assigned to pyr[0].height
bytesPerPixelNumber of bytes per pixel:
e.g for uint8_t pyramid, bytesPerPixel = 1
for int32_t pyramid, bytesPerPixel = 4
numLevelsnumber of levels in the pyramid
allocateBase
if set to 1, memory will be allocated for the base level
if set to 0, memory for the base level is allocated by the callee
WARNING: How this parameter is set will impact how the memory is freed. Please refer to fcvPyramidDelete for details.
FASTCV_API int fcvPyramidAllocate_v2 ( fcvPyramidLevel_v2 pyr,
uint32_t  baseWidth,
uint32_t  baseHeight,
uint32_t  baseStride,
uint32_t  bytesPerPixel,
uint32_t  numLevels,
int32_t  allocateBase 
)

Allocates memory for Pyramid.


ATTENTION: This function is a duplication of fcvPyramidAllocate() with the addition of extra parameters. This function has been added to allow for backward compatibility with the original function. When the 2.0.0 release of this library is made, this function will be renamed to: fcvPyramidAllocate, fcvPyramidAllocate_v2 will be removed, and the current signature for fcvPyramidAllocate will be removed. Until 2.0.0, the developer should use this implementation with the expectation of renaming it to fcvPyramidAllocate when transitioning to 2.0.0.

Parameters:
pyrPointer to an array of fcvPyramidLevel_v2
baseWidthWidth of the base level: the value assigned to pyr[0].width
baseHeightHeight of the base level: the value assigned to pyr[0].height
baseStrideStride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. Stride of the base level: the value assigned to pyr[0].stride
NOTE: stride of non-base pyramid image is the same as width*bytesPerPixel of the non-base pyramid image
bytesPerPixelNumber of bytes per pixel:
e.g for uint8_t pyramid, bytesPerPixel = 1
for int32_t pyramid, bytesPerPixel = 4
numLevelsnumber of levels in the pyramid
allocateBase
if set to 1, memory will be allocated for the base level
if set to 0, memory for the base level is allocated by the callee
WARNING: How this parameter is set will impact how the memory is freed. Please refer to fcvPyramidDelete for details.
FASTCV_API fcvStatus fcvPyramidAllocate_v3 ( fcvPyramidLevel_v2 *__restrict  pyr,
uint32_t  baseWidth,
uint32_t  baseHeight,
uint32_t  baseStride,
uint32_t  bytesPerPixel,
uint32_t  alignment,
uint32_t  numLevels,
fcvPyramidScale  scale,
int32_t  allocateBase 
)

Allocates memory for Pyramid DO NOT USE THIS API unless for testing purposes. This API can be removed without notice.


ATTENTION: This function is a duplication of fcvPyramidAllocate_v2() with the addition of extra parameters. This function has been added to allow for backward compatibility with the original function. When the 2.0.0 release of this library is made, this function will be renamed to: fcvPyramidAllocate, fcvPyramidAllocate_v3 will be removed, and the current signature for fcvPyramidAllocate will be removed. Until 2.0.0, the developer should use this implementation with the expectation of renaming it to fcvPyramidAllocate when transitioning to 2.0.0.

Parameters:
pyrPointer to an array of fcvPyramidLevel_v2
baseWidthWidth of the base level: the value assigned to pyr[0].width
baseHeightHeight of the base level: the value assigned to pyr[0].height
baseStrideStride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. Stride of the base level: the value assigned to pyr[0].stride
NOTE: stride of non-base pyramid image is the same as width*bytesPerPixel of the non-base pyramid image
bytesPerPixelNumber of bytes per pixel:
e.g for uint8_t pyramid, bytesPerPixel = 1
for int32_t pyramid, bytesPerPixel = 4
alignmentUsed to specify the alignment of each pyramid level other than the base. Must be a multiple of 8. If set to 0, the alignment will be set as 8 bits.
numLevelsnumber of levels in the pyramid
scaleDefines the type of scaling used for each pyramid level. FASTCV_PYRAMID_SCALE_HALF downscales each level of the pyramid by a factor of 2. FASTCV_PYRAMID_SCALE_ORB downscales each level of the pyramid by a factor of 1/(2)^(1/4), which is approximated as 0.8408964f
allocateBase
if set to 1, memory will be allocated for the base level
if set to 0, memory for the base level is allocated by the callee
WARNING: How this parameter is set will impact how the memory is freed. Please refer to fcvPyramidDelete_v2 for details.
Returns:
FASTCV_SUCCESS upon success. Other status codes upon failure.
FASTCV_API void fcvPyramidDelete ( fcvPyramidLevel pyr,
unsigned int  numLevels,
unsigned int  startLevel 
)

Deallocates an array of fcvPyramidLevel. Can be used for any type(f32/s8/u8).


ATTENTION: This function's signature will become OBSOLETE in a future release of this library (2.0.0). The new interface is specified in the function: fcvPyramidDelete_v2(). In the 2.0.0 release, fcvPyramidDelete_v2 will be renamed to fcvPyramidDelete and the signature of fcvPyramidDelete as it appears now, will be removed.

Parameters:
pyrpyramid to deallocate
numLevelsNumber of levels in the pyramid
startLevelStart level of the pyramid
WARNING: if pyr was allocated with allocateBase=0 which means baselevel memory was allocated outside of fcvPyramidAllocate, then startLevel for fcvPyramidDelete has to be set to 1 (or higher).
FASTCV_API void fcvPyramidDelete_v2 ( fcvPyramidLevel_v2 pyr,
uint32_t  numLevels,
uint32_t  startLevel 
)

Deallocates an array of fcvPyramidLevel. Can be used for any type(f32/s8/u8).


ATTENTION: This function is a duplication of fcvPyramidDelete() with the addition of extra parameters. This function has been added to allow for backward compatibility with the original function. When the 2.0.0 release of this library is made, this function will be renamed to: fcvPyramidDelete, fcvPyramidDelete_v2 will be removed, and the current signature for fcvPyramidDelete will be removed. Until 2.0.0, the developer should use this implementation with the expectation of renaming it to fcvPyramidDelete when transitioning to 2.0.0.

Parameters:
pyrpyramid to deallocate
numLevelsNumber of levels in the pyramid
startLevelStart level of the pyramid
WARNING: if pyr was allocated with allocateBase=0 which means baselevel memory was allocated outside of fcvPyramidAllocate, then startLevel for fcvPyramidDelete_v2 has to be set to 1 (or higher).
 All Data Structures Files Functions Variables Enumerations Enumerator Defines