FFmpeg
Macros | Functions
Memory Initialization

Functions for filling buffers with various patterns of data. More...

Macros

#define CLEAR_BUF(buf)   checkasm_clear(buf, sizeof(buf))
 Clear a fixed size buffer (convenience macro) More...
 
#define RANDOMIZE_BUF(buf)   checkasm_randomize(buf, sizeof(buf))
 Fill a fixed size buffer with random data (convenience macro) More...
 
#define INITIALIZE_BUF(buf)   checkasm_init(buf, sizeof(buf))
 Fill a fixed size buffer with pathological test data (convenience macro) More...
 

Functions

CHECKASM_API void checkasm_randomize (void *buf, size_t bytes)
 Fill a buffer with uniformly chosen random bytes. More...
 
CHECKASM_API void checkasm_randomize_mask8 (uint8_t *buf, int width, uint8_t mask)
 Fill a uint8_t buffer with random values chosen uniformly within a mask. More...
 
CHECKASM_API void checkasm_randomize_mask16 (uint16_t *buf, int width, uint16_t mask)
 Fill a uint16_t buffer with random values chosen uniformly within a mask. More...
 
CHECKASM_API void checkasm_randomize_range (double *buf, int width, double range)
 Fill a double buffer with random values chosen uniformly below a limit. More...
 
CHECKASM_API void checkasm_randomize_rangef (float *buf, int width, float range)
 Fill a float buffer with random values chosen uniformly below a limit. More...
 
CHECKASM_API void checkasm_randomize_dist (double *buf, int width, CheckasmDist dist)
 Fill a double buffer with normally distributed random values. More...
 
CHECKASM_API void checkasm_randomize_distf (float *buf, int width, CheckasmDist dist)
 Fill a float buffer with normally distributed random values. More...
 
CHECKASM_API void checkasm_randomize_norm (double *buf, int width)
 Fill a double buffer with values from a standard normal distribution. More...
 
CHECKASM_API void checkasm_randomize_normf (float *buf, int width)
 Fill a float buffer with values from a standard normal distribution. More...
 
CHECKASM_API void checkasm_clear (void *buf, size_t bytes)
 Clear a buffer to a pre-determined pattern (currently 0xAA) More...
 
CHECKASM_API void checkasm_clear8 (uint8_t *buf, int width, uint8_t val)
 Fill a uint8_t buffer with a constant value. More...
 
CHECKASM_API void checkasm_clear16 (uint16_t *buf, int width, uint16_t val)
 Fill a uint16_t buffer with a constant value. More...
 
CHECKASM_API void checkasm_init (void *buf, size_t bytes)
 Initialize a buffer with pathological test patterns. More...
 
CHECKASM_API void checkasm_init_mask8 (uint8_t *buf, int width, uint8_t mask)
 Initialize a uint8_t buffer with pathological values within a mask. More...
 
CHECKASM_API void checkasm_init_mask16 (uint16_t *buf, int width, uint16_t mask)
 Initialize a uint16_t buffer with pathological values within a mask. More...
 

Detailed Description

Functions for filling buffers with various patterns of data.

A collection of functions to initialize memory buffers with random data, constant values, or pathological test patterns. These are useful for setting up input/output data buffers for checkasm tests.

Macro Definition Documentation

◆ CLEAR_BUF

#define CLEAR_BUF (   buf)    checkasm_clear(buf, sizeof(buf))

Clear a fixed size buffer (convenience macro)

Parameters
bufFixed-size buffer array to clear

Definition at line 254 of file utils.h.

◆ RANDOMIZE_BUF

#define RANDOMIZE_BUF (   buf)    checkasm_randomize(buf, sizeof(buf))

Fill a fixed size buffer with random data (convenience macro)

Parameters
bufFixed-size buffer array to randomize

Definition at line 261 of file utils.h.

◆ INITIALIZE_BUF

#define INITIALIZE_BUF (   buf)    checkasm_init(buf, sizeof(buf))

Fill a fixed size buffer with pathological test data (convenience macro)

Parameters
bufFixed-size buffer array to initialize
See also
checkasm_init()

Definition at line 269 of file utils.h.

Function Documentation

◆ checkasm_randomize()

CHECKASM_API void checkasm_randomize ( void *  buf,
size_t  bytes 
)

Fill a buffer with uniformly chosen random bytes.

Parameters
[out]bufBuffer to fill
[in]bytesNumber of bytes to randomize

Definition at line 201 of file utils.c.

◆ checkasm_randomize_mask8()

CHECKASM_API void checkasm_randomize_mask8 ( uint8_t *  buf,
int  width,
uint8_t  mask 
)

Fill a uint8_t buffer with random values chosen uniformly within a mask.

Parameters
[out]bufBuffer to fill
[in]widthNumber of elements to randomize
[in]maskBit mask to apply to each random value

Definition at line 208 of file utils.c.

◆ checkasm_randomize_mask16()

CHECKASM_API void checkasm_randomize_mask16 ( uint16_t *  buf,
int  width,
uint16_t  mask 
)

Fill a uint16_t buffer with random values chosen uniformly within a mask.

Parameters
[out]bufBuffer to fill
[in]widthNumber of elements to randomize
[in]maskBit mask to apply to each random value

Definition at line 214 of file utils.c.

◆ checkasm_randomize_range()

CHECKASM_API void checkasm_randomize_range ( double buf,
int  width,
double  range 
)

Fill a double buffer with random values chosen uniformly below a limit.

Parameters
[out]bufBuffer to fill
[in]widthNumber of elements to randomize
[in]rangeExclusive upper bound on value (range is [0, range))

Definition at line 220 of file utils.c.

◆ checkasm_randomize_rangef()

CHECKASM_API void checkasm_randomize_rangef ( float buf,
int  width,
float  range 
)

Fill a float buffer with random values chosen uniformly below a limit.

Parameters
[out]bufBuffer to fill
[in]widthNumber of elements to randomize
[in]rangeExclusive upper bound on value (range is [0, range))

Definition at line 226 of file utils.c.

◆ checkasm_randomize_dist()

CHECKASM_API void checkasm_randomize_dist ( double buf,
int  width,
CheckasmDist  dist 
)

Fill a double buffer with normally distributed random values.

Parameters
[out]bufBuffer to fill
[in]widthNumber of elements to randomize
[in]distDistribution parameters (mean and standard deviation)

Definition at line 247 of file utils.c.

◆ checkasm_randomize_distf()

CHECKASM_API void checkasm_randomize_distf ( float buf,
int  width,
CheckasmDist  dist 
)

Fill a float buffer with normally distributed random values.

Parameters
[out]bufBuffer to fill
[in]widthNumber of elements to randomize
[in]distDistribution parameters (mean and standard deviation)

Definition at line 252 of file utils.c.

◆ checkasm_randomize_norm()

CHECKASM_API void checkasm_randomize_norm ( double buf,
int  width 
)

Fill a double buffer with values from a standard normal distribution.

Parameters
[out]bufBuffer to fill
[in]widthNumber of elements to randomize

Definition at line 257 of file utils.c.

◆ checkasm_randomize_normf()

CHECKASM_API void checkasm_randomize_normf ( float buf,
int  width 
)

Fill a float buffer with values from a standard normal distribution.

Parameters
[out]bufBuffer to fill
[in]widthNumber of elements to randomize

Definition at line 262 of file utils.c.

◆ checkasm_clear()

CHECKASM_API void checkasm_clear ( void *  buf,
size_t  bytes 
)

Clear a buffer to a pre-determined pattern (currently 0xAA)

Parameters
[out]bufBuffer to clear
[in]bytesNumber of bytes to clear

Definition at line 267 of file utils.c.

◆ checkasm_clear8()

CHECKASM_API void checkasm_clear8 ( uint8_t *  buf,
int  width,
uint8_t  val 
)

Fill a uint8_t buffer with a constant value.

Parameters
[out]bufBuffer to fill
[in]widthNumber of elements to set
[in]valValue to write to each element
Note
This is functionally equivalent to memset(), and merely provided for consistency.

Definition at line 272 of file utils.c.

◆ checkasm_clear16()

CHECKASM_API void checkasm_clear16 ( uint16_t *  buf,
int  width,
uint16_t  val 
)

Fill a uint16_t buffer with a constant value.

Parameters
[out]bufBuffer to fill
[in]widthNumber of elements to set
[in]valValue to write to each element

Definition at line 277 of file utils.c.

◆ checkasm_init()

CHECKASM_API void checkasm_init ( void *  buf,
size_t  bytes 
)

Initialize a buffer with pathological test patterns.

Fills a buffer with a random mixture of edge cases, test patterns, and random data designed to trigger potential bugs. The exact pattern depends on the random seed and may include a mix of low values, high values, alternating bits, random bytes, and so on.

Parameters
[out]bufBuffer to initialize
[in]bytesNumber of bytes to initialize

Definition at line 326 of file utils.c.

◆ checkasm_init_mask8()

CHECKASM_API void checkasm_init_mask8 ( uint8_t *  buf,
int  width,
uint8_t  mask 
)

Initialize a uint8_t buffer with pathological values within a mask.

Parameters
[out]bufBuffer to initialize
[in]widthNumber of elements to initialize
[in]maskBit mask to apply to values
See also
checkasm_init()

Referenced by checkasm_init().

◆ checkasm_init_mask16()

CHECKASM_API void checkasm_init_mask16 ( uint16_t *  buf,
int  width,
uint16_t  mask 
)

Initialize a uint16_t buffer with pathological values within a mask.

Parameters
[out]bufBuffer to initialize
[in]widthNumber of elements to initialize
[in]maskBit mask to apply to values
See also
checkasm_init()