FFmpeg
Loading...
Searching...
No Matches
Memory Initialization

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

Macros

#define CLEAR_BUF(buf)
 Clear a fixed size buffer (convenience macro)
 
#define RANDOMIZE_BUF(buf)
 Fill a fixed size buffer with random data (convenience macro)
 
#define INITIALIZE_BUF(buf)
 Fill a fixed size buffer with pathological test data (convenience macro)
 

Functions

CHECKASM_API void checkasm_randomize (void *buf, size_t bytes)
 Fill a buffer with uniformly chosen random bytes.
 
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.
 
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.
 
CHECKASM_API void checkasm_randomize_range (double *buf, int width, double range)
 Fill a double buffer with random values chosen uniformly below a limit.
 
CHECKASM_API void checkasm_randomize_rangef (float *buf, int width, float range)
 Fill a float buffer with random values chosen uniformly below a limit.
 
CHECKASM_API void checkasm_randomize_interval (double *buf, int width, double low, double high)
 Fill a double buffer with random values chosen uniformly from an interval.
 
CHECKASM_API void checkasm_randomize_intervalf (float *buf, int width, float low, float high)
 Fill a float buffer with random values chosen uniformly from an interval.
 
CHECKASM_API void checkasm_randomize_dist (double *buf, int width, CheckasmDist dist)
 Fill a double buffer with normally distributed random values.
 
CHECKASM_API void checkasm_randomize_distf (float *buf, int width, CheckasmDist dist)
 Fill a float buffer with normally distributed random values.
 
CHECKASM_API void checkasm_randomize_norm (double *buf, int width)
 Fill a double buffer with values from a standard normal distribution.
 
CHECKASM_API void checkasm_randomize_normf (float *buf, int width)
 Fill a float buffer with values from a standard normal distribution.
 
CHECKASM_API void checkasm_clear (void *buf, size_t bytes)
 Clear a buffer to a pre-determined pattern (currently 0xAA)
 
CHECKASM_API void checkasm_clear8 (uint8_t *buf, int width, uint8_t val)
 Fill a uint8_t buffer with a constant value.
 
CHECKASM_API void checkasm_clear16 (uint16_t *buf, int width, uint16_t val)
 Fill a uint16_t buffer with a constant value.
 
CHECKASM_API void checkasm_init (void *buf, size_t bytes)
 Initialize a buffer with pathological test patterns.
 
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.
 
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.
 

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)
Value:
checkasm_clear(buf, sizeof(buf))
CHECKASM_API void checkasm_clear(void *buf, size_t bytes)
Clear a buffer to a pre-determined pattern (currently 0xAA)
Definition utils.c:372

Clear a fixed size buffer (convenience macro)

Parameters
bufFixed-size buffer array to clear

Definition at line 332 of file utils.h.

◆ RANDOMIZE_BUF

#define RANDOMIZE_BUF ( buf)
Value:
checkasm_randomize(buf, sizeof(buf))
CHECKASM_API void checkasm_randomize(void *buf, size_t bytes)
Fill a buffer with uniformly chosen random bytes.
Definition utils.c:290

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

Parameters
bufFixed-size buffer array to randomize

Definition at line 339 of file utils.h.

◆ INITIALIZE_BUF

#define INITIALIZE_BUF ( buf)
Value:
checkasm_init(buf, sizeof(buf))
CHECKASM_API void checkasm_init(void *buf, size_t bytes)
Initialize a buffer with pathological test patterns.
Definition utils.c:431

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 347 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 290 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 295 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 302 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 309 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 316 of file utils.c.

◆ checkasm_randomize_interval()

CHECKASM_API void checkasm_randomize_interval ( double * buf,
int width,
double low,
double high )

Fill a double buffer with random values chosen uniformly from an interval.

Parameters
[out]bufBuffer to fill
[in]widthNumber of elements to randomize
[in]lowInclusive lower bound on value
[in]highInclusive upper bound on value

Definition at line 323 of file utils.c.

◆ checkasm_randomize_intervalf()

CHECKASM_API void checkasm_randomize_intervalf ( float * buf,
int width,
float low,
float high )

Fill a float buffer with random values chosen uniformly from an interval.

Parameters
[out]bufBuffer to fill
[in]widthNumber of elements to randomize
[in]lowInclusive lower bound on value
[in]highInclusive upper bound on value

Definition at line 330 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 352 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 357 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 362 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 367 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 372 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 377 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 382 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 431 of file utils.c.

Referenced by check_lut_3d().

◆ 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()