Function

vDSP_vsmfix24

Scales and converts single-precision floating-point values to signed 24-bit integer values.

Declaration

void vDSP_vsmfix24(const float *__A, vDSP_Stride __IA, const float *__B, vDSP_int24 *__C, vDSP_Stride __IC, vDSP_Length __N);

Parameters

__A

Single-precision floating-point input vector.

__IA

Stride for A.

__B

Pointer to a floating-point scaling factor.

__C

Signed 24-bit output vector.

__IC

Stride for C.

__N

The number of values to convert.

Discussion

This function scales vector A by the scalar *B and converts each resulting value to a signed 24-bit integer, placing the results in C. Values (after scaling) that are outside the range that can be represented by signed 24-bit integers are clamped to the largest or smallest representable values.

This function performs the following operations:

    for (n = 0; n < N; ++n)
    {
        if     (A[n*IA] * *B < INT24_MIN)
            C[n*IC] = INT24_MIN
        else if (A[n*IA] * *B > INT24_MAX)
            C[n*IC] = INT24_MAX
        else
            C[n*IC] = (int24)(A[n*IA] * *B);
    }

In this pseudocode, INT24_MIN is equal to -(2^23), and INT24_MAX is equal to 2^23 - 1.

See Also

Floating Point to 24-Bit Integer Conversion

vDSP_vsmfixu24

Scales and converts single-precision floating-point values to unsigned 24-bit integer values.

vDSP_vflt24

Converts signed 24-bit integer values to single-precision floating-point values.

vDSP_vfltu24

Converts unsigned 24-bit integer values to single-precision floating-point values.

vDSP_vfltsm24

Converts and scales signed 24-bit integer values to single-precision floating-point values.

vDSP_vfltsmu24

Converts and scales unsigned 24-bit integer values to single-precision floating-point values.

vDSP_uint24

A data structure that holds a 24-bit unsigned integer value.

vDSP_int24

A data structure that holds a 24-bit signed integer value.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software