⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpeglayer3.cc

📁 PIXIL is a small footprint operating environment, complete with PDA PIM applications, a browser and
💻 CC
📖 第 1 页 / 共 4 页
字号:
                            \  in4=in0+in2;              \  in0-=in2;                 \                            \  in1+=in5*cos2_6;          \                            \  in5=(in1+in3)*hsec_12[0]; \  in1=(in1-in3)*hsec_12[2]; \                            \  in3=in4+in5;              \  in4-=in5;                 \                            \  in2=in0+in1;              \  in0-=in1;    {	REAL in0, in1, in2, in3, in4, in5;	register REAL *pb1 = prevblk1;	out[SBLIMIT * 0] = pb1[0];	out[SBLIMIT * 1] = pb1[1];	out[SBLIMIT * 2] = pb1[2];	out[SBLIMIT * 3] = pb1[3];	out[SBLIMIT * 4] = pb1[4];	out[SBLIMIT * 5] = pb1[5];	DCT12_PART1;	{	    REAL tmp0, tmp1 = (in0 - in4);	    {		REAL tmp2 = (in1 - in5) * hsec_12[1];		tmp0 = tmp1 + tmp2;		tmp1 -= tmp2;	    }	    out[(17 - 1) * SBLIMIT] = pb1[17 - 1] + tmp0 * wi[11 - 1];	    out[(12 + 1) * SBLIMIT] = pb1[12 + 1] + tmp0 * wi[6 + 1];	    out[(6 + 1) * SBLIMIT] = pb1[6 + 1] + tmp1 * wi[1];	    out[(11 - 1) * SBLIMIT] = pb1[11 - 1] + tmp1 * wi[5 - 1];	}	DCT12_PART2;	out[(17 - 0) * SBLIMIT] = pb1[17 - 0] + in2 * wi[11 - 0];	out[(12 + 0) * SBLIMIT] = pb1[12 + 0] + in2 * wi[6 + 0];	out[(12 + 2) * SBLIMIT] = pb1[12 + 2] + in3 * wi[6 + 2];	out[(17 - 2) * SBLIMIT] = pb1[17 - 2] + in3 * wi[11 - 2];	out[(6 + 0) * SBLIMIT] = pb1[6 + 0] + in0 * wi[0];	out[(11 - 0) * SBLIMIT] = pb1[11 - 0] + in0 * wi[5 - 0];	out[(6 + 2) * SBLIMIT] = pb1[6 + 2] + in4 * wi[2];	out[(11 - 2) * SBLIMIT] = pb1[11 - 2] + in4 * wi[5 - 2];    }    in++;    {	REAL in0, in1, in2, in3, in4, in5;	register REAL *pb2 = prevblk2;	DCT12_PART1;	{	    REAL tmp0, tmp1 = (in0 - in4);	    {		REAL tmp2 = (in1 - in5) * hsec_12[1];		tmp0 = tmp1 + tmp2;		tmp1 -= tmp2;	    }	    pb2[5 - 1] = tmp0 * wi[11 - 1];	    pb2[0 + 1] = tmp0 * wi[6 + 1];	    out[(12 + 1) * SBLIMIT] += tmp1 * wi[1];	    out[(17 - 1) * SBLIMIT] += tmp1 * wi[5 - 1];	}	DCT12_PART2;	pb2[5 - 0] = in2 * wi[11 - 0];	pb2[0 + 0] = in2 * wi[6 + 0];	pb2[0 + 2] = in3 * wi[6 + 2];	pb2[5 - 2] = in3 * wi[11 - 2];	out[(12 + 0) * SBLIMIT] += in0 * wi[0];	out[(17 - 0) * SBLIMIT] += in0 * wi[5 - 0];	out[(12 + 2) * SBLIMIT] += in4 * wi[2];	out[(17 - 2) * SBLIMIT] += in4 * wi[5 - 2];    }    in++;    {	REAL in0, in1, in2, in3, in4, in5;	register REAL *pb2 = prevblk2;	pb2[12] = pb2[13] = pb2[14] = pb2[15] = pb2[16] = pb2[17] = 0.0;	DCT12_PART1;	{	    REAL tmp0, tmp1 = (in0 - in4);	    {		REAL tmp2 = (in1 - in5) * hsec_12[1];		tmp0 = tmp1 + tmp2;		tmp1 -= tmp2;	    }	    pb2[11 - 1] = tmp0 * wi[11 - 1];	    pb2[6 + 1] = tmp0 * wi[6 + 1];	    pb2[0 + 1] += tmp1 * wi[1];	    pb2[5 - 1] += tmp1 * wi[5 - 1];	}	DCT12_PART2;	pb2[11 - 0] = in2 * wi[11 - 0];	pb2[6 + 0] = in2 * wi[6 + 0];	pb2[6 + 2] = in3 * wi[6 + 2];	pb2[11 - 2] = in3 * wi[11 - 2];	pb2[0 + 0] += in0 * wi[0];	pb2[5 - 0] += in0 * wi[5 - 0];	pb2[0 + 2] += in4 * wi[2];	pb2[5 - 2] += in4 * wi[5 - 2];    }}voidMpegtoraw::layer3hybrid(int ch, int gr, REAL in[SBLIMIT][SSLIMIT],			REAL out[SSLIMIT][SBLIMIT]){    layer3grinfo *gi = &(sideinfo.ch[ch].gr[gr]);    int bt1, bt2;    REAL *prev1, *prev2;    prev1 = prevblck[ch][currentprevblock][0];    prev2 = prevblck[ch][currentprevblock ^ 1][0];    bt1 = gi->mixed_block_flag ? 0 : gi->block_type;    bt2 = gi->block_type;    {	REAL *ci = (REAL *) in, *co = (REAL *) out;	int i;	if (downfrequency)	    i = (SBLIMIT / 2) - 2;	else	    i = SBLIMIT - 2;	if (bt2 == 2) {	    if (!bt1) {		dct36(ci, prev1, prev2, win[0], co);		ci += SSLIMIT;		prev1 += SSLIMIT;		prev2 += SSLIMIT;		co++;		dct36(ci, prev1, prev2, win[0], co);	    } else {		dct12(ci, prev1, prev2, win[2], co);		ci += SSLIMIT;		prev1 += SSLIMIT;		prev2 += SSLIMIT;		co++;		dct12(ci, prev1, prev2, win[2], co);	    }	    do {		ci += SSLIMIT;		prev1 += SSLIMIT;		prev2 += SSLIMIT;		co++;		dct12(ci, prev1, prev2, win[2], co);	    } while (--i);	} else {	    dct36(ci, prev1, prev2, win[bt1], co);	    ci += SSLIMIT;	    prev1 += SSLIMIT;	    prev2 += SSLIMIT;	    co++;	    dct36(ci, prev1, prev2, win[bt1], co);	    do {		ci += SSLIMIT;		prev1 += SSLIMIT;		prev2 += SSLIMIT;		co++;		dct36(ci, prev1, prev2, win[bt2], co);	    } while (--i);	}    }}#define NEG(a)  (a)=-(a)voidMpegtoraw::extractlayer3(void){    if (version) {	extractlayer3_2();	return;    }    {	int main_data_end, flush_main;	int bytes_to_discard;	layer3getsideinfo();	if (issync()) {	    for (register int i = layer3slots; i > 0; i--)	// read main data.		bitwindow.putbyte(getbyte());	} else {	    for (register int i = layer3slots; i > 0; i--)	// read main data.		bitwindow.putbyte(getbits8());	}	main_data_end = bitwindow.gettotalbit() >> 3;	// of previous frame	if ((flush_main = (bitwindow.gettotalbit() & 0x7))) {	    bitwindow.forward(8 - flush_main);	    main_data_end++;	}	bytes_to_discard =	    layer3framestart - (main_data_end + sideinfo.main_data_begin);	if (main_data_end > WINDOWSIZE) {	    layer3framestart -= WINDOWSIZE;	    bitwindow.rewind(WINDOWSIZE * 8);	}	layer3framestart += layer3slots;	bitwindow.wrap();	if (bytes_to_discard < 0)	    return;	bitwindow.forward(bytes_to_discard << 3);    }    for (int gr = 0; gr < 2; gr++) {#ifndef FIXED_POINT	union	{	    int is[SBLIMIT][SSLIMIT];	    REAL hin[2][SBLIMIT][SSLIMIT];	}	b1;	union	{	    REAL ro[2][SBLIMIT][SSLIMIT];	    REAL lr[2][SBLIMIT][SSLIMIT];	    REAL hout[2][SSLIMIT][SBLIMIT];	}	b2;#else	/* Because unions don't accept objects with assignment methods,	 * I hacked the union declaration a bit to go around the compiler.	 * Once optimized by the compiler, it should generate the same result.	 * (Nico)	 */	typedef struct	{	    char x[sizeof(REAL)];	}	REAL_;	union	{	    int is[SBLIMIT][SSLIMIT];	    REAL_ hin[2][SBLIMIT][SSLIMIT];	}	b1_;	union	{	    REAL_ ro[2][SBLIMIT][SSLIMIT];	    REAL_ lr[2][SBLIMIT][SSLIMIT];	    REAL_ hout[2][SSLIMIT][SBLIMIT];	}	b2_;	struct	{	    int (*is)[SSLIMIT];	      REAL(*hin)[SBLIMIT][SSLIMIT];	}	b1 =	{	(int (*)[SSLIMIT]) b1_.is, (REAL(*)[SBLIMIT][SSLIMIT]) b1_.hin};	struct	{	    REAL(*ro)[SBLIMIT][SSLIMIT];	    REAL(*lr)[SBLIMIT][SSLIMIT];	    REAL(*hout)[SSLIMIT][SBLIMIT];	}	b2 =	{	(REAL(*)[SBLIMIT][SSLIMIT]) b2_.ro,		(REAL(*)[SBLIMIT][SSLIMIT]) b2_.lr,		(REAL(*)[SSLIMIT][SBLIMIT]) b2_.hout};#endif	layer3part2start = bitwindow.gettotalbit();	layer3getscalefactors(LS, gr);	layer3huffmandecode(LS, gr, b1.is);	layer3dequantizesample(LS, gr, b1.is, b2.ro[LS]);	if (inputstereo) {	    layer3part2start = bitwindow.gettotalbit();	    layer3getscalefactors(RS, gr);	    layer3huffmandecode(RS, gr, b1.is);	    layer3dequantizesample(RS, gr, b1.is, b2.ro[RS]);	}	layer3fixtostereo(gr, b2.ro);	// b2.ro -> b2.lr	currentprevblock ^= 1;	layer3reorderandantialias(LS, gr, b2.lr[LS], b1.hin[LS]);	layer3hybrid(LS, gr, b1.hin[LS], b2.hout[LS]);	if (outputstereo) {	    layer3reorderandantialias(RS, gr, b2.lr[RS], b1.hin[RS]);	    layer3hybrid(RS, gr, b1.hin[RS], b2.hout[RS]);	    register int i = 2 * SSLIMIT * SBLIMIT - 1;	    do {		NEG(b2.hout[0][0][i]);		NEG(b2.hout[0][0][i - 2]);		NEG(b2.hout[0][0][i - 4]);		NEG(b2.hout[0][0][i - 6]);		NEG(b2.hout[0][0][i - 8]);		NEG(b2.hout[0][0][i - 10]);		NEG(b2.hout[0][0][i - 12]);		NEG(b2.hout[0][0][i - 14]);		NEG(b2.hout[0][0][i - 16]);		NEG(b2.hout[0][0][i - 18]);		NEG(b2.hout[0][0][i - 20]);		NEG(b2.hout[0][0][i - 22]);		NEG(b2.hout[0][0][i - 24]);		NEG(b2.hout[0][0][i - 26]);		NEG(b2.hout[0][0][i - 28]);		NEG(b2.hout[0][0][i - 30]);	    } while ((i -= 2 * SBLIMIT) > 0);	} else {	    register int i = SSLIMIT * SBLIMIT - 1;	    do {		NEG(b2.hout[0][0][i]);		NEG(b2.hout[0][0][i - 2]);		NEG(b2.hout[0][0][i - 4]);		NEG(b2.hout[0][0][i - 6]);		NEG(b2.hout[0][0][i - 8]);		NEG(b2.hout[0][0][i - 10]);		NEG(b2.hout[0][0][i - 12]);		NEG(b2.hout[0][0][i - 14]);		NEG(b2.hout[0][0][i - 16]);		NEG(b2.hout[0][0][i - 18]);		NEG(b2.hout[0][0][i - 20]);		NEG(b2.hout[0][0][i - 22]);		NEG(b2.hout[0][0][i - 24]);		NEG(b2.hout[0][0][i - 26]);		NEG(b2.hout[0][0][i - 28]);		NEG(b2.hout[0][0][i - 30]);	    } while ((i -= 2 * SBLIMIT) > 0);	}	for (int ss = 0; ss < SSLIMIT; ss++)	    subbandsynthesis(b2.hout[LS][ss], b2.hout[RS][ss]);    }}voidMpegtoraw::extractlayer3_2(void){    {	int main_data_end, flush_main;	int bytes_to_discard;	layer3getsideinfo_2();	if (issync()) {	    for (register int i = layer3slots; i > 0; i--)	// read main data.		bitwindow.putbyte(getbyte());	} else {	    for (register int i = layer3slots; i > 0; i--)	// read main data.		bitwindow.putbyte(getbits8());	}	bitwindow.wrap();	main_data_end = bitwindow.gettotalbit() >> 3;	// of previous frame	if ((flush_main = (bitwindow.gettotalbit() & 0x7))) {	    bitwindow.forward(8 - flush_main);	    main_data_end++;	}	bytes_to_discard =	    layer3framestart - main_data_end - sideinfo.main_data_begin;	if (main_data_end > WINDOWSIZE) {	    layer3framestart -= WINDOWSIZE;	    bitwindow.rewind(WINDOWSIZE * 8);	}	layer3framestart += layer3slots;	if (bytes_to_discard < 0)	    return;	bitwindow.forward(bytes_to_discard << 3);    }    //  for(int gr=0;gr<2;gr++)    {#ifndef FIXED_POINT	union	{	    int is[SBLIMIT][SSLIMIT];	    REAL hin[2][SBLIMIT][SSLIMIT];	}	b1;	union	{	    REAL ro[2][SBLIMIT][SSLIMIT];	    REAL lr[2][SBLIMIT][SSLIMIT];	    REAL hout[2][SSLIMIT][SBLIMIT];	}	b2;#else	/* Because unions don't accept objects with assignment methods,	 * I hacked the union declaration a bit to go around the compiler.	 * Once optimized by the compiler, it should generate the same result.	 * (Nico)	 */	typedef struct	{	    char x[sizeof(REAL)];	}	REAL_;	union	{	    int is[SBLIMIT][SSLIMIT];	    REAL_ hin[2][SBLIMIT][SSLIMIT];	}	b1_;	union	{	    REAL_ ro[2][SBLIMIT][SSLIMIT];	    REAL_ lr[2][SBLIMIT][SSLIMIT];	    REAL_ hout[2][SSLIMIT][SBLIMIT];	}	b2_;	struct	{	    int (*is)[SSLIMIT];	      REAL(*hin)[SBLIMIT][SSLIMIT];	}	b1 =	{	(int (*)[SSLIMIT]) b1_.is, (REAL(*)[SBLIMIT][SSLIMIT]) b1_.hin};	struct	{	    REAL(*ro)[SBLIMIT][SSLIMIT];	    REAL(*lr)[SBLIMIT][SSLIMIT];	    REAL(*hout)[SSLIMIT][SBLIMIT];	}	b2 =	{	(REAL(*)[SBLIMIT][SSLIMIT]) b2_.ro,		(REAL(*)[SBLIMIT][SSLIMIT]) b2_.lr,		(REAL(*)[SSLIMIT][SBLIMIT]) b2_.hout};#endif	layer3part2start = bitwindow.gettotalbit();	layer3getscalefactors_2(LS);	layer3huffmandecode(LS, 0, b1.is);	layer3dequantizesample(LS, 0, b1.is, b2.ro[LS]);	if (inputstereo) {	    layer3part2start = bitwindow.gettotalbit();	    layer3getscalefactors_2(RS);	    layer3huffmandecode(RS, 0, b1.is);	    layer3dequantizesample(RS, 0, b1.is, b2.ro[RS]);	}	layer3fixtostereo(0, b2.ro);	// b2.ro -> b2.lr	currentprevblock ^= 1;	layer3reorderandantialias(LS, 0, b2.lr[LS], b1.hin[LS]);	layer3hybrid(LS, 0, b1.hin[LS], b2.hout[LS]);	if (outputstereo) {	    layer3reorderandantialias(RS, 0, b2.lr[RS], b1.hin[RS]);	    layer3hybrid(RS, 0, b1.hin[RS], b2.hout[RS]);	    register int i = 2 * SSLIMIT * SBLIMIT - 1;	    do {		NEG(b2.hout[0][0][i - 16]);		NEG(b2.hout[0][0][i - 18]);		NEG(b2.hout[0][0][i - 20]);		NEG(b2.hout[0][0][i - 22]);		NEG(b2.hout[0][0][i - 24]);		NEG(b2.hout[0][0][i - 26]);		NEG(b2.hout[0][0][i - 28]);		NEG(b2.hout[0][0][i - 30]);	    } while ((i -= 2 * SBLIMIT) > 0);	} else {	    register int i = SSLIMIT * SBLIMIT - 1;	    do {		NEG(b2.hout[0][0][i - 16]);		NEG(b2.hout[0][0][i - 18]);		NEG(b2.hout[0][0][i - 20]);		NEG(b2.hout[0][0][i - 22]);		NEG(b2.hout[0][0][i - 24]);		NEG(b2.hout[0][0][i - 26]);		NEG(b2.hout[0][0][i - 28]);		NEG(b2.hout[0][0][i - 30]);	    } while ((i -= 2 * SBLIMIT) > 0);	}	for (int ss = 0; ss < SSLIMIT; ss++)	    subbandsynthesis(b2.hout[LS][ss], b2.hout[RS][ss]);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -