#include "stdio.h"
int main (void)
{
int i;
uint8x8x3_t v; // This represents 3 vectors.
// Each vector has eight lanes of 8-bit data.
unsigned char A[24]={1,1,1,
2,1,1,3,1,1,
4,1,1,
5,1,1,
6,1,1,
7,1,1,
8,1,1}; // This array represents a 24-bit RGB image.
//Double the red channel
v.val[0] = vadd_u8(v.val[0],v.val[0]);
vst3_u8(A, v); // store the vector back into the array, with the red channel doubled.
for(i=0;i<24;i++)
printf("%d ",A[i]);
printf("\n");
return 0;
}~ 结果: 2 1 1
4 1 1
6 1 1
8 1 1
10 1 1
12 1 1
14 1 1
16 1 1
~
#include <arm_neon.h>
#include "stdio.h"
int main (void)
{
int i;
uint16x4x3_t v; // This represents 3 vectors.
// Each vector has eight lanes of 8-bit data.
unsigned short A[12]={1,1,1,
1,1,1,
1,1,1,
1,1,1
}; // This array represents a 24-bit RGB image.
v = vld3_u16(A); // This de-interleaves the 24-bit image from array A
//Double the red channel
v.val[0] = vadd_u16(v.val[0],v.val[0]);
vst3_u16(A, v); // store the vector back into the array, with the red channel doubled.
for(i=0;i<12;i++)
printf("%d ",A[i]);
printf("\n");
return 0;
}
结果: 2 1 1 2 1 1 2 1 1 2 1 1