1.4.2.25 DSP_MatrixScale32 Function

Scales each element of an input buffer (matrix) by a fixed number.

Description

void DSP_MatrixScale32(int32_t *data_buffer, int N, int32_t num);

Multiply the first N elements of an input buffer by a fixed scalar num. The resulting value is stored back into the input buffer. N number total samples of the input buffer are processed. All values are in Q31 fractional integer format. The result of calculations is saturated to the MAX32 or MIN32 value if exceeded.

Preconditions

data_buffer must be predefined to be equal to or greater than N elements.

N must be a factor of four, or will truncate to the nearest factor of four.

Parameters

data_buffer pointer to the Matrix to be initialized (int32_t)

N number of elements to be initialized (int)

num value to be initialized into the matrix (int32_t)

Returns

None.

Remarks

Execution time (cycles): 190 + 9 cycles / element, typical.

Example

int32_t numScale = 0x40000000; _// 0.5_

int valN = 12;

int32_t inputBufScale[12] = {0x40000000, 0x40000000, 0x20000000, 0x20000000,

0x19999999, 0xCCCCCCCD, 0xF3333333, 0x80000000,

0x7FFFFFFF, 0x00000000, 0x40000000, 0x70000000 };

_// 0.5, 0.5, 0.25, 0.25, 0.25, 0.2, -0.4, -0.1, -1, 1, 0, 0.5, 0.875_

DSP_MatrixScale32(inputBufScale,valN,numScale);

_// inputBufScale[i] = {0x20000000, 0x20000000, 0x10000000, 0x10000000,_

_// 0x0CCCCCCC, 0xE6666666, 0xF9999999, 0xC0000000,_

_// 0x3FFFFFFF, 0x00000000, 0x20000000, 0x38000000}_

_// 0.25, 0.25, 0.125, 0.125, 0.1, -0.2, -0.05, -0.5, 0.5, 0, 0.25, 0.4375_

C

void  DSP_MatrixScale32 (int32_t * data_buffer , int  N , int32_t num );