$NetBSD: patch-ai,v 1.1 1999/10/12 04:43:14 simonb Exp $ --- layer3.c.orig Thu Apr 22 01:25:18 1999 +++ layer3.c Mon Aug 16 02:02:01 1999 @@ -109,54 +109,54 @@ int i,j,k,l; for(i=-256;i<118+4;i++) - gainpow2[i+256] = pow((double)2.0,-0.25 * (double) (i+210) ); + gainpow2[i+256] = DOUBLE_TO_REAL(pow((double)2.0,-0.25 * (double) (i+210) )); for(i=0;i<8207;i++) - ispow[i] = pow((double)i,(double)4.0/3.0); + ispow[i] = DOUBLE_TO_REAL(pow((double)i,(double)4.0/3.0)); for (i=0;i<8;i++) { static double Ci[8]={-0.6,-0.535,-0.33,-0.185,-0.095,-0.041,-0.0142,-0.0037}; double sq=sqrt(1.0+Ci[i]*Ci[i]); - aa_cs[i] = 1.0/sq; - aa_ca[i] = Ci[i]/sq; + aa_cs[i] = DOUBLE_TO_REAL(1.0/sq); + aa_ca[i] = DOUBLE_TO_REAL(Ci[i]/sq); } for(i=0;i<18;i++) { - win[0][i] = win[1][i] = 0.5 * sin( M_PI / 72.0 * (double) (2*(i+0) +1) ) / cos ( M_PI * (double) (2*(i+0) +19) / 72.0 ); - win[0][i+18] = win[3][i+18] = 0.5 * sin( M_PI / 72.0 * (double) (2*(i+18)+1) ) / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 ); + win[0][i] = win[1][i] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 72.0 * (double) (2*(i+0) +1) ) / cos ( M_PI * (double) (2*(i+0) +19) / 72.0 )); + win[0][i+18] = win[3][i+18] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 72.0 * (double) (2*(i+18)+1) ) / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 )); } for(i=0;i<6;i++) { - win[1][i+18] = 0.5 / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 ); - win[3][i+12] = 0.5 / cos ( M_PI * (double) (2*(i+12)+19) / 72.0 ); - win[1][i+24] = 0.5 * sin( M_PI / 24.0 * (double) (2*i+13) ) / cos ( M_PI * (double) (2*(i+24)+19) / 72.0 ); - win[1][i+30] = win[3][i] = 0.0; - win[3][i+6 ] = 0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*(i+6 )+19) / 72.0 ); + win[1][i+18] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 )); + win[3][i+12] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (2*(i+12)+19) / 72.0 )); + win[1][i+24] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 24.0 * (double) (2*i+13) ) / cos ( M_PI * (double) (2*(i+24)+19) / 72.0 )); + win[1][i+30] = win[3][i] = DOUBLE_TO_REAL(0.0); + win[3][i+6 ] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*(i+6 )+19) / 72.0 )); } for(i=0;i<9;i++) - COS9[i] = cos( M_PI / 18.0 * (double) i); + COS9[i] = DOUBLE_TO_REAL(cos( M_PI / 18.0 * (double) i)); for(i=0;i<9;i++) - tfcos36[i] = 0.5 / cos ( M_PI * (double) (i*2+1) / 36.0 ); + tfcos36[i] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (i*2+1) / 36.0 )); for(i=0;i<3;i++) - tfcos12[i] = 0.5 / cos ( M_PI * (double) (i*2+1) / 12.0 ); + tfcos12[i] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (i*2+1) / 12.0 )); - COS6_1 = cos( M_PI / 6.0 * (double) 1); - COS6_2 = cos( M_PI / 6.0 * (double) 2); + COS6_1 = DOUBLE_TO_REAL(cos( M_PI / 6.0 * (double) 1)); + COS6_2 = DOUBLE_TO_REAL(cos( M_PI / 6.0 * (double) 2)); #ifdef NEW_DCT9 - cos9[0] = cos(1.0*M_PI/9.0); - cos9[1] = cos(5.0*M_PI/9.0); - cos9[2] = cos(7.0*M_PI/9.0); - cos18[0] = cos(1.0*M_PI/18.0); - cos18[1] = cos(11.0*M_PI/18.0); - cos18[2] = cos(13.0*M_PI/18.0); + cos9[0] = DOUBLE_TO_REAL(cos(1.0*M_PI/9.0)); + cos9[1] = DOUBLE_TO_REAL(cos(5.0*M_PI/9.0)); + cos9[2] = DOUBLE_TO_REAL(cos(7.0*M_PI/9.0)); + cos18[0] = DOUBLE_TO_REAL(cos(1.0*M_PI/18.0)); + cos18[1] = DOUBLE_TO_REAL(cos(11.0*M_PI/18.0)); + cos18[2] = DOUBLE_TO_REAL(cos(13.0*M_PI/18.0)); #endif for(i=0;i<12;i++) { - win[2][i] = 0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*i+7) / 24.0 ); + win[2][i] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*i+7) / 24.0 )); for(j=0;j<6;j++) - COS1[i][j] = cos( M_PI / 24.0 * (double) ((2*i+7)*(2*j+1)) ); + COS1[i][j] = DOUBLE_TO_REAL(cos( M_PI / 24.0 * (double) ((2*i+7)*(2*j+1)) )); } for(j=0;j<4;j++) { @@ -169,10 +169,10 @@ for(i=0;i<16;i++) { double t = tan( (double) i * M_PI / 12.0 ); - tan1_1[i] = t / (1.0+t); - tan2_1[i] = 1.0 / (1.0 + t); - tan1_2[i] = M_SQRT2 * t / (1.0+t); - tan2_2[i] = M_SQRT2 / (1.0 + t); + tan1_1[i] = DOUBLE_TO_REAL(t / (1.0+t)); + tan2_1[i] = DOUBLE_TO_REAL(1.0 / (1.0 + t)); + tan1_2[i] = DOUBLE_TO_REAL(M_SQRT2 * t / (1.0+t)); + tan2_2[i] = DOUBLE_TO_REAL(M_SQRT2 / (1.0 + t)); for(j=0;j<2;j++) { double base = pow(2.0,-0.25*(j+1.0)); @@ -183,10 +183,10 @@ else p2 = pow(base,i*0.5); } - pow1_1[j][i] = p1; - pow2_1[j][i] = p2; - pow1_2[j][i] = M_SQRT2 * p1; - pow2_2[j][i] = M_SQRT2 * p2; + pow1_1[j][i] = DOUBLE_TO_REAL(p1); + pow2_1[j][i] = DOUBLE_TO_REAL(p2); + pow1_2[j][i] = DOUBLE_TO_REAL(M_SQRT2 * p1); + pow2_2[j][i] = DOUBLE_TO_REAL(M_SQRT2 * p2); } } @@ -713,22 +713,22 @@ num -= h->linbits+1; mask <<= h->linbits; if(mask < 0) - *xrpnt = -ispow[x] * v; + *xrpnt = REAL_MUL(-ispow[x], v); else - *xrpnt = ispow[x] * v; + *xrpnt = REAL_MUL(ispow[x], v); mask <<= 1; } else if(x) { max[lwin] = cb; if(mask < 0) - *xrpnt = -ispow[x] * v; + *xrpnt = REAL_MUL(-ispow[x], v); else - *xrpnt = ispow[x] * v; + *xrpnt = REAL_MUL(ispow[x], v); num--; mask <<= 1; } else - *xrpnt = 0.0; + *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += step; if(y == 15 && h->linbits) { max[lwin] = cb; @@ -737,22 +737,22 @@ num -= h->linbits+1; mask <<= h->linbits; if(mask < 0) - *xrpnt = -ispow[y] * v; + *xrpnt = REAL_MUL(-ispow[y], v); else - *xrpnt = ispow[y] * v; + *xrpnt = REAL_MUL(ispow[y], v); mask <<= 1; } else if(y) { max[lwin] = cb; if(mask < 0) - *xrpnt = -ispow[y] * v; + *xrpnt = REAL_MUL(-ispow[y], v); else - *xrpnt = ispow[y] * v; + *xrpnt = REAL_MUL(ispow[y], v); num--; mask <<= 1; } else - *xrpnt = 0.0; + *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += step; } } @@ -804,7 +804,7 @@ mask <<= 1; } else - *xrpnt = 0.0; + *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += step; } } @@ -812,8 +812,8 @@ if(lwin < 3) { /* short band? */ while(1) { for(;mc > 0;mc--) { - *xrpnt = 0.0; xrpnt += 3; /* short band -> step=3 */ - *xrpnt = 0.0; xrpnt += 3; + *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += 3; /* short band -> step=3 */ + *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += 3; } if(m >= me) break; @@ -887,22 +887,22 @@ num -= h->linbits+1; mask <<= h->linbits; if(mask < 0) - *xrpnt++ = -ispow[x] * v; + *xrpnt++ = REAL_MUL(-ispow[x], v); else - *xrpnt++ = ispow[x] * v; + *xrpnt++ = REAL_MUL(ispow[x], v); mask <<= 1; } else if(x) { max = cb; if(mask < 0) - *xrpnt++ = -ispow[x] * v; + *xrpnt++ = REAL_MUL(-ispow[x], v); else - *xrpnt++ = ispow[x] * v; + *xrpnt++ = REAL_MUL(ispow[x], v); num--; mask <<= 1; } else - *xrpnt++ = 0.0; + *xrpnt++ = DOUBLE_TO_REAL(0.0); if (y == 15 && h->linbits) { max = cb; @@ -911,22 +911,22 @@ num -= h->linbits+1; mask <<= h->linbits; if(mask < 0) - *xrpnt++ = -ispow[y] * v; + *xrpnt++ = REAL_MUL(-ispow[y], v); else - *xrpnt++ = ispow[y] * v; + *xrpnt++ = REAL_MUL(ispow[y], v); mask <<= 1; } else if(y) { max = cb; if(mask < 0) - *xrpnt++ = -ispow[y] * v; + *xrpnt++ = REAL_MUL(-ispow[y], v); else - *xrpnt++ = ispow[y] * v; + *xrpnt++ = REAL_MUL(ispow[y], v); num--; mask <<= 1; } else - *xrpnt++ = 0.0; + *xrpnt++ = DOUBLE_TO_REAL(0.0); } } @@ -974,7 +974,7 @@ mask <<= 1; } else - *xrpnt++ = 0.0; + *xrpnt++ = DOUBLE_TO_REAL(0.0); } } @@ -987,7 +987,7 @@ num = 0; while(xrpnt < &xr[SBLIMIT][0]) - *xrpnt++ = 0.0; + *xrpnt++ = DOUBLE_TO_REAL(0.0); while( part2remain > 16 ) { getbits(16); /* Dismiss stuffing Bits */ @@ -1065,8 +1065,8 @@ t1 = tab1[is_p]; t2 = tab2[is_p]; for (; sb > 0; sb--,idx+=3) { real v = xr[0][idx]; - xr[0][idx] = v * t1; - xr[1][idx] = v * t2; + xr[0][idx] = REAL_MUL(v, t1); + xr[1][idx] = REAL_MUL(v, t2); } } } @@ -1087,8 +1087,8 @@ t1 = tab1[is_p]; t2 = tab2[is_p]; for ( ; sb > 0; sb--,idx+=3 ) { real v = xr[0][idx]; - xr[0][idx] = v * t1; - xr[1][idx] = v * t2; + xr[0][idx] = REAL_MUL(v, t1); + xr[1][idx] = REAL_MUL(v, t2); } } } /* end for(lwin; .. ; . ) */ @@ -1108,8 +1108,8 @@ t1 = tab1[is_p]; t2 = tab2[is_p]; for ( ; sb > 0; sb--,idx++) { real v = xr[0][idx]; - xr[0][idx] = v * t1; - xr[1][idx] = v * t2; + xr[0][idx] = REAL_MUL(v, t1); + xr[1][idx] = REAL_MUL(v, t2); } } else @@ -1128,8 +1128,8 @@ t1 = tab1[is_p]; t2 = tab2[is_p]; for ( ; sb > 0; sb--,idx++) { real v = xr[0][idx]; - xr[0][idx] = v * t1; - xr[1][idx] = v * t2; + xr[0][idx] = REAL_MUL(v, t1); + xr[1][idx] = REAL_MUL(v, t2); } } else @@ -1143,8 +1143,8 @@ for ( sb = bi->longDiff[21]; sb > 0; sb--,idx++ ) { real v = xr[0][idx]; - xr[0][idx] = v * t1; - xr[1][idx] = v * t2; + xr[0][idx] = REAL_MUL(v, t1); + xr[1][idx] = REAL_MUL(v, t2); } } } /* ... */ @@ -1177,8 +1177,8 @@ for(ss=7;ss>=0;ss--) { /* upper and lower butterfly inputs */ register real bu = *--xr2,bd = *xr1; - *xr2 = (bu * (*cs) ) - (bd * (*ca) ); - *xr1++ = (bd * (*cs++) ) + (bu * (*ca++) ); + *xr2 = REAL_MUL(bu, *cs) - REAL_MUL(bd, *ca); + *xr1++ = REAL_MUL(bd, *cs++) + REAL_MUL(bu, *ca++); } } } @@ -1252,8 +1252,8 @@ { real t0, t1, t2; - t0 = COS6_2 * (in[8] + in[16] - in[4]); - t1 = COS6_2 * in[12]; + t0 = REAL_MUL(COS6_2, (in[8] + in[16] - in[4])); + t1 = REAL_MUL(COS6_2, in[12]); t3 = in[0]; t2 = t3 - t1 - t1; @@ -1261,16 +1261,16 @@ tmp[4] = t2 + t0 + t0; t3 += t1; - t2 = COS6_1 * (in[10] + in[14] - in[2]); + t2 = REAL_MUL(COS6_1, (in[10] + in[14] - in[2])); tmp[1] -= t2; tmp[7] += t2; } { real t0, t1, t2; - t0 = cos9[0] * (in[4] + in[8] ); - t1 = cos9[1] * (in[8] - in[16]); - t2 = cos9[2] * (in[4] + in[16]); + t0 = REAL_MUL(cos9[0], (in[4] + in[8] )); + t1 = REAL_MUL(cos9[1], (in[8] - in[16])); + t2 = REAL_MUL(cos9[2], (in[4] + in[16])); tmp[2] = tmp[6] = t3 - t0 - t2; tmp[0] = tmp[8] = t3 + t0 + t1; @@ -1280,9 +1280,9 @@ { real t1, t2, t3; - t1 = cos18[0] * (in[2] + in[10]); - t2 = cos18[1] * (in[10] - in[14]); - t3 = COS6_1 * in[6]; + t1 = REAL_MUL(cos18[0], (in[2] + in[10])); + t2 = REAL_MUL(cos18[1], (in[10] - in[14])); + t3 = REAL_MUL(COS6_1, in[6]); { real t0 = t1 + t2 + t3; @@ -1293,7 +1293,7 @@ t2 -= t3; t1 -= t3; - t3 = cos18[2] * (in[2] + in[14]); + t3 = REAL_MUL(cos18[2], (in[2] + in[14])); t1 += t3; tmp[3] += t1; @@ -1308,35 +1308,35 @@ { real t0, t1, t2, t3, t4, t5, t6, t7; - t1 = COS6_2 * in[12]; - t2 = COS6_2 * (in[8] + in[16] - in[4]); + t1 = REAL_MUL(COS6_2, in[12]); + t2 = REAL_MUL(COS6_2, (in[8] + in[16] - in[4])); t3 = in[0] + t1; t4 = in[0] - t1 - t1; t5 = t4 - t2; tmp[4] = t4 + t2 + t2; - t0 = cos9[0] * (in[4] + in[8]); - t1 = cos9[1] * (in[8] - in[16]); + t0 = REAL_MUL(cos9[0], (in[4] + in[8])); + t1 = REAL_MUL(cos9[1], (in[8] - in[16])); - t2 = cos9[2] * (in[4] + in[16]); + t2 = REAL_MUL(cos9[2], (in[4] + in[16])); t6 = t3 - t0 - t2; t0 += t3 + t1; t3 += t2 - t1; - t2 = cos18[0] * (in[2] + in[10]); - t4 = cos18[1] * (in[10] - in[14]); - t7 = COS6_1 * in[6]; + t2 = REAL_MUL(cos18[0], (in[2] + in[10])); + t4 = REAL_MUL(cos18[1], (in[10] - in[14])); + t7 = REAL_MUL(COS6_1, in[6]); t1 = t2 + t4 + t7; tmp[0] = t0 + t1; tmp[8] = t0 - t1; - t1 = cos18[2] * (in[2] + in[14]); + t1 = REAL_MUL(cos18[2], (in[2] + in[14])); t2 += t1 - t7; tmp[3] = t3 + t2; - t0 = COS6_1 * (in[10] + in[14] - in[2]); + t0 = REAL_MUL(COS6_1, (in[10] + in[14] - in[2])); tmp[5] = t3 - t2; t4 -= t1 + t7; @@ -1351,53 +1351,53 @@ { real t0, t1, t2, t3, t4, t5, t6, t7; - t1 = COS6_2 * in[13]; - t2 = COS6_2 * (in[9] + in[17] - in[5]); + t1 = REAL_MUL(COS6_2, in[13]); + t2 = REAL_MUL(COS6_2, (in[9] + in[17] - in[5])); t3 = in[1] + t1; t4 = in[1] - t1 - t1; t5 = t4 - t2; - t0 = cos9[0] * (in[5] + in[9]); - t1 = cos9[1] * (in[9] - in[17]); + t0 = REAL_MUL(cos9[0], (in[5] + in[9])); + t1 = REAL_MUL(cos9[1], (in[9] - in[17])); - tmp[13] = (t4 + t2 + t2) * tfcos36[17-13]; - t2 = cos9[2] * (in[5] + in[17]); + tmp[13] = REAL_MUL((t4 + t2 + t2), tfcos36[17-13]); + t2 = REAL_MUL(cos9[2], (in[5] + in[17])); t6 = t3 - t0 - t2; t0 += t3 + t1; t3 += t2 - t1; - t2 = cos18[0] * (in[3] + in[11]); - t4 = cos18[1] * (in[11] - in[15]); - t7 = COS6_1 * in[7]; + t2 = REAL_MUL(cos18[0], (in[3] + in[11])); + t4 = REAL_MUL(cos18[1], (in[11] - in[15])); + t7 = REAL_MUL(COS6_1, in[7]); t1 = t2 + t4 + t7; - tmp[17] = (t0 + t1) * tfcos36[17-17]; - tmp[9] = (t0 - t1) * tfcos36[17-9]; - t1 = cos18[2] * (in[3] + in[15]); + tmp[17] = REAL_MUL((t0 + t1), tfcos36[17-17]); + tmp[9] = REAL_MUL((t0 - t1), tfcos36[17-9]); + t1 = REAL_MUL(cos18[2], (in[3] + in[15])); t2 += t1 - t7; - tmp[14] = (t3 + t2) * tfcos36[17-14]; - t0 = COS6_1 * (in[11] + in[15] - in[3]); - tmp[12] = (t3 - t2) * tfcos36[17-12]; + tmp[14] = REAL_MUL((t3 + t2), tfcos36[17-14]); + t0 = REAL_MUL(COS6_1, (in[11] + in[15] - in[3])); + tmp[12] = REAL_MUL((t3 - t2), tfcos36[17-12]); t4 -= t1 + t7; - tmp[16] = (t5 - t0) * tfcos36[17-16]; - tmp[10] = (t5 + t0) * tfcos36[17-10]; - tmp[15] = (t6 + t4) * tfcos36[17-15]; - tmp[11] = (t6 - t4) * tfcos36[17-11]; + tmp[16] = REAL_MUL((t5 - t0), tfcos36[17-16]); + tmp[10] = REAL_MUL((t5 + t0), tfcos36[17-10]); + tmp[15] = REAL_MUL((t6 + t4), tfcos36[17-15]); + tmp[11] = REAL_MUL((t6 - t4), tfcos36[17-11]); } #define MACRO(v) { \ real tmpval; \ tmpval = tmp[(v)] + tmp[17-(v)]; \ - out2[9+(v)] = tmpval * w[27+(v)]; \ - out2[8-(v)] = tmpval * w[26-(v)]; \ + out2[9+(v)] = REAL_MUL(tmpval, w[27+(v)]); \ + out2[8-(v)] = REAL_MUL(tmpval, w[26-(v)]); \ tmpval = tmp[(v)] - tmp[17-(v)]; \ - ts[SBLIMIT*(8-(v))] = out1[8-(v)] + tmpval * w[8-(v)]; \ - ts[SBLIMIT*(9+(v))] = out1[9+(v)] + tmpval * w[9+(v)]; } + ts[SBLIMIT*(8-(v))] = out1[8-(v)] + REAL_MUL(tmpval, w[8-(v)]); \ + ts[SBLIMIT*(9+(v))] = out1[9+(v)] + REAL_MUL(tmpval, w[9+(v)]); } { register real *out2 = o2; @@ -1422,20 +1422,20 @@ #define MACRO0(v) { \ real tmp; \ - out2[9+(v)] = (tmp = sum0 + sum1) * w[27+(v)]; \ - out2[8-(v)] = tmp * w[26-(v)]; } \ + out2[9+(v)] = REAL_MUL((tmp = sum0 + sum1), w[27+(v)]); \ + out2[8-(v)] = REAL_MUL(tmp, w[26-(v)]); } \ sum0 -= sum1; \ - ts[SBLIMIT*(8-(v))] = out1[8-(v)] + sum0 * w[8-(v)]; \ - ts[SBLIMIT*(9+(v))] = out1[9+(v)] + sum0 * w[9+(v)]; + ts[SBLIMIT*(8-(v))] = out1[8-(v)] + REAL_MUL(sum0, w[8-(v)]); \ + ts[SBLIMIT*(9+(v))] = out1[9+(v)] + REAL_MUL(sum0, w[9+(v)]); #define MACRO1(v) { \ real sum0,sum1; \ sum0 = tmp1a + tmp2a; \ - sum1 = (tmp1b + tmp2b) * tfcos36[(v)]; \ + sum1 = REAL_MUL((tmp1b + tmp2b), tfcos36[(v)]); \ MACRO0(v); } #define MACRO2(v) { \ real sum0,sum1; \ sum0 = tmp2a - tmp1a; \ - sum1 = (tmp2b - tmp1b) * tfcos36[(v)]; \ + sum1 = REAL_MUL((tmp2b - tmp1b), tfcos36[(v)]); \ MACRO0(v); } register const real *c = COS9; @@ -1446,17 +1446,17 @@ real ta33,ta66,tb33,tb66; - ta33 = in[2*3+0] * c[3]; - ta66 = in[2*6+0] * c[6] + in[2*0+0]; - tb33 = in[2*3+1] * c[3]; - tb66 = in[2*6+1] * c[6] + in[2*0+1]; + ta33 = REAL_MUL(in[2*3+0], c[3]); + ta66 = REAL_MUL(in[2*6+0], c[6]); + tb33 = REAL_MUL(in[2*3+1], c[3]); + tb66 = REAL_MUL(in[2*6+1], c[6]); { real tmp1a,tmp2a,tmp1b,tmp2b; - tmp1a = in[2*1+0] * c[1] + ta33 + in[2*5+0] * c[5] + in[2*7+0] * c[7]; - tmp1b = in[2*1+1] * c[1] + tb33 + in[2*5+1] * c[5] + in[2*7+1] * c[7]; - tmp2a = in[2*2+0] * c[2] + in[2*4+0] * c[4] + ta66 + in[2*8+0] * c[8]; - tmp2b = in[2*2+1] * c[2] + in[2*4+1] * c[4] + tb66 + in[2*8+1] * c[8]; + tmp1a = REAL_MUL(in[2*1+0], c[1]) + ta33 + REAL_MUL(in[2*5+0], c[5]) + REAL_MUL(in[2*7+0], c[7]); + tmp1b = REAL_MUL(in[2*1+1], c[1]) + tb33 + REAL_MUL(in[2*5+1], c[5]) + REAL_MUL(in[2*7+1], c[7]); + tmp2a = REAL_MUL(in[2*2+0], c[2]) + REAL_MUL(in[2*4+0], c[4]) + ta66 + REAL_MUL(in[2*8+0], c[8]); + tmp2b = REAL_MUL(in[2*2+1], c[2]) + REAL_MUL(in[2*4+1], c[4]) + tb66 + REAL_MUL(in[2*8+1], c[8]); MACRO1(0); MACRO2(8); @@ -1464,10 +1464,10 @@ { real tmp1a,tmp2a,tmp1b,tmp2b; - tmp1a = ( in[2*1+0] - in[2*5+0] - in[2*7+0] ) * c[3]; - tmp1b = ( in[2*1+1] - in[2*5+1] - in[2*7+1] ) * c[3]; - tmp2a = ( in[2*2+0] - in[2*4+0] - in[2*8+0] ) * c[6] - in[2*6+0] + in[2*0+0]; - tmp2b = ( in[2*2+1] - in[2*4+1] - in[2*8+1] ) * c[6] - in[2*6+1] + in[2*0+1]; + tmp1a = REAL_MUL(( in[2*1+0] - in[2*5+0] - in[2*7+0] ), c[3]); + tmp1b = REAL_MUL(( in[2*1+1] - in[2*5+1] - in[2*7+1] ), c[3]); + tmp2a = REAL_MUL(( in[2*2+0] - in[2*4+0] - in[2*8+0] ), c[6]) - in[2*6+0] + in[2*0+0]; + tmp2b = REAL_MUL(( in[2*2+1] - in[2*4+1] - in[2*8+1] ), c[6]) - in[2*6+1] + in[2*0+1]; MACRO1(1); MACRO2(7); @@ -1475,10 +1475,10 @@ { real tmp1a,tmp2a,tmp1b,tmp2b; - tmp1a = in[2*1+0] * c[5] - ta33 - in[2*5+0] * c[7] + in[2*7+0] * c[1]; - tmp1b = in[2*1+1] * c[5] - tb33 - in[2*5+1] * c[7] + in[2*7+1] * c[1]; - tmp2a = - in[2*2+0] * c[8] - in[2*4+0] * c[2] + ta66 + in[2*8+0] * c[4]; - tmp2b = - in[2*2+1] * c[8] - in[2*4+1] * c[2] + tb66 + in[2*8+1] * c[4]; + tmp1a = REAL_MUL(in[2*1+0], c[5]) - ta33 - REAL_MUL(in[2*5+0], c[7]) + REAL_MUL(in[2*7+0], c[1]); + tmp1b = REAL_MUL(in[2*1+1], c[5]) - tb33 - REAL_MUL(in[2*5+1], c[7]) + REAL_MUL(in[2*7+1], c[1]); + tmp2a = - REAL_MUL(in[2*2+0], c[8]) - REAL_MUL(in[2*4+0], c[2]) + ta66 + REAL_MUL(in[2*8+0], c[4]); + tmp2b = - REAL_MUL(in[2*2+1], c[8]) - REAL_MUL(in[2*4+1], c[2]) + tb66 + REAL_MUL(in[2*8+1], c[4]); MACRO1(2); MACRO2(6); @@ -1486,10 +1486,10 @@ { real tmp1a,tmp2a,tmp1b,tmp2b; - tmp1a = in[2*1+0] * c[7] - ta33 + in[2*5+0] * c[1] - in[2*7+0] * c[5]; - tmp1b = in[2*1+1] * c[7] - tb33 + in[2*5+1] * c[1] - in[2*7+1] * c[5]; - tmp2a = - in[2*2+0] * c[4] + in[2*4+0] * c[8] + ta66 - in[2*8+0] * c[2]; - tmp2b = - in[2*2+1] * c[4] + in[2*4+1] * c[8] + tb66 - in[2*8+1] * c[2]; + tmp1a = REAL_MUL(in[2*1+0], c[7]) - ta33 + REAL_MUL(in[2*5+0], c[1]) - REAL_MUL(in[2*7+0], c[5]); + tmp1b = REAL_MUL(in[2*1+1], c[7]) - tb33 + REAL_MUL(in[2*5+1], c[1]) - REAL_MUL(in[2*7+1], c[5]); + tmp2a = - REAL_MUL(in[2*2+0], c[4]) + REAL_MUL(in[2*4+0], c[8]) + ta66 - REAL_MUL(in[2*8+0], c[2]); + tmp2b = - REAL_MUL(in[2*2+1], c[4]) + REAL_MUL(in[2*4+1], c[8]) + tb66 - REAL_MUL(in[2*8+1], c[2]); MACRO1(3); MACRO2(5); @@ -1498,7 +1498,7 @@ { real sum0,sum1; sum0 = in[2*0+0] - in[2*2+0] + in[2*4+0] - in[2*6+0] + in[2*8+0]; - sum1 = (in[2*0+1] - in[2*2+1] + in[2*4+1] - in[2*6+1] + in[2*8+1] ) * tfcos36[4]; + sum1 = REAL_MUL((in[2*0+1] - in[2*2+1] + in[2*4+1] - in[2*6+1] + in[2*8+1] ), tfcos36[4]); MACRO0(4); } } @@ -1522,19 +1522,19 @@ \ in5 += in3; in3 += in1; \ \ - in2 *= COS6_1; \ - in3 *= COS6_1; \ + in2 = REAL_MUL(in2, COS6_1); \ + in3 = REAL_MUL(in3, COS6_1); \ #define DCT12_PART2 \ - in0 += in4 * COS6_2; \ + in0 += REAL_MUL(in4, COS6_2); \ \ in4 = in0 + in2; \ in0 -= in2; \ \ - in1 += in5 * COS6_2; \ + in1 += REAL_MUL(in5, COS6_2); \ \ - in5 = (in1 + in3) * tfcos12[0]; \ - in1 = (in1 - in3) * tfcos12[2]; \ + in5 = REAL_MUL((in1 + in3), tfcos12[0]); \ + in1 = REAL_MUL((in1 - in3), tfcos12[2]); \ \ in3 = in4 + in5; \ in4 -= in5; \ @@ -1554,27 +1554,27 @@ { real tmp0,tmp1 = (in0 - in4); { - real tmp2 = (in1 - in5) * tfcos12[1]; + real tmp2 = REAL_MUL((in1 - in5), tfcos12[1]); tmp0 = tmp1 + tmp2; tmp1 -= tmp2; } - ts[(17-1)*SBLIMIT] = out1[17-1] + tmp0 * wi[11-1]; - ts[(12+1)*SBLIMIT] = out1[12+1] + tmp0 * wi[6+1]; - ts[(6 +1)*SBLIMIT] = out1[6 +1] + tmp1 * wi[1]; - ts[(11-1)*SBLIMIT] = out1[11-1] + tmp1 * wi[5-1]; + ts[(17-1)*SBLIMIT] = out1[17-1] + REAL_MUL(tmp0, wi[11-1]); + ts[(12+1)*SBLIMIT] = out1[12+1] + REAL_MUL(tmp0, wi[6+1]); + ts[(6 +1)*SBLIMIT] = out1[6 +1] + REAL_MUL(tmp1, wi[1]); + ts[(11-1)*SBLIMIT] = out1[11-1] + REAL_MUL(tmp1, wi[5-1]); } DCT12_PART2 - ts[(17-0)*SBLIMIT] = out1[17-0] + in2 * wi[11-0]; - ts[(12+0)*SBLIMIT] = out1[12+0] + in2 * wi[6+0]; - ts[(12+2)*SBLIMIT] = out1[12+2] + in3 * wi[6+2]; - ts[(17-2)*SBLIMIT] = out1[17-2] + in3 * wi[11-2]; - - ts[(6+0)*SBLIMIT] = out1[6+0] + in0 * wi[0]; - ts[(11-0)*SBLIMIT] = out1[11-0] + in0 * wi[5-0]; - ts[(6+2)*SBLIMIT] = out1[6+2] + in4 * wi[2]; - ts[(11-2)*SBLIMIT] = out1[11-2] + in4 * wi[5-2]; + ts[(17-0)*SBLIMIT] = out1[17-0] + REAL_MUL(in2, wi[11-0]); + ts[(12+0)*SBLIMIT] = out1[12+0] + REAL_MUL(in2, wi[6+0]); + ts[(12+2)*SBLIMIT] = out1[12+2] + REAL_MUL(in3, wi[6+2]); + ts[(17-2)*SBLIMIT] = out1[17-2] + REAL_MUL(in3, wi[11-2]); + + ts[(6 +0)*SBLIMIT] = out1[6+0] + REAL_MUL(in0, wi[0]); + ts[(11-0)*SBLIMIT] = out1[11-0] + REAL_MUL(in0, wi[5-0]); + ts[(6 +2)*SBLIMIT] = out1[6+2] + REAL_MUL(in4, wi[2]); + ts[(11-2)*SBLIMIT] = out1[11-2] + REAL_MUL(in4, wi[5-2]); } in++; @@ -1588,27 +1588,27 @@ { real tmp0,tmp1 = (in0 - in4); { - real tmp2 = (in1 - in5) * tfcos12[1]; + real tmp2 = REAL_MUL((in1 - in5), tfcos12[1]); tmp0 = tmp1 + tmp2; tmp1 -= tmp2; } - out2[5-1] = tmp0 * wi[11-1]; - out2[0+1] = tmp0 * wi[6+1]; - ts[(12+1)*SBLIMIT] += tmp1 * wi[1]; - ts[(17-1)*SBLIMIT] += tmp1 * wi[5-1]; + out2[5-1] = REAL_MUL(tmp0, wi[11-1]); + out2[0+1] = REAL_MUL(tmp0, wi[6+1]); + ts[(12+1)*SBLIMIT] += REAL_MUL(tmp1, wi[1]); + ts[(17-1)*SBLIMIT] += REAL_MUL(tmp1, wi[5-1]); } DCT12_PART2 - out2[5-0] = in2 * wi[11-0]; - out2[0+0] = in2 * wi[6+0]; - out2[0+2] = in3 * wi[6+2]; - out2[5-2] = in3 * wi[11-2]; - - ts[(12+0)*SBLIMIT] += in0 * wi[0]; - ts[(17-0)*SBLIMIT] += in0 * wi[5-0]; - ts[(12+2)*SBLIMIT] += in4 * wi[2]; - ts[(17-2)*SBLIMIT] += in4 * wi[5-2]; + out2[5-0] = REAL_MUL(in2, wi[11-0]); + out2[0+0] = REAL_MUL(in2, wi[6+0]); + out2[0+2] = REAL_MUL(in3, wi[6+2]); + out2[5-2] = REAL_MUL(in3, wi[11-2]); + + ts[(12+0)*SBLIMIT] += REAL_MUL(in0, wi[0]); + ts[(17-0)*SBLIMIT] += REAL_MUL(in0, wi[5-0]); + ts[(12+2)*SBLIMIT] += REAL_MUL(in4, wi[2]); + ts[(17-2)*SBLIMIT] += REAL_MUL(in4, wi[5-2]); } in++; @@ -1623,27 +1623,27 @@ { real tmp0,tmp1 = (in0 - in4); { - real tmp2 = (in1 - in5) * tfcos12[1]; + real tmp2 = REAL_MUL((in1 - in5), tfcos12[1]); tmp0 = tmp1 + tmp2; tmp1 -= tmp2; } - out2[11-1] = tmp0 * wi[11-1]; - out2[6 +1] = tmp0 * wi[6+1]; - out2[0+1] += tmp1 * wi[1]; - out2[5-1] += tmp1 * wi[5-1]; + out2[11-1] = REAL_MUL(tmp0, wi[11-1]); + out2[6 +1] = REAL_MUL(tmp0, wi[6+1]); + out2[0+1] += REAL_MUL(tmp1, wi[1]); + out2[5-1] += REAL_MUL(tmp1, wi[5-1]); } DCT12_PART2 - out2[11-0] = in2 * wi[11-0]; - out2[6 +0] = in2 * wi[6+0]; - out2[6 +2] = in3 * wi[6+2]; - out2[11-2] = in3 * wi[11-2]; - - out2[0+0] += in0 * wi[0]; - out2[5-0] += in0 * wi[5-0]; - out2[0+2] += in4 * wi[2]; - out2[5-2] += in4 * wi[5-2]; + out2[11-0] = REAL_MUL(in2, wi[11-0]); + out2[6 +0] = REAL_MUL(in2, wi[6+0]); + out2[6 +2] = REAL_MUL(in3, wi[6+2]); + out2[11-2] = REAL_MUL(in3, wi[11-2]); + + out2[0+0] += REAL_MUL(in0, wi[0]); + out2[5-0] += REAL_MUL(in0, wi[5-0]); + out2[0+2] += REAL_MUL(in4, wi[2]); + out2[5-2] += REAL_MUL(in4, wi[5-2]); } } @@ -1693,7 +1693,7 @@ int i; for(i=0;i