Maestro Audio Framework v 1.7
NXP Semiconductors
Loading...
Searching...
No Matches
general_utils.c File Reference

This file provides general helper and data conversion functions. More...

#include "general_utils.h"

Functions

int32_t smallest_int (int32_t a, int32_t b)
 smallest_int
 
uint32_t _transform_16_to_32 (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
 Extend 16 bit per sample to 32bit per sample.
 
uint32_t _transform_24_to_32 (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
 Extend 24 bit per sample to 32bit per sample.
 
uint32_t _transform_32_to_24 (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
 Compress 32 bit per sample to 24 bit per sample.
 
uint32_t _transform_32_to_16 (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
 Compress 32 bit per sample to 16 bit per sample.
 
uint32_t data_copy_32bits (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
 Equivalent to a memcpy used with src and dest size validation to determine the amount of bytes to copy.
 
uint32_t _interleave_16_to_32 (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
 Used to interleave samples from two input buffers on an output buffer.
 
uint32_t _interleave_24_to_32 (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
 Used to interleave samples from two input buffers on an output buffer.
 
uint32_t _interleave_32bits (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
 Used to interleave samples from two input buffers on an output buffer.
 

Function Documentation

◆ smallest_int()

int32_t smallest_int ( int32_t a,
int32_t b )

Function to determine the smallest of two integers.

Parameters
afirst integer
bsecond integer
Returns
value of the smallest integer

◆ _transform_16_to_32()

uint32_t _transform_16_to_32 ( void * src,
uint32_t src_len,
void * dst,
uint32_t dst_len )
Parameters
src[in] 16bit sample's buffer
src_len[in] Number of bytes in the input
dst[OUT] Output buffer where the 32-bit data is going to be written
dst_len[in] Maximum num of bytes that should be written on the output
Returns
uint32_t Number of bytes that were written in the destination buffer

This function uses src_len as the number byes and the number of bytes in dst_len to determine how many bytes will be copied in the output buffer dst. The return value will be the number in bytes that was copied to the out buffer

◆ _transform_24_to_32()

uint32_t _transform_24_to_32 ( void * src,
uint32_t src_len,
void * dst,
uint32_t dst_len )
Parameters
src[in] 24 bit sample's buffer
src_len[in] Number of bytes in the input
dst[OUT] Output buffer where the 32-bit data is going to be written
dst_len[in] Maximum num of bytes that should be written on the output
Returns
uint32_t Number of bytes that were written in the destination buffer

This function uses src_len as the number byes and the number of bytes in dst_len to determine how many bytes will be copied in the output buffer dst. The return value will be the number in bytes that was copied to the out buffer

◆ _transform_32_to_24()

uint32_t _transform_32_to_24 ( void * src,
uint32_t src_len,
void * dst,
uint32_t dst_len )
Parameters
src[in] 32 bit sample's buffer
src_len[in] Number of bytes in the input
dst[OUT] Output buffer where the 24-bit data is going to be written
dst_len[in] Maximum num of bytes that should be written on the output
Returns
uint32_t Number of bytes that were written in the destination buffer

This function uses src_len as the number byes and the number of bytes in dst_len to determine how many bytes will be copied in the output buffer dst. The return value will be the number in bytes that was copied to the out buffer

◆ _transform_32_to_16()

uint32_t _transform_32_to_16 ( void * src,
uint32_t src_len,
void * dst,
uint32_t dst_len )
Parameters
src[in] 32 bit sample's buffer
src_len[in] Number of bytes in the input
dst[OUT] Output buffer where the 16-bit data is going to be written
dst_len[in] Maximum num of bytes that should be written on the output
Returns
uint32_t Number of bytes that were written in the destination buffer

This function uses src_len as the number byes and the number of bytes in dst_len to determine how many bytes will be copied in the output buffer dst. The return value will be the number in bytes that was copied to the out buffer

◆ data_copy_32bits()

uint32_t data_copy_32bits ( void * src,
uint32_t src_len,
void * dst,
uint32_t dst_len )
Parameters
src[in] 32 bit sample's buffer
src_len[in] Number of bytes in the input
dst[OUT] Output buffer where the 32-bit data is going to be written
dst_len[in] Maximum num of bytes that should be written on the output
Returns
uint32_t Number of bytes that were written in the destination buffer

◆ _interleave_16_to_32()

uint32_t _interleave_16_to_32 ( void * src,
uint32_t src_len,
void * dst,
uint32_t dst_len )
Parameters
src[in] 16 bit sample's buffer
src_len[in] Number of bytes in the input.
dst[OUT] Output buffer where the 32-bit data is going to be written
dst_len[in] Maximum num of bytes that should be written on the output
Returns
uint32_t Number of bytes that were written in the destination buffer

◆ _interleave_24_to_32()

uint32_t _interleave_24_to_32 ( void * src,
uint32_t src_len,
void * dst,
uint32_t dst_len )
Parameters
src[in] 24 bit sample's buffer
src_len[in] Number of bytes in the input.
dst[OUT] Output buffer where the 32-bit data is going to be written
dst_len[in] Maximum num of bytes that should be written on the output
Returns
uint32_t Number of bytes that were written in the destination buffer

◆ _interleave_32bits()

uint32_t _interleave_32bits ( void * src,
uint32_t src_len,
void * dst,
uint32_t dst_len )
Parameters
src[in] 32 bit sample's buffer
src_len[in] Number of bytes in the input. Applies to both input buffers
dst[OUT] Output buffer where the 32-bit data is going to be written
dst_len[in] Maximum num of bytes that should be written on the output
Returns
uint32_t Number of bytes that were written in the destination buffer