Hi,
I'm doing some video processing and need to copy 3d array of bytes to 1d array of bytes where:
3d array is [width, height, layers] and
1d array is [width * height * layers]
Now i have:
I need something faster.
I tried with Marshal.Copy() and unsafe, fixed pointers but without success.
I'm doing some video processing and need to copy 3d array of bytes to 1d array of bytes where:
3d array is [width, height, layers] and
1d array is [width * height * layers]
Now i have:
Code:
int index = -1;
for (int j = 0; j < h; ++j)
for (int i = 0; i < w; ++i)
{
data1D[++index] = data3D[j, i, 0];
data1D[++index] = data3D[j, i, 1];
data1D[++index] = data3D[j, i, 2];
data1D[++index] = 255;
}
I need something faster.
I tried with Marshal.Copy() and unsafe, fixed pointers but without success.
Comment