static void dct64_1(real *out0,real *out1,real *b1,real *b2,real *samples) { { register real *costab = pnts[0]; b1[0x00] = samples[0x00] + samples[0x1F]; b1[0x01] = samples[0x01] + samples[0x1E]; b1[0x1F] = REAL_MUL(samples[0x00] - samples[0x1F], costab[0x0]); b1[0x1E] = REAL_MUL(samples[0x01] - samples[0x1E], costab[0x1]); b1[0x02] = samples[0x02] + samples[0x1D]; b1[0x03] = samples[0x03] + samples[0x1C]; b1[0x1D] = REAL_MUL(samples[0x02] - samples[0x1D], costab[0x2]); b1[0x1C] = REAL_MUL(samples[0x03] - samples[0x1C], costab[0x3]); b1[0x04] = samples[0x04] + samples[0x1B]; b1[0x05] = samples[0x05] + samples[0x1A]; b1[0x1B] = REAL_MUL(samples[0x04] - samples[0x1B], costab[0x4]); b1[0x1A] = REAL_MUL(samples[0x05] - samples[0x1A], costab[0x5]); b1[0x06] = samples[0x06] + samples[0x19]; b1[0x07] = samples[0x07] + samples[0x18]; b1[0x19] = REAL_MUL(samples[0x06] - samples[0x19], costab[0x6]); b1[0x18] = REAL_MUL(samples[0x07] - samples[0x18], costab[0x7]); b1[0x08] = samples[0x08] + samples[0x17]; b1[0x09] = samples[0x09] + samples[0x16]; b1[0x17] = REAL_MUL(samples[0x08] - samples[0x17], costab[0x8]); b1[0x16] = REAL_MUL(samples[0x09] - samples[0x16], costab[0x9]); b1[0x0A] = samples[0x0A] + samples[0x15]; b1[0x0B] = samples[0x0B] + samples[0x14]; b1[0x15] = REAL_MUL(samples[0x0A] - samples[0x15], costab[0xA]); b1[0x14] = REAL_MUL(samples[0x0B] - samples[0x14], costab[0xB]); b1[0x0C] = samples[0x0C] + samples[0x13]; b1[0x0D] = samples[0x0D] + samples[0x12]; b1[0x13] = REAL_MUL(samples[0x0C] - samples[0x13], costab[0xC]); b1[0x12] = REAL_MUL(samples[0x0D] - samples[0x12], costab[0xD]); b1[0x0E] = samples[0x0E] + samples[0x11]; b1[0x0F] = samples[0x0F] + samples[0x10]; b1[0x11] = REAL_MUL(samples[0x0E] - samples[0x11], costab[0xE]); b1[0x10] = REAL_MUL(samples[0x0F] - samples[0x10], costab[0xF]); } { register real *costab = pnts[1]; b2[0x00] = b1[0x00] + b1[0x0F]; b2[0x01] = b1[0x01] + b1[0x0E]; b2[0x0F] = REAL_MUL(b1[0x00] - b1[0x0F], costab[0]); b2[0x0E] = REAL_MUL(b1[0x01] - b1[0x0E], costab[1]); b2[0x02] = b1[0x02] + b1[0x0D]; b2[0x03] = b1[0x03] + b1[0x0C]; b2[0x0D] = REAL_MUL(b1[0x02] - b1[0x0D], costab[2]); b2[0x0C] = REAL_MUL(b1[0x03] - b1[0x0C], costab[3]); b2[0x04] = b1[0x04] + b1[0x0B]; b2[0x05] = b1[0x05] + b1[0x0A]; b2[0x0B] = REAL_MUL(b1[0x04] - b1[0x0B], costab[4]); b2[0x0A] = REAL_MUL(b1[0x05] - b1[0x0A], costab[5]); b2[0x06] = b1[0x06] + b1[0x09]; b2[0x07] = b1[0x07] + b1[0x08]; b2[0x09] = REAL_MUL(b1[0x06] - b1[0x09], costab[6]); b2[0x08] = REAL_MUL(b1[0x07] - b1[0x08], costab[7]); /* */ b2[0x10] = b1[0x10] + b1[0x1F]; b2[0x11] = b1[0x11] + b1[0x1E]; b2[0x1F] = REAL_MUL(b1[0x1F] - b1[0x10], costab[0]); b2[0x1E] = REAL_MUL(b1[0x1E] - b1[0x11], costab[1]); b2[0x12] = b1[0x12] + b1[0x1D]; b2[0x13] = b1[0x13] + b1[0x1C]; b2[0x1D] = REAL_MUL(b1[0x1D] - b1[0x12], costab[2]); b2[0x1C] = REAL_MUL(b1[0x1C] - b1[0x13], costab[3]); b2[0x14] = b1[0x14] + b1[0x1B]; b2[0x15] = b1[0x15] + b1[0x1A]; b2[0x1B] = REAL_MUL(b1[0x1B] - b1[0x14], costab[4]); b2[0x1A] = REAL_MUL(b1[0x1A] - b1[0x15], costab[5]); b2[0x16] = b1[0x16] + b1[0x19]; b2[0x17] = b1[0x17] + b1[0x18]; b2[0x19] = REAL_MUL(b1[0x19] - b1[0x16], costab[6]); b2[0x18] = REAL_MUL(b1[0x18] - b1[0x17], costab[7]); } { register real *costab = pnts[2]; b1[0x00] = b2[0x00] + b2[0x07]; b1[0x07] = REAL_MUL(b2[0x00] - b2[0x07], costab[0]); b1[0x01] = b2[0x01] + b2[0x06]; b1[0x06] = REAL_MUL(b2[0x01] - b2[0x06], costab[1]); b1[0x02] = b2[0x02] + b2[0x05]; b1[0x05] = REAL_MUL(b2[0x02] - b2[0x05], costab[2]); b1[0x03] = b2[0x03] + b2[0x04]; b1[0x04] = REAL_MUL(b2[0x03] - b2[0x04], costab[3]); b1[0x08] = b2[0x08] + b2[0x0F]; b1[0x0F] = REAL_MUL(b2[0x0F] - b2[0x08], costab[0]); b1[0x09] = b2[0x09] + b2[0x0E]; b1[0x0E] = REAL_MUL(b2[0x0E] - b2[0x09], costab[1]); b1[0x0A] = b2[0x0A] + b2[0x0D]; b1[0x0D] = REAL_MUL(b2[0x0D] - b2[0x0A], costab[2]); b1[0x0B] = b2[0x0B] + b2[0x0C]; b1[0x0C] = REAL_MUL(b2[0x0C] - b2[0x0B], costab[3]); b1[0x10] = b2[0x10] + b2[0x17]; b1[0x17] = REAL_MUL(b2[0x10] - b2[0x17], costab[0]); b1[0x11] = b2[0x11] + b2[0x16]; b1[0x16] = REAL_MUL(b2[0x11] - b2[0x16], costab[1]); b1[0x12] = b2[0x12] + b2[0x15]; b1[0x15] = REAL_MUL(b2[0x12] - b2[0x15], costab[2]); b1[0x13] = b2[0x13] + b2[0x14]; b1[0x14] = REAL_MUL(b2[0x13] - b2[0x14], costab[3]); b1[0x18] = b2[0x18] + b2[0x1F]; b1[0x1F] = REAL_MUL(b2[0x1F] - b2[0x18], costab[0]); b1[0x19] = b2[0x19] + b2[0x1E]; b1[0x1E] = REAL_MUL(b2[0x1E] - b2[0x19], costab[1]); b1[0x1A] = b2[0x1A] + b2[0x1D]; b1[0x1D] = REAL_MUL(b2[0x1D] - b2[0x1A], costab[2]); b1[0x1B] = b2[0x1B] + b2[0x1C]; b1[0x1C] = REAL_MUL(b2[0x1C] - b2[0x1B], costab[3]); } { register real const cos0 = pnts[3][0]; register real const cos1 = pnts[3][1]; b2[0x00] = b1[0x00] + b1[0x03]; b2[0x03] = REAL_MUL(b1[0x00] - b1[0x03], cos0); b2[0x01] = b1[0x01] + b1[0x02]; b2[0x02] = REAL_MUL(b1[0x01] - b1[0x02], cos1); b2[0x04] = b1[0x04] + b1[0x07]; b2[0x07] = REAL_MUL(b1[0x07] - b1[0x04], cos0); b2[0x05] = b1[0x05] + b1[0x06]; b2[0x06] = REAL_MUL(b1[0x06] - b1[0x05], cos1); b2[0x08] = b1[0x08] + b1[0x0B]; b2[0x0B] = REAL_MUL(b1[0x08] - b1[0x0B], cos0); b2[0x09] = b1[0x09] + b1[0x0A]; b2[0x0A] = REAL_MUL(b1[0x09] - b1[0x0A], cos1); b2[0x0C] = b1[0x0C] + b1[0x0F]; b2[0x0F] = REAL_MUL(b1[0x0F] - b1[0x0C], cos0); b2[0x0D] = b1[0x0D] + b1[0x0E]; b2[0x0E] = REAL_MUL(b1[0x0E] - b1[0x0D], cos1); b2[0x10] = b1[0x10] + b1[0x13]; b2[0x13] = REAL_MUL(b1[0x10] - b1[0x13], cos0); b2[0x11] = b1[0x11] + b1[0x12]; b2[0x12] = REAL_MUL(b1[0x11] - b1[0x12], cos1); b2[0x14] = b1[0x14] + b1[0x17]; b2[0x17] = REAL_MUL(b1[0x17] - b1[0x14], cos0); b2[0x15] = b1[0x15] + b1[0x16]; b2[0x16] = REAL_MUL(b1[0x16] - b1[0x15], cos1); b2[0x18] = b1[0x18] + b1[0x1B]; b2[0x1B] = REAL_MUL(b1[0x18] - b1[0x1B], cos0); b2[0x19] = b1[0x19] + b1[0x1A]; b2[0x1A] = REAL_MUL(b1[0x19] - b1[0x1A], cos1); b2[0x1C] = b1[0x1C] + b1[0x1F]; b2[0x1F] = REAL_MUL(b1[0x1F] - b1[0x1C], cos0); b2[0x1D] = b1[0x1D] + b1[0x1E]; b2[0x1E] = REAL_MUL(b1[0x1E] - b1[0x1D], cos1); } { register real const cos0 = pnts[4][0]; b1[0x00] = b2[0x00] + b2[0x01]; b1[0x01] = REAL_MUL(b2[0x00] - b2[0x01], cos0); b1[0x02] = b2[0x02] + b2[0x03]; b1[0x03] = REAL_MUL(b2[0x03] - b2[0x02], cos0); b1[0x02] += b1[0x03]; b1[0x04] = b2[0x04] + b2[0x05]; b1[0x05] = REAL_MUL(b2[0x04] - b2[0x05], cos0); b1[0x06] = b2[0x06] + b2[0x07]; b1[0x07] = REAL_MUL(b2[0x07] - b2[0x06], cos0); b1[0x06] += b1[0x07]; b1[0x04] += b1[0x06]; b1[0x06] += b1[0x05]; b1[0x05] += b1[0x07]; b1[0x08] = b2[0x08] + b2[0x09]; b1[0x09] = REAL_MUL(b2[0x08] - b2[0x09], cos0); b1[0x0A] = b2[0x0A] + b2[0x0B]; b1[0x0B] = REAL_MUL(b2[0x0B] - b2[0x0A], cos0); b1[0x0A] += b1[0x0B]; b1[0x0C] = b2[0x0C] + b2[0x0D]; b1[0x0D] = REAL_MUL(b2[0x0C] - b2[0x0D], cos0); b1[0x0E] = b2[0x0E] + b2[0x0F]; b1[0x0F] = REAL_MUL(b2[0x0F] - b2[0x0E], cos0); b1[0x0E] += b1[0x0F]; b1[0x0C] += b1[0x0E]; b1[0x0E] += b1[0x0D]; b1[0x0D] += b1[0x0F]; b1[0x10] = b2[0x10] + b2[0x11]; b1[0x11] = REAL_MUL(b2[0x10] - b2[0x11], cos0); b1[0x12] = b2[0x12] + b2[0x13]; b1[0x13] = REAL_MUL(b2[0x13] - b2[0x12], cos0); b1[0x12] += b1[0x13]; b1[0x14] = b2[0x14] + b2[0x15]; b1[0x15] = REAL_MUL(b2[0x14] - b2[0x15], cos0); b1[0x16] = b2[0x16] + b2[0x17]; b1[0x17] = REAL_MUL(b2[0x17] - b2[0x16], cos0); b1[0x16] += b1[0x17]; b1[0x14] += b1[0x16]; b1[0x16] += b1[0x15]; b1[0x15] += b1[0x17]; b1[0x18] = b2[0x18] + b2[0x19]; b1[0x19] = REAL_MUL(b2[0x18] - b2[0x19], cos0); b1[0x1A] = b2[0x1A] + b2[0x1B]; b1[0x1B] = REAL_MUL(b2[0x1B] - b2[0x1A], cos0); b1[0x1A] += b1[0x1B]; b1[0x1C] = b2[0x1C] + b2[0x1D]; b1[0x1D] = REAL_MUL(b2[0x1C] - b2[0x1D], cos0); b1[0x1E] = b2[0x1E] + b2[0x1F]; b1[0x1F] = REAL_MUL(b2[0x1F] - b2[0x1E], cos0); b1[0x1E] += b1[0x1F]; b1[0x1C] += b1[0x1E]; b1[0x1E] += b1[0x1D]; b1[0x1D] += b1[0x1F]; } out0[0x10*16] = REAL_SCALE_DCT64(b1[0x00]); out0[0x10*12] = REAL_SCALE_DCT64(b1[0x04]); out0[0x10* 8] = REAL_SCALE_DCT64(b1[0x02]); out0[0x10* 4] = REAL_SCALE_DCT64(b1[0x06]); out0[0x10* 0] = REAL_SCALE_DCT64(b1[0x01]); out1[0x10* 0] = REAL_SCALE_DCT64(b1[0x01]); out1[0x10* 4] = REAL_SCALE_DCT64(b1[0x05]); out1[0x10* 8] = REAL_SCALE_DCT64(b1[0x03]); out1[0x10*12] = REAL_SCALE_DCT64(b1[0x07]); #if 1 out0[0x10*14] = REAL_SCALE_DCT64(b1[0x08] + b1[0x0C]); out0[0x10*10] = REAL_SCALE_DCT64(b1[0x0C] + b1[0x0a]); out0[0x10* 6] = REAL_SCALE_DCT64(b1[0x0A] + b1[0x0E]); out0[0x10* 2] = REAL_SCALE_DCT64(b1[0x0E] + b1[0x09]); out1[0x10* 2] = REAL_SCALE_DCT64(b1[0x09] + b1[0x0D]); out1[0x10* 6] = REAL_SCALE_DCT64(b1[0x0D] + b1[0x0B]); out1[0x10*10] = REAL_SCALE_DCT64(b1[0x0B] + b1[0x0F]); out1[0x10*14] = REAL_SCALE_DCT64(b1[0x0F]); #else b1[0x08] += b1[0x0C]; out0[0x10*14] = REAL_SCALE_DCT64(b1[0x08]); b1[0x0C] += b1[0x0a]; out0[0x10*10] = REAL_SCALE_DCT64(b1[0x0C]); b1[0x0A] += b1[0x0E]; out0[0x10* 6] = REAL_SCALE_DCT64(b1[0x0A]); b1[0x0E] += b1[0x09]; out0[0x10* 2] = REAL_SCALE_DCT64(b1[0x0E]); b1[0x09] += b1[0x0D]; out1[0x10* 2] = REAL_SCALE_DCT64(b1[0x09]); b1[0x0D] += b1[0x0B]; out1[0x10* 6] = REAL_SCALE_DCT64(b1[0x0D]); b1[0x0B] += b1[0x0F]; out1[0x10*10] = REAL_SCALE_DCT64(b1[0x0B]); out1[0x10*14] = REAL_SCALE_DCT64(b1[0x0F]); #endif { real tmp; tmp = b1[0x18] + b1[0x1C]; out0[0x10*15] = REAL_SCALE_DCT64(tmp + b1[0x10]); out0[0x10*13] = REAL_SCALE_DCT64(tmp + b1[0x14]); tmp = b1[0x1C] + b1[0x1A]; out0[0x10*11] = REAL_SCALE_DCT64(tmp + b1[0x14]); out0[0x10* 9] = REAL_SCALE_DCT64(tmp + b1[0x12]); tmp = b1[0x1A] + b1[0x1E]; out0[0x10* 7] = REAL_SCALE_DCT64(tmp + b1[0x12]); out0[0x10* 5] = REAL_SCALE_DCT64(tmp + b1[0x16]); tmp = b1[0x1E] + b1[0x19]; out0[0x10* 3] = REAL_SCALE_DCT64(tmp + b1[0x16]); out0[0x10* 1] = REAL_SCALE_DCT64(tmp + b1[0x11]); tmp = b1[0x19] + b1[0x1D]; out1[0x10* 1] = REAL_SCALE_DCT64(tmp + b1[0x11]); out1[0x10* 3] = REAL_SCALE_DCT64(tmp + b1[0x15]); tmp = b1[0x1D] + b1[0x1B]; out1[0x10* 5] = REAL_SCALE_DCT64(tmp + b1[0x15]); out1[0x10* 7] = REAL_SCALE_DCT64(tmp + b1[0x13]); tmp = b1[0x1B] + b1[0x1F]; out1[0x10* 9] = REAL_SCALE_DCT64(tmp + b1[0x13]); out1[0x10*11] = REAL_SCALE_DCT64(tmp + b1[0x17]); out1[0x10*13] = REAL_SCALE_DCT64(b1[0x17] + b1[0x1F]); out1[0x10*15] = REAL_SCALE_DCT64(b1[0x1F]); } }
void dct64(real *out0,real *out1,real *samples) { real bufs[64]; { register int i,j; register real *b1,*b2,*bs,*costab; b1 = samples; bs = bufs; costab = pnts[0]+16; b2 = b1 + 32; /* //C Code to run IDCT Core Hardware int count; unsigned int stat,idctfin; count=32; stat=idct_regs->flag_read_stat; stat=stat%4; if (stat==3 || stat==2 || stat==1){ while (count){ b2--; idct_regs->flag_send_data=*b2; count--; } } idct_regs->idct_write_reset; idctfin=1; while (idctfin){ idctfin=idct_regs->flag_idct_finished; idctfin=idctfin%4; }; count=32; while(count){ *bs=idct_regs->flag_read_data; count--; bs++;} } */ //Removed C code which is implemented in IDCT Core Hardware for(i=15;i>=0;i--) *bs++ = (*b1++ + *--b2); for(i=15;i>=0;i--) *bs++ = REAL_MUL((*--b2 - *b1++), *--costab); b1 = bufs; costab = pnts[1]+8; b2 = b1 + 16; { for(i=7;i>=0;i--) *bs++ = (*b1++ + *--b2); for(i=7;i>=0;i--) *bs++ = REAL_MUL((*--b2 - *b1++), *--costab); b2 += 32; costab += 8; for(i=7;i>=0;i--) *bs++ = (*b1++ + *--b2); for(i=7;i>=0;i--) *bs++ = REAL_MUL((*b1++ - *--b2), *--costab); b2 += 32; } bs = bufs; costab = pnts[2]; b2 = b1 + 8; for(j=2;j;j--) { for(i=3;i>=0;i--) *bs++ = (*b1++ + *--b2); for(i=3;i>=0;i--) *bs++ = REAL_MUL((*--b2 - *b1++), costab[i]); b2 += 16; for(i=3;i>=0;i--) *bs++ = (*b1++ + *--b2); for(i=3;i>=0;i--) *bs++ = REAL_MUL((*b1++ - *--b2), costab[i]); b2 += 16; } b1 = bufs; costab = pnts[3]; b2 = b1 + 4; for(j=4;j;j--) { *bs++ = (*b1++ + *--b2); *bs++ = (*b1++ + *--b2); *bs++ = REAL_MUL((*--b2 - *b1++), costab[1]); *bs++ = REAL_MUL((*--b2 - *b1++), costab[0]); b2 += 8; *bs++ = (*b1++ + *--b2); *bs++ = (*b1++ + *--b2); *bs++ = REAL_MUL((*b1++ - *--b2), costab[1]); *bs++ = REAL_MUL((*b1++ - *--b2), costab[0]); b2 += 8; } bs = bufs; costab = pnts[4]; for(j=8;j;j--) { real v0,v1; v0=*b1++; v1 = *b1++; *bs++ = (v0 + v1); *bs++ = REAL_MUL((v0 - v1), (*costab)); v0=*b1++; v1 = *b1++; *bs++ = (v0 + v1); *bs++ = REAL_MUL((v1 - v0), (*costab)); } } { register real *b1; register int i; for(b1=bufs,i=8;i;i--,b1+=4) b1[2] += b1[3]; for(b1=bufs,i=4;i;i--,b1+=8) { b1[4] += b1[6]; b1[6] += b1[5]; b1[5] += b1[7]; } for(b1=bufs,i=2;i;i--,b1+=16) { b1[8] += b1[12]; b1[12] += b1[10]; b1[10] += b1[14]; b1[14] += b1[9]; b1[9] += b1[13]; b1[13] += b1[11]; b1[11] += b1[15]; } } out0[0x10*16] = REAL_SCALE_DCT64(bufs[0]); out0[0x10*15] = REAL_SCALE_DCT64(bufs[16+0] + bufs[16+8]); out0[0x10*14] = REAL_SCALE_DCT64(bufs[8]); out0[0x10*13] = REAL_SCALE_DCT64(bufs[16+8] + bufs[16+4]); out0[0x10*12] = REAL_SCALE_DCT64(bufs[4]); out0[0x10*11] = REAL_SCALE_DCT64(bufs[16+4] + bufs[16+12]); out0[0x10*10] = REAL_SCALE_DCT64(bufs[12]); out0[0x10* 9] = REAL_SCALE_DCT64(bufs[16+12] + bufs[16+2]); out0[0x10* 8] = REAL_SCALE_DCT64(bufs[2]); out0[0x10* 7] = REAL_SCALE_DCT64(bufs[16+2] + bufs[16+10]); out0[0x10* 6] = REAL_SCALE_DCT64(bufs[10]); out0[0x10* 5] = REAL_SCALE_DCT64(bufs[16+10] + bufs[16+6]); out0[0x10* 4] = REAL_SCALE_DCT64(bufs[6]); out0[0x10* 3] = REAL_SCALE_DCT64(bufs[16+6] + bufs[16+14]); out0[0x10* 2] = REAL_SCALE_DCT64(bufs[14]); out0[0x10* 1] = REAL_SCALE_DCT64(bufs[16+14] + bufs[16+1]); out0[0x10* 0] = REAL_SCALE_DCT64(bufs[1]); out1[0x10* 0] = REAL_SCALE_DCT64(bufs[1]); out1[0x10* 1] = REAL_SCALE_DCT64(bufs[16+1] + bufs[16+9]); out1[0x10* 2] = REAL_SCALE_DCT64(bufs[9]); out1[0x10* 3] = REAL_SCALE_DCT64(bufs[16+9] + bufs[16+5]); out1[0x10* 4] = REAL_SCALE_DCT64(bufs[5]); out1[0x10* 5] = REAL_SCALE_DCT64(bufs[16+5] + bufs[16+13]); out1[0x10* 6] = REAL_SCALE_DCT64(bufs[13]); out1[0x10* 7] = REAL_SCALE_DCT64(bufs[16+13] + bufs[16+3]); out1[0x10* 8] = REAL_SCALE_DCT64(bufs[3]); out1[0x10* 9] = REAL_SCALE_DCT64(bufs[16+3] + bufs[16+11]); out1[0x10*10] = REAL_SCALE_DCT64(bufs[11]); out1[0x10*11] = REAL_SCALE_DCT64(bufs[16+11] + bufs[16+7]); out1[0x10*12] = REAL_SCALE_DCT64(bufs[7]); out1[0x10*13] = REAL_SCALE_DCT64(bufs[16+7] + bufs[16+15]); out1[0x10*14] = REAL_SCALE_DCT64(bufs[15]); out1[0x10*15] = REAL_SCALE_DCT64(bufs[16+15]); }