#include"auxFormat.h" void packU32FormatToThreePacket(u32 *out, u8 *in) { u32 t0 = U32BIG(((u32* )in)[0]); puckU32ToThree_3(t0); out[0] = ((((t0 & 0x30000000) >> 20) | ((t0 & 0xff0000) >> 16))); out[1] = (((t0 & 0x80000000) >> 21) | ((t0 & 0xc000000) >> 18) | ((t0 & 0xff00) >> 8)); out[2] = (((t0 & 0x40000000) >> 20) | ((t0 & 0x03000000) >> 16) | (t0 & 0x000000ff)); } void unpackU32FormatToThreePacket(u8 *out, u32 *in) { u32 t[3] = { 0 };\ u32 t0 = in[0], t1 = in[1], t2 = in[2]; t[0] = ((t1 & 0x400) << 21) | ((t2 & 0x400) << 20) | ((t0 & 0x300) << 20) | ((t1 & 0x300) << 18) | ((t2 & 0x300) << 16) | ((t0 & 0xff) << 16) | ((t1 & 0xff) << 8) | (t2 & 0xff); unpuckU32ToThree_3(t[0]); *(u32*) (out) = t[0]; } void packU96FormatToThreePacket(u32 *out, u8 *in) { u32 t0 = U32BIG(((u32* )in)[0]), t1 = U32BIG(((u32* )in)[1]), t2 = U32BIG( ((u32* )in)[2]); puckU32ToThree_3(t0); puckU32ToThree_3(t1); puckU32ToThree_3(t2); out[0] = (((t2 & 0x80000000)) | ((t2 & 0xc000000) << 3) | ((t2 & 0xff00) << 13)) | (((t1 & 0x40000000) >> 10) | ((t1 & 0x03000000) >> 6) | ((t1 & 0x000000ff) << 10)) | ((((t0 & 0x30000000) >> 20) | ((t0 & 0xff0000) >> 16))); out[1] = (((t2 & 0x40000000) << 1) | ((t2 & 0x03000000) << 5) | ((t2 & 0x000000ff) << 21)) | ((((t1 & 0x30000000) >> 9) | ((t1 & 0xff0000) >> 5)) | (((t0 & 0x80000000) >> 21) | ((t0 & 0xc000000) >> 18) | ((t0 & 0xff00) >> 8))); out[2] = ((((t2 & 0x30000000) << 2) | ((t2 & 0xff0000) << 6)) | (((t1 & 0x80000000) >> 10) | ((t1 & 0xc000000) >> 7) | ((t1 & 0xff00) << 3)) | (((t0 & 0x40000000) >> 20) | ((t0 & 0x03000000) >> 16) | (t0 & 0x000000ff))); } void unpackU96FormatToThreePacket(u8 *out, u32 *in) { u32 t[3] = { 0 };\ u32 t0 = in[0], t1 = in[1], t2 = in[2]; t[0] = ((t1 & 0x400) << 21) | ((t2 & 0x400) << 20) | ((t0 & 0x300) << 20) | ((t1 & 0x300) << 18) | ((t2 & 0x300) << 16) | ((t0 & 0xff) << 16) | ((t1 & 0xff) << 8) | (t2 & 0xff); t[1] = ((t2 & 0x200000) << 10) | ((t0 & 0x100000) << 10) | ((t1 & 0x180000) << 9) | ((t2 & 0x180000) << 7) | ((t0 & 0xc0000) << 6) | ((t1 & 0x7f800) << 5) | ((t2 & 0x7f800) >> 3) | ((t0 & 0x3fc00) >> 10); t[2] = ((t0 & 0x80000000)) | ((t1 & 0x80000000) >> 1) | ((t2 & 0xc0000000) >> 2) | ((t0 & 0x60000000) >> 3) | ((t1 & 0x60000000) >> 5) | ((t2 & 0x3fc00000) >> 6) | ((t0 & 0x1fe00000) >> 13) | ((t1 & 0x1fe00000) >> 21); unpuckU32ToThree_3(t[0]); unpuckU32ToThree_3(t[1]); unpuckU32ToThree_3(t[2]); memcpy(out, t, 12 * sizeof(unsigned char)); } void ROUND384_Three(unsigned int *s, unsigned char *c, int lunnum) { unsigned int t, t1, t2; u32 rci; rci = c[0]; ROUND384_1(rci); t = 1; while (lunnum--) { rci = c[t]; ROUND384_2(rci); t++; rci = c[t]; ROUND384_3(rci); t++; rci = c[t]; ROUND384_4(rci); t++; } } unsigned char constant7Format[80] = { /*constant7Format[127]: 12*6=72*/ 0x01, 0x08, 0x40, 0x02, 0x10, 0x80, 0x05, 0x09, 0x48, 0x42, 0x12, 0x90, 0x85, 0x0c, 0x41, 0x0a, 0x50, 0x82, 0x15, 0x89, 0x4d, 0x4b, 0x5a, 0xd2, 0x97, 0x9c, 0xc4, 0x06, 0x11, 0x88, 0x45, 0x0b, 0x58, 0xc2, 0x17, 0x99, 0xcd, 0x4e, 0x53, 0x9a, 0xd5, 0x8e, 0x54, 0x83, 0x1d, 0xc9, 0x4f, 0x5b, 0xda, 0xd7, 0x9e, 0xd4, 0x86, 0x14, 0x81, 0x0d, 0x49, 0x4a, 0x52, 0x92, 0x95, 0x8c, 0x44, 0x03, 0x18, 0xc0, 0x07, 0x19, 0xc8, 0x47, 0x1b, 0xd8, 0xc7, 0x1e, 0xd1, 0x8f, 0x5c, 0xc3, 0x1f, 0xd9, };