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

📄 interp.s

📁 关于DVD的MPEG2用的DSP代码,在DSP的实现MPEG的压缩,解压算法.
💻 S
字号:
;********************************************************************
;
; (c)1997 Copyright LuxSonor, Inc. All rights reserved
;
; Revision 1.0
;
;	
;	Module:	AUDIO code
;
;	Initial version:Cecile Foret, August 1997
;			Jinshi Huang 12/1/98 for LS388/LS500 
;	Previously = rate2.S
;	This routine performs the rate conversion from 11kH to 44kH, for 
;	the microphone input.
;
;	return adress to main routine: r11
;	returns: none, the decimated sequence will be written in local memory
;	input  : r2, input adress for micro sequence
;	loading of micro input sequence is done outside this subroutine 
;	input sequence is located at adress local_micro_in
;	output sequence after interpolation is located at local_micro_out
;	change the order of filter coefficients (increment probleme ) 
;*********************************************************************
	.nolist
#include "regdef2.h"
#include "stereo_user.h"
#include "memory2.h"
#include "user2.h"
	.list
	
	.data
	.global	SUB_rate


SUB_rate:
;******* load the history of the filter in local memory *************
;		movi	StartAddrHigh, 0x7
		movi	StartAddrHigh, DataSeg	// 10-13-98

#ifdef	EFFECT
		movi	DMASize, 15		; history =31 coefficients
		movi	LocalAddr, (localB_history)>>2
						; sets the location in local memory
		movi	r20, rate_hist
		shr	r20, 2
		dmarr	r20		; adress in DRAM for history
		WaitDma
#else	//EFFECT
		movi	ByteSize, 0x3c		; history =31 coefficients
		movi	ByteLocal,localB_history
						; sets the location in local memory
		dmabr	rate_hist		; adress in DRAM for history
#endif	//EFFECT

;******* set up the AGRAdr ******************************************
		movi	AGRAdr0, local_rate_filter; pointer on filter coefficients
		movi	AGRSiz0, 0xfe		; 128 coefficients, circular buffer
		movi	AGRInc0, 0x8		; increments by 4 (skip 3 coeff).

#ifdef	EFFECT
		movi	AGRAdr4, local_micro_in	; pointer on the history and input seq
		movi	AGRSiz4, 0xffff
		movi	AGRMod4, 0	
		movi	AGRInc4, 0x40		; increments by 32 
#else	//EFFECT
		movi	AGRAdr2, local_micro_in; pointer on the history and input seq
		movi	AGRSiz2, 0xffff	
		movi	AGRInc2, 0x40		; increments by 32 
#endif	//EFFECT
		movi	AGRAdr3, local_micro_out	;pointer on the output sequence.
		movi	AGRSiz3, 0xffff	
		movi	AGRInc3, 0x2		; increments by one 
//********************************************************************		
#if	1					// Turn on to do decim---interp loop		
//------------- bypass reverb ? --------------------------------------
		movi	DcacheBase,MEM_SEG
		nop
		nop
		dlw	r0,USER_ICFG
		nop
		andi	r0,ICFG_REVERB_BYPASS_MASK
		tsti	r0,ICFG_REVERB_BYPASS_MASK
		bne	no_reverb1
//--------------------------------------------------------------------
		movi	AGRAdr2, local_DL1FB; get immediately back from decimation
		movi	AGRSiz2, 0xffff	
		loop	32, copy_to_microin
		mov		r2,a2(4)
		mov		a4(4),r2
copy_to_microin:
		movi	AGRAdr4, local_micro_in	; pointer on the history and input seq
no_reverb1:
#endif
;******* process a block of 64 samples ********************************
		movi	r2, 64
micro_block:
;******* use set 0,1,2,3 of filters with same current data ************ 	
;******* deseable interrupt *********
		movi	TrapReg, 0x0
		nop
		nop

		loop	3, filter_sets
#ifdef	EFFECT
		mulhf	r0, i0, a4(-2)		; current sample 
		loop	30, current_set
		maddhf	r0, i0, a4(-2)
current_set:
		maddhf	r0, i0, a4(62)		; go back to beginning of history
		nop
#else	//EFFECT
		mulhf	r0, i0, a2(-2)		; current sample 
		loop	30, current_set
		maddhf	r0, i0, a2(-2)
current_set:
		maddhf	r0, i0, a2(62)		; go back to beginning of history
		nop
#endif	//EFFECT
		rndhf	i3, r0				; output sample

		movhf	r0, a0(2)			; go to the next filter set !
filter_sets:

;******* enable interrupt **********
		movi	TrapReg, 0x24

; last set of filter
#ifdef	EFFECT
		mulhf	r0, i0, a4(-2)		; current sample
#else	//EFFECT
		mulhf	r0, i0, a2(-2)		; current sample
#endif	//EFFECT
	
;******* deseable interrupt ********
		movi	TrapReg, 0x0
		nop
		nop
 
		loop	30, last_set
#ifdef	EFFECT
		maddhf	r0, i0, a4(-2)
last_set:
		maddhf	r0, i4, a0(2)		; update history of the filter sets !
						; and go back to first filter set !
		nop
#else	//EFFECT
		maddhf	r0, i0, a2(-2)
last_set:
		maddhf	r0, i2, a0(2)		; update history of the filter sets !
						; and go back to first filter set !
		nop
#endif	//EFFECT
	
		rndhf	i3, r0				; output sample

;******** enable interrupt **********
		movi	TrapReg, 0x24

		subi	r2, 0x1				; decrements the counter
#ifdef	EFFECT
		bne		micro_block
#else	//EFFECT
		bnz		micro_block
#endif	//EFFECT

;******** save the history of the rate filter back in DRAM ****************
;******** history =last 31 samples ****************************************
;		movi	StartAddrHigh, 0x7
		movi	StartAddrHigh, DataSeg	// 10-13-98

#ifdef	EFFECT
		movi	DMASize, 15		; history =31 coefficients
		movi	LocalAddr, (local_last_history)>>2
							; sets the location in local memory
		movi	r20, rate_hist
		shr	r20, 2
		dmawr	r20			; adress in DRAM for history
		WaitDma
#else	//EFFECT
		movi	ByteSize, 0x3c		; history =31 coefficients
		movi	ByteLocal,local_last_history
							; sets the location in local memory
		dmabw	rate_hist			; adress in DRAM for history
#endif	//EFFECT		



		j		r11				; go back to main routine





⌨️ 快捷键说明

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