Helper functions

void convert_to_type()

Converts a float image to uint8/uint16/float, optionally with sRGB conversion.

Parameters:

const uint_fast16_t width

,:

Input image width in pixels (must be power of 2)

const uint_fast16_t height_or_end_row

,:

Input image height in pixels (must be power of 2), or end row for partial processing

const uint_fast8_t channel_stride

,:

Number of total channels in image data

const float* image_in

,:

Pointer to input image, float*

void* image_out

,:

Pointer to pre-allocated target, OutputT*

const LMF_DATA_TYPE out_data_type

,:

Output data type as LMF_DATA_TYPE enum value

const bool convert_srgb = false

,:

(optional) Convert linear to sRGB?

const uint8_t channel_mask = 0

,:

(optional) Bit mask of channels to process, 0 = all channels. You can use channel_mask_from_array() to generate a mask from an array of booleans.

const uint_fast16_t start_row = 0

:

(optional) Start row for partial processing

void convert_to_type_threaded()

Converts a float image to uint8/uint16/float, optionally with sRGB conversion (threaded version)

Template Parameters:

OutputT

:

Output type, uint8/uint16/float

Parameters:

const uint_fast16_t width

,:

Input image width in pixels (must be power of 2)

const uint_fast16_t height_or_end_row

,:

Input image height in pixels (must be power of 2), or end row for partial processing

const uint_fast8_t channel_stride

,:

Number of total channels in image data

const float* image_in

,:

Pointer to input image, float*

void* image_out

,:

Pointer to pre-allocated target, OutputT*

const LMF_DATA_TYPE out_data_type

,:

Output data type as LMF_DATA_TYPE enum value

const bool convert_srgb = false

,:

(optional) Convert linear to sRGB?

const uint8_t channel_mask = 0

,:

(optional) Bit mask of channels to process, 0 = all channels. You can use channel_mask_from_array() to generate a mask from an array of booleans.

const uint8_t max_threads = 0

:

(optional) Number of threads to use. 0 = auto (half of available threads, which amounts to number of hardware cores for machines with SMT/HyperThreading)

uint8_t get_mip_count()

Calculate the number of mip levels for a given resolution.

Parameters:

const uint16_t width

,:

const uint16_t height

:

Returns:

Number of mip levels

uint8_t channel_mask_from_array()

Returns a channel bit mask, for up to 8 channels.

Parameters:

const bool* array

,:

const uint8_t element_count

:

Returns:

Bit mask

void free_mips_memory()

Release memory allocated by generate_mips()

Parameters:

const uint_fast8_t mip_count

,:

float** mips_output

,:

uint8_t** masks_output

: