📄 srscoeff.h
字号:
//=====================================================================
// (c)1996-2000 Copyright LuxSonor Semiconductors Inc.,
// All rights reserved !!!
// File name: <SRScoeff.h>
// Circle Surround coefficients !
// Target Processor: LS500 DSP Processor
// Target System: ISA Board/Stand Alone Machine.
//
// $Initial Version: Corin Chen
// Richard Huang
// Tan Chou
//
//=====================================================================
.nolist
.list
//#include "cs56k.h" // CS equates
//========================================
// Variables and pointers assignment
//========================================
#define SRS_LOCAL_BASE 0x0
/* The following local mem need to be inited to 0 */
#define Lhcsflag %(SRS_LOCAL_BASE) // CS Flag, change this for different modes
#define Lhini_flag %(SRS_LOCAL_BASE+0x02) // Initialization flag
#define saierror %(SRS_LOCAL_BASE+0x04) // evm sai errors
//#define hp480L %(SRS_LOCAL_BASE+0x08) // High passed Filtered output, 480Hz L - Steering path
//#define hp480R %(SRS_LOCAL_BASE+0x0c) // High passed Filtered output, 480Hz R - Steering path
//#define hp16kL %(SRS_LOCAL_BASE+0x10) // High passed Filtered output, 16K L - Steering path
//#define hp16kR %(SRS_LOCAL_BASE+0x14) // High passed Filtered output, 16K R - Steering path
//#define hp480LMR %(SRS_LOCAL_BASE+0x18) // High passed Filtered output, 480 L-R - Steering path
//#define hp480LPR %(SRS_LOCAL_BASE+0x1c) // High passed Filtered output, 480 L+R - Steering path
#define hblogdif %(SRS_LOCAL_BASE+0x20) // 0,High band log difference
#define lblogdif %(SRS_LOCAL_BASE+0x24) // Low bandlog difference
#define fblogdif %(SRS_LOCAL_BASE+0x28) // Frontback log difference
#define rearLPfiltstat %(SRS_LOCAL_BASE+0x2c) // y(n-1) for low pass
#define rearHPfiltstat %(SRS_LOCAL_BASE+0x30) // y(n-1) for high pass
#define hb1v10db %(SRS_LOCAL_BASE+0x34) // high band log diff 1v/10db
#define lb2v10db %(SRS_LOCAL_BASE+0x38) // low band log diff 2v/10db
#define fb2v10db %(SRS_LOCAL_BASE+0x3c) // frontback log diff 2.4v/10db
#define tccntl %(SRS_LOCAL_BASE+0x40) // time const. control voltage
#define hbtcout %(SRS_LOCAL_BASE+0x44) // Highband Timeconst filt out
#define lbtcout %(SRS_LOCAL_BASE+0x48) // Lowband Timeconst filt out
#define fbtcout %(SRS_LOCAL_BASE+0x4c) // Frontback Timeconst filt out
#define Cv %(SRS_LOCAL_BASE+0x50) // Cv signal
#define Sv %(SRS_LOCAL_BASE+0x54) // Sv signal
#define Bv %(SRS_LOCAL_BASE+0x58) // Bv signal
#define Lha %(SRS_LOCAL_BASE+0x5c) // Left Surround high band attenuation
#define Rha %(SRS_LOCAL_BASE+0x60) // Right Surround high band attenuation
#define Lla %(SRS_LOCAL_BASE+0x64) // Left Surround low band attenuation
#define Rla %(SRS_LOCAL_BASE+0x68) // Right Surround low band attenuation
#define Frv %(SRS_LOCAL_BASE+0x6c) // Front Right Voltage
#define Flv %(SRS_LOCAL_BASE+0x70) // Front Left Voltage
#define RLatt %(SRS_LOCAL_BASE+0x74) // R/L signal
#define vca1 %(SRS_LOCAL_BASE+0x78)
#define vca2 %(SRS_LOCAL_BASE+0x7c)
#define vca34 %(SRS_LOCAL_BASE+0x80)
#define vca5 %(SRS_LOCAL_BASE+0x84)
#define vca6 %(SRS_LOCAL_BASE+0x88)
#define vca7 %(SRS_LOCAL_BASE+0x8c)
#define vca8 %(SRS_LOCAL_BASE+0x90)
#define vca09 %(SRS_LOCAL_BASE+0x94) // Vcas 9,10
#define vca10 %(SRS_LOCAL_BASE+0x98) // Vcas 11,12
#define vca11 %(SRS_LOCAL_BASE+0x9c) // Vcas 9,10
#define vca12 %(SRS_LOCAL_BASE+0xa0) // Vcas 11,12
#define rearxstat %(SRS_LOCAL_BASE+0xa4)
#define x1ctfilt %(SRS_LOCAL_BASE+0xa8)
#define x1L1filt %(SRS_LOCAL_BASE+0xac)
#define x2L1filt %(SRS_LOCAL_BASE+0xb0)
#define x1L2filt %(SRS_LOCAL_BASE+0xb4)
#define x2L2filt %(SRS_LOCAL_BASE+0xb8)
#define x1R1filt %(SRS_LOCAL_BASE+0xbc)
#define x2R1filt %(SRS_LOCAL_BASE+0xc0)
#define x1R2filt %(SRS_LOCAL_BASE+0xc4)
#define x2R2filt %(SRS_LOCAL_BASE+0xc8)
#define lastcenterval %(SRS_LOCAL_BASE+0xcc)
#define CTSW_sub_past1 %(SRS_LOCAL_BASE+0xd0)
#define CTSW_sub_past2 %(SRS_LOCAL_BASE+0xd4)
#define delaypointer %(SRS_LOCAL_BASE+0xd8)
#define LpR2_past1 %(SRS_LOCAL_BASE+0xdc)
#define LpR2_past2 %(SRS_LOCAL_BASE+0xe0)
#define subfilt_lowpass5_past1 %(SRS_LOCAL_BASE+0xe4)
#define subfilt_lowpass5_past2 %(SRS_LOCAL_BASE+0xe8)
#define subfilt_lowpass6_past1 %(SRS_LOCAL_BASE+0xec)
#define subfilt_lowpass6_past2 %(SRS_LOCAL_BASE+0xf0)
#define Log_a0 (SRS_LOCAL_BASE+0xf4)
#define Log_a1 (SRS_LOCAL_BASE+0xf8)
#define Log_a2 (SRS_LOCAL_BASE+0xfc)
//#define L_lastvalue_16k %(SRS_LOCAL_BASE+0xf4)
//#define R_lastvalue_16k %(SRS_LOCAL_BASE+0xf8)
//#define L_lastvalue_480 %(SRS_LOCAL_BASE+0xfc)
//#define R_lastvalue_480 %(SRS_LOCAL_BASE+0x100)
//#define LMR_lastvalue %(SRS_LOCAL_BASE+0x104)
//#define LPR_lastvalue %(SRS_LOCAL_BASE+0x108)
#define storedataptr %(SRS_LOCAL_BASE+0x10c)
#define in_Mat_ptr %(SRS_LOCAL_BASE+0x110)
//===========================================================
// Variable Time constant filter - coefft calculation
//===========================================================
// Low and high ends of the Time constant control voltage
#define vartclow %(SRS_LOCAL_BASE+0x114)
#define vartchigh %(SRS_LOCAL_BASE+0x118)
// Coefficient Evaluation (slope and intercept) - high band signal path
#define hbslope %(SRS_LOCAL_BASE+0x11c)
#define hpinter %(SRS_LOCAL_BASE+0x120)
// Coefficient Evaluation (Slope and intercept) - lowband/frontback signal path
#define lofbslope %(SRS_LOCAL_BASE+0x124)
#define lofbinter %(SRS_LOCAL_BASE+0x128)
// Evaluated Coefficients - High band
#define hba1 %(SRS_LOCAL_BASE+0x12c)
#define hbb0 %(SRS_LOCAL_BASE+0x130)
// Evaluated Coefficients - Low band / Front back
#define lofba1 %(SRS_LOCAL_BASE+0x134)
#define lofbb0 %(SRS_LOCAL_BASE+0x138)
// Exponential Ratio circuit - Coefficients
#define exprcoeff1 %(SRS_LOCAL_BASE+0x13c)
#define exprcoeff2 %(SRS_LOCAL_BASE+0x140)
#define exprcoeff3 %(SRS_LOCAL_BASE+0x144)
// Variable Multiplier Control parameters
#define vmlowend %(SRS_LOCAL_BASE+0x148)
#define vmupend %(SRS_LOCAL_BASE+0x14c)
#define vminter %(SRS_LOCAL_BASE+0x150)
#define vmslope %(SRS_LOCAL_BASE+0x154)
#define multval %(SRS_LOCAL_BASE+0x158)
// Rear Audio Path filters - 2KHz - low and high pass
#define l1p2k_1 %(SRS_LOCAL_BASE+0x15c)
#define l1p2k_2 %(SRS_LOCAL_BASE+0x160)
#define h1p2k_1 %(SRS_LOCAL_BASE+0x164)
#define h1p2k_2 %(SRS_LOCAL_BASE+0x168)
// Sub Woofer Path filters - 80Hz - low pass II order
#define l2p80_1 %(SRS_LOCAL_BASE+0x16c)
#define l2p80_2 %(SRS_LOCAL_BASE+0x170)
#define l2p80_3 %(SRS_LOCAL_BASE+0x174)
#define l2p80_4 %(SRS_LOCAL_BASE+0x178)
// Center Channel - 100 Hz high pass I order filter
#define h1p100_1 %(SRS_LOCAL_BASE+0x17c)
#define h1p100_2 %(SRS_LOCAL_BASE+0x180)
// Front Left, Right filters - 200Hz - low pass II order
#define l2p200_1 %(SRS_LOCAL_BASE+0x184)
#define l2p200_2 %(SRS_LOCAL_BASE+0x188)
#define l2p200_3 %(SRS_LOCAL_BASE+0x18c)
#define l2p200_4 %(SRS_LOCAL_BASE+0x190)
//#define h1p16k_1 %(SRS_LOCAL_BASE+0x194)
//#define h1p16k_2 %(SRS_LOCAL_BASE+0x198)
// 480Hz high pass filter Coefficients
//#define h1p480_1 %(SRS_LOCAL_BASE+0x19c)
//#define h1p480_2 %(SRS_LOCAL_BASE+0x1a0)
// 32Hz Low pass filter Coefficients
#define l1p32_1 %(SRS_LOCAL_BASE+0x1a4)
#define l1p32_2 %(SRS_LOCAL_BASE+0x1a8)
// 16Hz Low pass filter Coefficients
//#define l1p16_1 %(SRS_LOCAL_BASE+0x1ac)
//#define l1p16_2 %(SRS_LOCAL_BASE+0x1b0)
// Center and Surround scaling coefficients
#define cscale %(SRS_LOCAL_BASE+0x1b4)
#define sscale %(SRS_LOCAL_BASE+0x1b8)
//begin/end adress in DRAM of delay buffer
#define srs_dram 0x6000
#define delaybuffer_size (SAMPLEFREQ*MAXDELAY) // by words
#define delaybuffer_start srs_dram
#define delaybuffer_end srs_dram+(SAMPLEFREQ*MAXDELAY*4)-4
// Blocksize definiton
#define BLOCKSIZE 16
#define ARRAYSIZE 32
// Bits in CSFLAG to be tested in main code ( 1 / 0 )
#define CENTER 0 // center/phantom
// Bit 0 in csflag corresponds to center if set or phantom if reset
#define MUSIC 1 // music/movie
#define WIDE 2 // wide/narrow
#define SURROUND525 3 // 525 on/off
#define NOISE 4 // noise on/off
#define MAXREARDELAY 31.0 // ms
#define ONEVOLT 0x0006a4d3 //0.051905 log2(10.0)/64.0
#define MAXVCAINDEX 512
#define MAXVCAATTEN -80.0 // table[MAXVCAINDEX]=-80.0 dB
#define MINUS10INDEX (-10.0*MAXVCAINDEX/MAXVCAATTEN)
#define VCACONST 0x0000003f //0.000008 MINUS10INDEX*@pow(2.0,-23.0)
#define VCA2000 0x00000268 //0.000073 @frc(VCACONST/(2.0*ONEVOLT))
#define VCA1250 0x000003da //0.000118 @frc(VCACONST/(1.25*ONEVOLT))
#define VCA1100 0x00000460 //0.000134 @frc(VCACONST/(1.1*ONEVOLT))
#define VCA1000 0x000004d1 //0.000147 @frc(VCACONST/(1.0*ONEVOLT))
#define VCA0680 0x00000715 //0.000216 @frc(VCACONST/(0.68*ONEVOLT))
#define VCA0580 0x0000084d //0.000253 @frc(VCACONST/(0.58*ONEVOLT))
#define VCA0500 0x000009a2 //0.000294 @frc(VCACONST/(0.5*ONEVOLT))
#define VCA0185 0x00001a08 //0.000795 @frc(VCACONST/(0.185*ONEVOLT))
#define NOISE_BUFFER_LEN 32 // @cvi(@pow(2.0,NOISE_BUFFER_POWER))
//========================================
// Buffer Assignment
//========================================
#define SRS_BUFFER_BASE 0x200
//
//Output Data Buffers, 16 bits each channel
//
#define LFRF SRS_BUFFER_BASE //0x200, Left and Right front output buffers
#define CTSW LFRF+(BLOCKSIZE*4) //0x240, Center and Subwoofer output buffers
#define LSRS CTSW+(BLOCKSIZE*4) //0x280, Left and Right Surround output buffers
//
//Steering Data Buffers
//
#define L16k LSRS+(BLOCKSIZE*4) //0x2c0, Buffer for L - 16kHz HP
#define R16k L16k+(BLOCKSIZE*4) //0x300, Buffer for R - 16kHz HP
#define L480 R16k+(BLOCKSIZE*4) //0x340, Buffer for L - 480Hz HP
#define R480 L480+(BLOCKSIZE*4) //0x380, Buffer for R - 480Hz HP
#define LMR480 R480+(BLOCKSIZE*4) //0x3c0, Buffer for L-R - 480Hz HP
#define LPR480 LMR480+(BLOCKSIZE*4) //0x400, Buffer for L+R - 480Hz HP
//SubWoofer audio path buffer
#define subfilt LPR480+(BLOCKSIZE*4) //0x440, Buffer for subwoofer filter
//Rear Audio path Buffers
#define RearLPfilt subfilt+(BLOCKSIZE*4) //0x480, Buffer for Low/High pass filters reserved for #define Rearfilt LMPR480+BLOCKSIZE*4 // Buffer for Low/High pass filters
#define RearHPfilt RearLPfilt+(BLOCKSIZE*4)//0x4c0, Buffer for Low/High pass filters reserved for #define Rearfilt LMPR480+BLOCKSIZE*4 // Buffer for Low/High pass filters
//Front left, right channel audio path buffers
#define vca1buffer RearHPfilt+(BLOCKSIZE*4) //0x500
#define vca2buffer vca1buffer+(BLOCKSIZE*4) //0x540
#define Lfiltbuffer vca2buffer+(BLOCKSIZE*4) //0x580
#define Rfiltbuffer Lfiltbuffer+(BLOCKSIZE*4) //0x5c0
#define vca3buffer Rfiltbuffer+(BLOCKSIZE*4) //0x600
#define vca4buffer vca3buffer+(BLOCKSIZE*4) //0x640
//Center Channel audio path buffer
#define vca5buffer vca4buffer+(BLOCKSIZE*4) //0x680
//Rear audio path buffer
#define vca8buffer vca5buffer+(BLOCKSIZE*4) // 0x6c0
#define logdifLRhi vca8buffer+(BLOCKSIZE*4) //0x700, Log dif of L,R 16k filtered
#define logdifLRlo logdifLRhi+(BLOCKSIZE*4) //0x740, Log dif of L,R 480Hz filtered
#define logdifLMPR logdifLRlo+(BLOCKSIZE*4) //0x780, Log dif of L-R,L+R 480Hz filtered
//
//Input Matrix Buffers
//
#define L logdifLMPR+(BLOCKSIZE*4)//0x7c0,Left
#define R L+(BLOCKSIZE*4) //0x800,Right
#define LMR R+(BLOCKSIZE*4) //0x840,L-R
#define LPR LMR+(BLOCKSIZE*4) //0x8c0,L+R
#define AL LPR+(BLOCKSIZE*4) //0x900,-L
#define AR AL+(BLOCKSIZE*4) //0x940,-R
//
//=============================
// Other Variables Definition
//=============================
#define local_iir_filter_byte 0xf00 // for 5 filter coefficients
//#define local_iir_filter_word 0x780 // 0x780 *4 =0x1e00
// Log2 coefficients
#define poly_a0 0xFFAB2F94 //0xAB2F -.6626105
#define poly_a1 0x007FC4E1 //0x7FC4 .9981958
#define poly_a2 0xFFD4D5E6 //0xD4D5 -.3372223
#define h1p16k_1 %(SRS_LOCAL_BASE+0x1c00)
#define h1p16k_2 %(SRS_LOCAL_BASE+0x1c04)
#define iir_h1p16k_1 (SRS_LOCAL_BASE+0x1c00)
#define iir_h1p16k_2 (SRS_LOCAL_BASE+0x1c04)
// 480Hz high pass filter Coefficients
#define h1p480_1 %(SRS_LOCAL_BASE+0x1c08)
#define h1p480_2 %(SRS_LOCAL_BASE+0x1c0c)
#define iir_h1p480_1 (SRS_LOCAL_BASE+0x1c08)
#define iir_h1p480_2 (SRS_LOCAL_BASE+0x1c0c)
// 16Hz Low pass filter Coefficients
#define l1p16_1 %(SRS_LOCAL_BASE+0x1c10)
#define l1p16_2 %(SRS_LOCAL_BASE+0x1c14)
#define iir_l1p16_1 (SRS_LOCAL_BASE+0x1c10)
#define iir_l1p16_2 (SRS_LOCAL_BASE+0x1c14)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -