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

📄 decimdct.s

📁 samsung 9908DVD源代码,
💻 S
📖 第 1 页 / 共 3 页
字号:
;-----------------------------------------------------------
;		The following program will decode MP3 bitstream
;		by S/W Algorithm
;			File Name: decimdct.s
;			copyright jj,Park      1999.2.7
;
;	profile
;		1. 5/25//1999
;			-updated
;		2. 5/30//1999
;			- Correct a Short_block butterfly
;		3. 5/31//1999
;			- Correct a long_block butterfly
;-----------------------------------------------------------
.include	"mp3_def.h"
.include	"mp3_ext.h"

		MP3DecimdctSection			
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;	ptr_imdctWindow					IMDCT window coeficients
;									according to block types
;	ptr_imdctInputBuffer			the starting pointer of input data for imdct
;									ptr_imdctInputBuffer = ch0'ptr_imdctOutputBuffer+18
;	ptr_imdctOutputBuffer			the starting pointer of resulting output data
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DecodingIMDCT::
	eld		b		,#tbl_imdctBlock0	
	eld		a		,rpd0.index_blockType					;b[23:16]<-windowSwitchingFlag
															;b[15:8]<-blockType
															;b[7:0]<-mixedBlockFlag	
	ecld	r3		,a			
	srb		r3												;r3<-blockType	
	cmp		eq		,r3		,#0								;check block 0	
	brt		ImdctBlockCheckEnd
	
	eadd	b		,#36
	cmp		eq		,r3		,#1
	brt		ImdctBlockCheckEnd
	
	eadd	b,		#36
	cmp		eq		,r3		,#3
	brt		ImdctBlockCheckEnd
ImdctBlockCheckEnd	
	eld		rpd1.index_LptrImdctWindow,	b
	
	eld		b		,#Area_imdctPrevCh0	
	ldb		r0		,@[a13+Index_ChannelLoop]
	cmp		eq		,r0		,#0
	brf		imdct_ch
	eld		b		,#Area_imdctPrevCh1		
imdct_ch								
	eld		rpd1.index_LptrImdctprevious	,b								
	eld		c		,rpd1.index_GptrCurrentDecodingData
	eld		rp0		,c
	eld		c		,rp0
	eld		rpd1.index_LRPxBackupBuffer		,c				;ptr_imdctInputBuffer[0]
															;points nextinputs..
	ld		r7		,#31									;the size of subband
	xor		r3		,#const_shortBlock						;r3<-block_type^02
	ecld	r2		,ah										;r2<-windowSwitchingFlag
	ecld	r0		,a										;r0<-mixedBlockFlag
	and		r0		,#0xff
	and		r2		,r0
	cmp		eq		,r2		,r3	
	brt		DecodingImdctShort	
DecodingImdctSubbandLoop
	eld		b		,#tbl_imdctBlock0
DecodingImdctShortSubbandLoop2	
	eld		c		,rpd1.index_LRPxBackupBuffer				;imdctInputBuffer[i]
	eld		rp0		,c

	ld		r0		,#28
	cmpu	ge		,r0		,r7
	brf		bran_long		

	cmp		eq		,r2		,#0
	brf		DecodingImdctShort
bran_long
	push	a14
	jsr		DecodingImdctLong
	pop		a14
	
	eld		c		,rp1
	bnzd	r7		,DecodingImdctSubbandLoop
	eld		rpd1.index_LptrImdctprevious	,c				;+18

	ret
;--------------------seperate even-odd-----------------------
;for i=0;i<3;++i
;{
;	x[15+i] += x[12+i];
;	x[12+i] + x[9+i];
;	x[9+i] += x[6+i];
;	x[6+i] += x[3+i];
;	x[3+i] += x[i];
;	x[15+i] += x[9+i];
;	x[9+i] += x[3+i];
;}
;
;	index_LptrImdctprevious points a sb*18
;	b is used as previous pointer at window loop
;
;			d1	d0	 s1	  s0
;	sd0  = xx | 3  | 3  | 0
;	sd1  = xx | 1  | xx | xx
;	sd2  = xx | xx | xx | xx
;	sd3  = xx | xx | xx | xx
;
;			d1	d0	 s1	  s0
;	sd0  = -3 | 3  | 3  | 0
;	sd1  = xx | 1  | xx | xx
;	sd2  = xx | xx | xx | xx
;	sd3  = xx | xx | xx | xx
;
;		The all window result are overlaped&added form Area_imdctTempBuffer2 to+24
;
;
;------------------------------------------------------------
DecodingImdctShort:
	eld		sd1		,#((-1&0fh)<<12)|(1<<8)|((-1&0fh)<<4)|(1<<0)
	eld		rp1		,#Area_imdctTempBuffer2
	eld		a		,#0

	ld		r6		,#5
cls_temp
	bnzd	r6		,cls_temp	
	eld		@rp1+d0	,a										;clear temp buffer[6]
															;because of overlap&add	
DecodingImdctShortSubbandLoop
	eld		b		,#Area_imdctTempBuffer2+8
	ld		r6		,#2										;the size of window	
DecodingImdctShortWindowLoop
	eld		sd0		,#((0&0fh)<<12)|(3<<8)|((3&0fh)<<4)|(0<<0)	

	eld		a		,@rp0+s1									;a<-x[0], rp0=&x[3]	
	eld		ma0		,@rp0									;ma0<-x[3]
	eadd	a		,ma0										;a<-x[0]+x[3]
	eld		p		,a										;p<-updated x[3]	
	eld		a		,ma0		,@rp0+d0,a						;a<-x[3], x[3]<-x[0]+x[3],rp0=&x[6],(odd)
		
	eld		ma0		,@rp0									;ma0<-x[6]
	eadd	a		,ma0										;a<-x[3]+x[6]
	eld		a		,ma0		,@rp0+d0,a						;a<-ma0, x[6]<-x[6]+x[3] (even)
															;rp0=&x[9]								
															
	eld		ma0		,@rp0									;ma0<-x[9]	
	eadd	a		,ma0										;a<-x[6]+x[9]
	eld		x0		,a										;x0<-x[6]+x[9]
	eadd	a		,p										;a<-x[6]+x[9]+updated x[3]
	eld		a		,ma0		,@rp0+d0,a						;a<-x[9],x[9]<-x[6]+x[9]+updated x[1] (odd)
	
	eld		ma0		,@rp0									;ma0<-x[12]
	eadd	a		,ma0										;a<-x[9]+x[12]
	eld		a		,ma0		,@rp0+d0,a						;a<-ma0,x[12]<-x[9]+x[12] (even)
	
	eld		c		,@rp0									;a<-x[12]+x[15]
	eadd	a		,c										;a<-x[12]+x[15]
	eadd	a		,x0										;a<-x[12]+x[15]+updated x[9]
	eld		@rp0+d1	,a										;x[15]<-x[12]+x[15]+updated x[9] (odd)
	
;--------------------- imdct-------------------------
;
;
;			rp0		In		(ptr_imdctInputBuffer+sb*18)+15+win
;
;			pp1 = X[6+window] * twid[0];
;			sum = X[window] + X[12+window] * twid[1];
;			t[1] = X[window] - X[12+window];
;			t[0] = sum + pp1;
;			t[2] = sum - pp1;
;
;			/* 3x3 IDCT for odd part */
;			pp1 = X[9+window] * twid[0];
;			sum = X[3+window] + X[15+window] * twid[1];
;			t[4] = X[3+window] - X[15+window];
;			t[5] = sum + pp1;
;			t[3] = sum - pp1;
;
;			d1	d0	 s1	  s0
;	sd0  = xx | 9  | -6 | 0
;	sd1  = xx | xx | xx | xx
;	sd2  = -1 | xx | xx | xx
;	sd3  = xx | xx | xx | 1
;
;			d1	d0	 s1	  s0
;	sd0  = -1 | 9  | -6 | 0
;	sd1  = -1 | 1  |  1 | 0
;	sd2  = -1 | 1  |  1 | 0
;	sd3  = -1 | 1  | -1 | 1
;------------------------------------------------------------
	eld		rp2		,#Area_imdctTempBuffer1+5
	eld		rp1		,rp2										;for next use(butterfly)
	eld		rp3		,#tbl_twiddlesShort
	
	eld		sd0		,#((-1&0fh)<<12)|(9<<8)|((-6&0fh)<<4)|(0<<0)
	eld		sd1		,#((-1&0fh)<<12)|(1<<8)|(( 1&0fh)<<4)|(0<<0)
	eld		sd2		,sd1
	eld		sd3		,#((-1&0fh)<<12)|(1<<8)|((-1&0fh)<<4)|(1<<0)	
;odd IMDCT matrix 3x3
	eld		x0		,@rp0+s1,y0		,@rp3+s0				;x0<-x[15+win], y0<-c[0]
	emul	x0y0	,x1		,@rp0+s1,y1		,@rp3+s0		;p<-x[15+win]*0.5
															;x1<-x[9+win], y1<-c[1]
	eld		ma0		,@rp0									;ma0<-x[3+win]
	emad	ma0		,x1y1									;		ma0a<-x[3+win]+x[15]*0.5
															;p<-x[9+win]*0.8660254037
	eadd	ma0		,p		,a		,@rp0							;ma0<-x[3+win]+x[15+win]*0.5+x[9+win]*0.8660254037
															;a<-x[3+win]
	esub	ma0		,p		,@rp2+d1,ma0						;ma0<-x[3+win]+x[15+win]*0.5
															;save t[5]
	esub	a		,x0										;a<-x[3+win]-x[15+win]
	esub	ma0		,p		,@rp2+d1,a						;ma0<-x[3]-x[9]*0.8660254037+x[15]*0.5
															;save t[4]
	eld		@rp2+d1	,ma0										;save x[3]

	erpn	rp0		,#9										;rp0 points x[12+win]
	eld		rp2		,#Area_imdctTempBuffer1
	
;even IMDCT matrix 3x3
	eld		x0		,@rp0+s1								;x0<-x[12+win], y0:c[0]
	emul	x0y0	,x1		,@rp0+s1						;p<-x[12+win]*c[0]=x[12+win]*0.5
															;x1<-x[6], y1:c[1]
	eld		ma0		,@rp0									;ma0<-x[0]
	emad	ma0		,x1y1											;p<-x[12]*0.5
	eadd	ma0		,p		,a		,@rp0					;ma0<-x[0]+x[6]*0.8660254037+x[12]*0.5,a<-x[0]
	esub	ma0		,p		,@rp2+d0,ma0						;ma0<-x[0]+x[12]*0.5
															;save t[0]
	esub	a		,x0										;a<-x[0]-x[12]
	esub	ma0		,p		,@rp2+d0,a						;ma0<-x[0]-x[6]*0.8660254037
															;+x[12]*0.5
															;save t[1]
	eld		@rp2+d1	,ma0										;save t[2]
															;rp2 points &t[1]
	erpd	rp2+d1
;-----------------------butterfly----------------------------
;
;for i=0;i<3;++i
;{
;	temp = t[i];
;	t[i] += t[5-i]*coeficient;
;	t[5-i] = temp-t[5-i]*coeficient;
;}
;
;			d1	d0	 s1	  s0
;	sd0  = -1 | xx | xx | 0
;	sd1  = xx | xx | xx | xx
;	sd2  = xx | 1  | xx | xx
;	sd3  = xx | xx | xx | 1
;
;			d1	d0	 s1	  s0
;	sd0  = -1 | 9  | -6 | 0
;	sd1  = -1 | 1  |  1 | 0
;	sd2  = -1 | 1  |  1 | 0
;	sd3  = -1 | 1  | -1 | 1
;------------------------------------------------------------
	eld		rp0		,rp1									;rp1:Area_imdctTempBuffer1+5
															;rp0 points t[5]
															;rp2 points t[0]
	eld		rp1		,rp2									;for next use(reordering)
	
	eld		x0		,@rp0	,y0		,@rp3+s0				;y0<- (-co[0])
	eld		ma0		,@rp2									;ma0<-t[0]	
	emul	x0y0											;p<- t[5]*(-co[0])
	eadd	ma0		,p		,y0		,@rp3+s0				;ma0<-t[0]-t[5]*co[0], y0<-(-co[1])	
	esub	ma0		,p		,@rp0+d1,ma0						;save to t[5], ma0<-t[5]*co[0]
	esub	ma0		,p		,x0		,@rp0					;ma0<-t[0]+t[5]*co[0], x0<-t[4]
	ernd	ma0
	eld		@rp2+d0	,ma0										;save t[0]
	
	eld		ma0		,@rp2									;ma0<-t[1]
	emul	x0y0											;p<- t[4]*(-co[1])
	eadd	ma0		,p		,y0		,@rp3+s0				;ma0<-t[1]-t[4]*co[1], y0<-(-co[2])
	esub	ma0		,p		,@rp0+d1,ma0						;save to t[4], ma0<-t[4]*co[1]
	esub	ma0		,p		,x0		,@rp0					;ma0<-t[1]+t[4]*co, x0<-t[3
	ernd	ma0	
	eld		@rp2+d0	,ma0										;save t[1]		
	
	emul	x0y0											;p<- t[3]*(-co[2])
	emld	ma0		,x0y0	//ERROR eld		ma0,		p	
	esla	ma0												;rescaling ma0-register	
	eld		p		,ma0
	eld		ma0		,@rp2									;ma0<-t[2]	
	eadd	ma0		,p										;ma0<-t[1]-t[4]*co[1], y0<-(-co[2])
	esub	ma0		,p		,@rp0+d1,ma0						;save to t[3], ma0<-t[3]*co[2]
	esub	ma0		,p										;ma0<-t[2]+t[3]*co[2]
	ernd	ma0	
	eld		@rp2+d0	,ma0										;save t[2]	
;----------------------reordering 6-11----------------------
;
;for i=0;i<3;++i
;{
;	out[9+i] = in[i]*coeficient;
;	out[8-i] = in[i]*coeficient;
;}
;
;;-twid[5] * twid[11];0		-0.4000995771184
;-twid[5] * twid[12];1		-0.3070072035102
;-twid[6] * twid[13];2		-0.4999999995882
;-twid[6] * twid[14];3		-0.207106780933
;-twid[7] * twid[15];4		-0.6248444486463
;-twid[7] * twid[16];5		-0.08226233216023
;-twid[8] * twid[21];6		-0.8143131387164
;twid[8] * twid[22];7		 0.1072063583899
;-twid[9] * twid[20];8		-1.207106780633/2
;twid[9] * twid[17];9		 0.4999999995703
;-twid[10] * twid[19];10	-3.039058010327/4
;twid[10] * twid[18];11		 2.33195123018/4
;
;				rp0		In	Area_imdctTempBuffer1
;				rp1		In	Area_imdctTempBuffer1+9
;				rp2		In	Area_imdctTempBuffer1+8
;
;			d1	d0	 s1	  s0
;	sd0  = xx | xx | xx | 1
;	sd1  = xx | 1  | 1  | 0
;	sd2  = -1 | xx | 1  | 0
;	sd3  = xx | 1  | xx | 1
;
;			d1	d0	 s1	  s0
;	sd0  = -1 | 9  | -6 | 0
;	sd1  = -1 | 1  |  1 | 0
;	sd2  = -1 | 1  |  1 | 0
;	sd3  = -1 | 1  | -1 | 1
;
;	esd1	d0,		#1
;	esd2	d1,		#-1
;	Area_imdctTempBuffer2=Area_imdctTempBuffer1+6	
;------------------------------------------------------------
	esd0	s0		,#1
	eld		rp0		,rp1									;rp0 points Area_imdctTempBuffer1+0
	eld		rp2		,b										;rp2 points Area_imdctTempBuffer2+6*win+6+2
	eld		rp1		,b
	erpd	rp1+d0											;rp1 points Area_imdctTempBuffer2+6*win+6+3	
;overlap
	eld		x0		,@rp0+s0,y0		,@rp3+s0				;x0<-t[0], 	y0<-(-co[0])
	emul	x0y0	,y0		,@rp3+s0						;p<- -t[0]*co[0],y0<-(-co[1])
	eld		@rp2+d1	,p										;a[8]<- -t[0]*co[0]
	emul	x0y0	,x0		,@rp0+s0,y0		,@rp3+s0		;p<- -t[0]*co[1],
															;x0<-t[1],	y0<-(-co[2])
	eld		@rp1+d0	,p										;a[9]<- -t[0]*co[1]	
	
	
	emul	x0y0	,y0		,@rp3+s0						;p<- -t[1]*co[2],y0<-(-co[3])
	eld		@rp2+d1	,p										;a[7]<- -t[1]*co[2]	
	emul	x0y0	,x0		,@rp0+s0,y0		,@rp3+s0		;p<- -t[1]*co[3],
															;x0<-t[2],	y0<-(-co[4])
	eld		@rp1+d0	,p										;a[10]<- -t[1]*co[3]	
	

	emul	x0y0	,y0		,@rp3+s0						;p<- -t[2]*co[4],y0<-(-co[5])
	eld		@rp2+d1	,p										;a[6]<- -t[2]*co[4]
	emul	x0y0	,x0		,@rp0+s0,y0		,@rp3+s0		;p<- -t[2]*co[5],
															;x0<-t[3],	y0<-(-co[6])
	eld		@rp1	,p										;a[11]<- -t[2]*co[5]

	erpn	rp1		,#-12									;rp1 points Area_imdctTempBuffer2+6*win
;add
	eld		ma0		,@rp2+s0								;prev_a[5]
	emul	x0y0	,y0		,@rp3+s0						;p<- -t[3]*co[6],y0<-co[7]
	emad	ma0		,x0y0	,x0		,@rp0+s0,y0		,@rp3+s0;		ma0a<--t[3]*co[6]+prev_a[5],p<- t[3]*co[7],
															;x0<-t[4],	y0<-(-co[8])
	ernd	ma0
	eld		@rp2+d1	,ma0										;save a[5]

	eld		ma0		,@rp1+s0								;ma0<-prev_a[0]

⌨️ 快捷键说明

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