The pixel data comes as a stream of bytes, stored in a raw buffer
unsigned char rawBuf1[100], rawBuf2[100];
Depending on the endianness of your platform, you might try bit fields and let the compiler figure out, how to access the pixels
struct pixels0 {
unsigned long long p0 : 10;
unsigned long long p1 : 10;
unsigned long long p2 : 10;
unsigned long long p3 : 10;
unsigned long long p4 : 10;
unsigned long long p5 : 10;
};
struct pixels6 {
unsigned long long pad : 4;
unsigned long long p6 : 10;
unsigned long long p7 : 10;
};
You would use this as
unsigned short p0 = ((struct pixels0*)&rawBuf1[0])->p0 + ((struct pixels0*)&rawBuf2[0])->p0;
/* ... */
unsigned short p5 = ((struct pixels0*)&rawBuf1[0])->p5 + ((struct pixels0*)&rawBuf2[0])->p5;
unsigned short p6 = ((struct pixels6*)&rawBuf1[7])->p6 + ((struct pixels6*)&rawBuf2[7])->p6;
unsigned short p7 = ((struct pixels6*)&rawBuf1[7])->p7 + ((struct pixels6*)&rawBuf2[7])->p;
But be aware, that this is highly platform and compiler dependent, if it works at all.