📄 esram.c
字号:
b1[0x0E] += b1[0x0D];
b1[0x0D] += b1[0x0F];
b1[0x12] += b1[0x13];
b1[0x16] += b1[0x17];
b1[0x14] += b1[0x16];
b1[0x16] += b1[0x15];
b1[0x15] += b1[0x17];
b1[0x1A] += b1[0x1B];
b1[0x1E] += b1[0x1F];
b1[0x1C] += b1[0x1E];
b1[0x1E] += b1[0x1D];
b1[0x1D] += b1[0x1F];
}
out0[0x10*16] = b1[0x00];
out0[0x10*12] = b1[0x04];
out0[0x10* 8] = b1[0x02];
out0[0x10* 4] = b1[0x06];
out0[0x10* 0] = b1[0x01];
out1[0x10* 0] = b1[0x01];
out1[0x10* 4] = b1[0x05];
out1[0x10* 8] = b1[0x03];
out1[0x10*12] = b1[0x07];
b1[0x08] += b1[0x0C];
out0[0x10*14] = b1[0x08];
b1[0x0C] += b1[0x0a];
out0[0x10*10] = b1[0x0C];
b1[0x0A] += b1[0x0E];
out0[0x10* 6] = b1[0x0A];
b1[0x0E] += b1[0x09];
out0[0x10* 2] = b1[0x0E];
b1[0x09] += b1[0x0D];
out1[0x10* 2] = b1[0x09];
b1[0x0D] += b1[0x0B];
out1[0x10* 6] = b1[0x0D];
b1[0x0B] += b1[0x0F];
out1[0x10*10] = b1[0x0B];
out1[0x10*14] = b1[0x0F];
b1[0x18] += b1[0x1C];
out0[0x10*15] = b1[0x10] + b1[0x18];
out0[0x10*13] = b1[0x18] + b1[0x14];
b1[0x1C] += b1[0x1a];
out0[0x10*11] = b1[0x14] + b1[0x1C];
out0[0x10* 9] = b1[0x1C] + b1[0x12];
b1[0x1A] += b1[0x1E];
out0[0x10* 7] = b1[0x12] + b1[0x1A];
out0[0x10* 5] = b1[0x1A] + b1[0x16];
b1[0x1E] += b1[0x19];
out0[0x10* 3] = b1[0x16] + b1[0x1E];
out0[0x10* 1] = b1[0x1E] + b1[0x11];
b1[0x19] += b1[0x1D];
out1[0x10* 1] = b1[0x11] + b1[0x19];
out1[0x10* 3] = b1[0x19] + b1[0x15];
b1[0x1D] += b1[0x1B];
out1[0x10* 5] = b1[0x15] + b1[0x1D];
out1[0x10* 7] = b1[0x1D] + b1[0x13];
b1[0x1B] += b1[0x1F];
out1[0x10* 9] = b1[0x13] + b1[0x1B];
out1[0x10*11] = b1[0x1B] + b1[0x17];
out1[0x10*13] = b1[0x17] + b1[0x1F];
out1[0x10*15] = b1[0x1F];
}
//#define MUL_ADD_SOFT;
gmp.synth_bo = bo;
{
register int j;
real bx = (16 - bo1) & 0xf;
real *window = decwin;
real sum, sum1;
for (j=16;j;j--,b0+=0x10,window+=0x10,samples+=step)
{
if (bx) {
if (bo1 == 1) {
sum = MUL24OUT(window[bx], b0[0x0]);
} else {
//CheckMMAInputScale(b0,8);
#ifdef MUL_ADD_SOFT1
MMA__SOFT_CALC(&sum,b0,(window+bx) ,(0xc0c00800 + ((bo1-1)<<14)));
#else
// MMA__SOFT_CALC(&real_value,b0,(window+bx) ,(0xc0c00800 + ((bo1-1)<<14)));
*mmabufzar = (int)∑
*mmabufxar = (int)b0;
*mmamoder = (0xc0c80800 + ((bo1-1)<<14)) | (((int)(window+bx) >> 2) & 0x3ff);
//NOP_OPERATIOM() ;
//CheckDifference(real_value,sum);
#endif
}
if (bx == 1) {
sum1 = MUL24OUT(window[0], b0[bo1]);
} else {
//CheckMMAInputScale(b0,8);
#ifdef MUL_ADD_SOFT2
MMA__SOFT_CALC(&sum1,(b0+bo1),window,(0xc0c00800 + ((bx-1)<<14)));
#else
// MMA__SOFT_CALC(&real_value,(b0+bo1),window,(0xc0c00800 + ((bx-1)<<14)));
*mmabufzar = (int)&sum1;
*mmabufxar = (int)(b0+bo1);
*mmamoder = (0xc0c80800 + ((bx-1)<<14)) | (((int)(window) >> 2) & 0x3ff);
NOP_OPERATIOM() ;
// CheckDifference(real_value,sum1);
#endif
}
if (bo1&1) sum -= sum1;
else sum += sum1;
} else {
// CheckMMAInputScale(b0,8);
#ifdef MUL_ADD_SOFT3
MMA__SOFT_CALC(&sum,b0,window,0xc0c3c800);
#else
//MMA__SOFT_CALC(&real_value,b0,window,0xc0c3c800);
*mmabufzar = (int)∑
*mmabufxar = (int)b0;
*mmamoder = 0xc0cbc800 | (((int)(window) >> 2) & 0x3ff);
NOP_OPERATIOM() ;
//CheckDifference(real_value,sum);
#endif
}
WRITE_SAMPLE(samples,clip,sum);
}
//*******************************************
//*******************************************
{
extern real b0x[16];
b0x[0] = b0[0];
b0x[2] = b0[2];
b0x[4] = b0[4];
b0x[6] = b0[6];
b0x[8] = b0[8];
b0x[10] = b0[10];
b0x[12] = b0[12];
b0x[14] = b0[14];
// CheckMMAInputScale16(b0x,8);
// #ifdef MUL_ADD_SOFT4
{
// MMA__SOFT_CALC(&real_value,b0x,(window+bx),0xc0c3c800);
// #else
*mmabufzar = (int)∑
*mmabufxar = (int)b0x;
*mmamoder = 0xc0cbc800 | (((int)(window+bx) >> 2) & 0x3ff);
NOP_OPERATIOM() ;
// #endif
// CheckDifference(real_value,sum);
}
WRITE_SAMPLE(samples,clip,sum);
b0-=0x10,window-=0x10,samples+=step;
}
for (j=15;j;j--,b0-=0x10,window-=0x10,samples+=step)
{
if (bo1) {
if (bo1 == 1) {
sum = MUL24OUT(window[0x0], b0[0x0]);
} else {
// CheckMMAInputScale(b0,8);
#ifdef MUL_ADD_SOFT5
MMA__SOFT_CALC(&sum,b0,window,(0xc0c00400 + ((bo1-1)<<14)));
#else
// MMA__SOFT_CALC(&real_value,b0,window,(0xc0c00400 + ((bo1-1)<<14)));
*mmabufzar = (int)∑
*mmabufxar = (int)b0;
*mmamoder = (0xc0c80400 + ((bo1-1)<<14)) | (((int)(window) >> 2) & 0x3ff);
// NOP_OPERATIOM() ;
// CheckDifference(real_value,sum);
#endif
}
if (bx == 1) {
sum1 = MUL24OUT(window[bo1], b0[bo1]);
} else {
// CheckMMAInputScale(b0,8);
#ifdef MUL_ADD_SOFT6
MMA__SOFT_CALC(&sum1,(b0+bo1),(window+bo1),(0xc0c00400 + ((bx-1)<<14)));
#else
// MMA__SOFT_CALC(&real_value,(b0+bo1),(window+bo1),(0xc0c00400 + ((bx-1)<<14)));
*mmabufzar = (int)&sum1;
*mmabufxar = (int)(b0+bo1);
*mmamoder = (0xc0c80400 + ((bx-1)<<14)) | (((int)(window+bo1) >> 2) & 0x3ff);
NOP_OPERATIOM() ;
#endif
}
sum += sum1;
} else {
// CheckMMAInputScale(b0,8);
#ifdef MUL_ADD_SOFT7
MMA__SOFT_CALC(&sum,b0,window,0xc0c3c400);
#else
//MMA__SOFT_CALC(&real_value,b0,window,0xc0c3c400);
*mmabufzar = (int)∑
*mmabufxar = (int)b0;
*mmamoder = 0xc0cbc400 | (((int)(window) >> 2) & 0x3ff); //change from 3 to b
NOP_OPERATIOM() ;
#endif
}
WRITE_SAMPLE(samples,clip,-sum);
}
}
*pnt += 128;
return clip;
}
/*
DCT insipired by Jeff Tsay's DCT from the maplay package
this is an optimized version with manual unroll.
References:
[1] S. Winograd: "On Computing the Discrete Fourier Transform",
Mathematics of Computation, Volume 32, Number 141, January 1978,
Pages 175-199
*/
void dct36(real *inbuf,real *o1,real *o2,real *wintab,real *tsbuf)
{
{
register real *in = inbuf;
/*
* Modified by DSA 2003.11.05 but it is no used here
*/
in[17]+=in[16]; in[16]+=in[15]; in[15]+=in[14];
in[14]+=in[13]; in[13]+=in[12]; in[12]+=in[11];
in[11]+=in[10]; in[10]+=in[9]; in[9] +=in[8];
in[8] +=in[7]; in[7] +=in[6]; in[6] +=in[5];
in[5] +=in[4]; in[4] +=in[3]; in[3] +=in[2];
in[2] +=in[1]; in[1] +=in[0];
//int register i;
/*register real *out = inbuf + 17;
//for(i=0;i<18;i++,out--)
*out += *(out-1);out--;
*out += *(out-1);out--;
*out += *(out-1);out--;
*out += *(out-1);out--;
*out += *(out-1);out--;
*out += *(out-1);out--;
*out += *(out-1);out--;
*out += *(out-1);out--;
*out += *(out-1);out--;
*out += *(out-1);out--;
*out += *(out-1);out--;
*out += *(out-1);out--;
*out += *(out-1);out--;
*out += *(out-1);out--;
*out += *(out-1);out--;
*out += *(out-1);out--;
*out += *(out-1);*/
in[17]+=in[15]; in[15]+=in[13]; in[13]+=in[11]; in[11]+=in[9];
in[9] +=in[7]; in[7] +=in[5]; in[5] +=in[3]; in[3] +=in[1];
/*register real *out = inbuf + 17;
*out += *(out-2);out--;out--;
*out += *(out-2);out--;out--;
*out += *(out-2);out--;out--;
*out += *(out-2);out--;out--;
*out += *(out-2);out--;out--;
*out += *(out-2);out--;out--;
*out += *(out-2);out--;out--;
*out += *(out-2);*/
{
#define MACRO0(v) { \
real tmp = sum0 + sum1; \
out2[9+(v)] = MUL24(tmp, w[27+(v)]); \
out2[8-(v)] = MUL24(tmp, w[26-(v)]); } \
sum0 -= sum1; \
ts[SBLIMIT*(8-(v))] = out1[8-(v)] + MUL24(sum0, w[8-(v)]); \
ts[SBLIMIT*(9+(v))] = out1[9+(v)] + MUL24(sum0, w[9+(v)]);
/*#define MACRO0(v) { \
real tmp = sum0 + sum1; \
*(out2_9 + v) = MUL24(tmp, *(w27 + v)); \
*(out2_8 - v) = MUL24(tmp, *(w26 - v)); } \
sum0 -= sum1; \
ts[SBLIMIT*(8-(v))] = *(out1_8 - v) + MUL24(sum0, *(w8 - v)); \
ts[SBLIMIT*(9+(v))] = *(out1_9 + v) + MUL24(sum0, *(w9 + v));*/
#define MACRO1(v) { \
real sum0,sum1; \
sum0 = tmp1a + tmp2a; \
sum1 = MUL24((tmp1b + tmp2b), tfcos36[(v)]); \
MACRO0(v); }
#define MACRO2(v) { \
real sum0,sum1; \
sum0 = tmp2a - tmp1a; \
sum1 = MUL24((tmp2b - tmp1b), tfcos36[(v)]); \
MACRO0(v); }
/*register real *w27 = wintab + 27;
register real *w26 = w27--;
register real *w9 = wintab + 9;
register real *w8 = w9--;
register real *out2_9 = o2 + 9;
register real *out2_8 = out2_9--;
register real *out1_9 = o1 + 9;
register real *out1_8 = out1_9--;*/
register real *c = COS9;
register real *out2 = o2;
register real *w = wintab;
register real *out1 = o1;
register real *ts = tsbuf;
real ta33,ta66,tb33,tb66;
ta33 = MUL24(in[2*3+0], c[3]);
ta66 = MUL24(in[2*6+0], c[6]);
tb33 = MUL24(in[2*3+1], c[3]);
tb66 = MUL24(in[2*6+1], c[6]);
{
real tmp1a,tmp2a,tmp1b,tmp2b;
tmp1a = MUL24(in[2*1+0], c[1]) + MUL24(in[2*5+0], c[5]) + MUL24(in[2*7+0], c[7]) + ta33 ;
tmp1b = MUL24(in[2*1+1], c[1]) + MUL24(in[2*5+1], c[5]) + MUL24(in[2*7+1], c[7]) + tb33;
tmp2a = in[2*0+0] + MUL24(in[2*2+0], c[2]) + MUL24(in[2*4+0], c[4]) + MUL24(in[2*8+0], c[8]) + ta66;
tmp2b = in[2*0+1] + MUL24(in[2*2+1], c[2]) + MUL24(in[2*4+1], c[4]) + MUL24(in[2*8+1], c[8]) + tb66;
MACRO1(0);
MACRO2(8);
}
{
real tmp1a,tmp2a,tmp1b,tmp2b;
tmp1a = MUL24(( in[2*1+0] - in[2*5+0] - in[2*7+0] ), c[3]);
tmp1b = MUL24(( in[2*1+1] - in[2*5+1] - in[2*7+1] ), c[3]);
tmp2a = MUL24(( in[2*2+0] - in[2*4+0] - in[2*8+0] ), c[6]) - in[2*6+0] + in[2*0+0];
tmp2b = MUL24(( 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);
}
{
real tmp1a,tmp2a,tmp1b,tmp2b;
tmp1a = MUL24(in[2*1+0], c[5]) - MUL24(in[2*5+0], c[7]) + MUL24(in[2*7+0], c[1]) - ta33;
tmp1b = MUL24(in[2*1+1], c[5]) - MUL24(in[2*5+1], c[7]) + MUL24(in[2*7+1], c[1]) - tb33;
tmp2a = in[2*0+0] - MUL24(in[2*2+0], c[8]) - MUL24(in[2*4+0], c[2]) + MUL24(in[2*8+0], c[4]) + ta66;
tmp2b = in[2*0+1] - MUL24(in[2*2+1], c[8]) - MUL24(in[2*4+1], c[2]) + MUL24(in[2*8+1], c[4]) + tb66;
MACRO1(2);
MACRO2(6);
}
{
real tmp1a,tmp2a,tmp1b,tmp2b;
tmp1a = MUL24(in[2*1+0], c[7]) + MUL24(in[2*5+0], c[1]) - MUL24(in[2*7+0], c[5]) - ta33;
tmp1b = MUL24(in[2*1+1], c[7]) + MUL24(in[2*5+1], c[1]) - MUL24(in[2*7+1], c[5]) - tb33;
tmp2a = in[2*0+0] - MUL24(in[2*2+0], c[4]) + MUL24(in[2*4+0], c[8]) - MUL24(in[2*8+0], c[2]) + ta66;
tmp2b = in[2*0+1] - MUL24(in[2*2+1], c[4]) + MUL24(in[2*4+1], c[8]) - MUL24(in[2*8+1], c[2]) + tb66;
MACRO1(3);
MACRO2(5);
}
{
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 = MUL24((in[2*0+1] - in[2*2+1] + in[2*4+1] - in[2*6+1] + in[2*8+1] ), tfcos36[4]);
MACRO0(4);
}
}
}
}
extern int *map[9][3];
extern int *mapend[9][3];
#if 0
#define deq_pow(x,v) \
{ \
int p, r, l; \
if ((x)<130 ) { deq = ispow[(x)]; l = 0; } \
else if ((x)<1025) { p = (x)>>3; r = (x)&7 ; deq = (ispow[p]>>3)*(8 -r)+(ispow[p+1]>>3)*r; l = 4; } \
else { p = (x)>>6; r = (x)&63; deq = (ispow[p]>>6)*(64-r)+(ispow[p+1]>>6)*r; l = 8; } \
p = -(v); r = p&3; p = p>>2; \
deq = (deq>>13)*(gainpow2[r]>>10); deq = deq>>(-2-l-p); \
}
#endif
#if 0
#define deq_pow(x,v) \
{ \
int p, r, l; \
if ((x)<130 ) { deq = ispow[(x)]; l = 0; } \
else if ((x)<1025) { p = (x)>>3; r = (x)&7 ; deq = (ispow[p]>>3)*(8 -r)+(ispow[p+1]>>3)*r; l = 4; } \
else { p = (x)>>6; r = (x)&63; deq = (ispow[p]>>6)*(64-r)+(ispow[p+1]>>6)*r; l = 8; } \
p = -(v); r = p&3; p = p>>2; \
deq = (deq>>13)*(gainpow2[r]>>10); if(deq<0) deq=0x7fffffff; deq = deq>>(-2-l-p); \
}
#endif
#if 1
#define deq_pow(x,v) \
{ \
int p, r, l,deq1,s,t,q; \
t = -(v); s = t&3; q = t>>2; \
if ((x)<64) { deq1 = ispow[(x)]; l = 0;deq = (deq1>>13)*(gainpow2[s]>>10); deq = deq>>(-2-l-q); } \
else if ((x)<130) { \
deq1 = ispow[(x)]; l = 0; deq = (deq1>>15)*(gainpow2[s]>>10); \
deq = deq>>(-4-l-q);} \
else if (x<1025) { \
p = (x)>>3; r = (x)&7 ; deq1 = (ispow[p]>>3)*(8-r)+(ispow[p+1]>>3)*r; l = 4; \
deq = (deq1>>15)*(gainpow2[s]>>10); deq = deq>>(-4-l-q);} \
else { \
p = (x)>>6; r = (x)&63; deq1 = (ispow[p]>>6)*(64-r)+(ispow[p+1]>>6)*r; l = 8; \
deq = (deq1>>15)*(gainpow2[s]>>10); deq = deq>>(-4-l-q); } \
}
#endif
static int pretab1[22] = {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0};
static int pretab2[22] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int III_dequantize_sample(real xr[SBLIMIT][SSLIMIT],int *scf,
struct gr_info_s *gr_info,int sfreq,int part2bits)
{
int shift = 1 + gr_info->scalefac_scale;
real *xrpnt = (real *) xr;
int l[3],l3,*count;
int part2remain = gr_info->part2_3_length - part2bits;
int *me;
real deq;
{
int bv = gr_info->big_values;
int region1 = gr_info->region1start;
int region2 = gr_info->region2start;
l3 = ((576>>1)-bv)>>1;
/*
* we may lose the 'odd' bit here !!
* check this later again
*/
if(bv <= region1) {
l[0] = bv; l[1] = 0; l[2] = 0;
}
else {
l[0] = region1;
if(bv <= region2) {
l[1] = bv - l[0]; l[2] = 0;
}
else {
l[1] = region2 - l[0]; l[2] = bv - region2;
}
}
}
if(gr_info->block_type == 2) {
/*
* decoding with short or mixed mode BandIndex table
*/
int i,max[4];
int step=0,lwin=0,cb=0;
register int v = 0;
register int *m,mc;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -