1.4.2.89 DSP_VectorShift Function

Shifts the data index of an input data vector.

Description

void DSP_VectorShift(int32_t *outdata, int32_t *indata, int N, int shift);

Shifts N data elements of indata to outdata, with an index change of shift. The amount of data shifted includes zero padding for the first (shift) elements if shift is positive. The vector size of indata and outdata need not be the same, however, N must not exceed either array size.

Preconditions

The pointers outdata and indata must be aligned on 4-byte boundaries. N must not exceed the amount of elements in the source array.

shift must not exceed the number of elements in the destination array.

Parameters

outdata pointer to destination array of elements (int32_t)

indata pointer to source array of elements (int32_t)

N number of samples (int)

shift number of indexes to shift (int)

Returns

None.

Remarks

Destination array values shift to left (relative to the input vector) when shift is positive (back filled with zeros) and shift to the right when shift is negative. The total amount of values copied to the destination array is the length of N less the shift amount.

Example

int shiftValue = 3;

int Num = 8;

int32_t inBufTestA[8]={0x7FFFFFFF, 0x80000000, 0x73333333, 0x66666666,

0x19999999, 0x40000000, 0x7FFFFFFF, 0xB3333334};

_// 1, -1, 0.9, 0.8, 0.2, 0.5, 1, -0.6_

int32_t inBufTestB[8]={0x80000000, 0x7FFFFFFF, 0x40000000, 0x0CCCCCCC,

0x40000000, 0x60000000, 0x80000000, 0x20000000};

_// -1, 1, 0.5, 0.1, 0.75, 0.5, -1, 0.25_

DSP_VectorShift(inBufTestA, inBufTestB, Num, shiftValue);

_// inBufTestA = {0x00000000, 0x00000000, 0x00000000, 0x80000000,_

_// 0x7FFFFFFF, 0x40000000, 0x0CCCCCCC, 0x40000000} // shifted 3 positive_

C

void  DSP_VectorShift (int32_t * outdata , int32_t * indata , int  N , int  shift );