📄 mpa.h
字号:
/****************************************************************/
/* */
/* G L O B A L V A R I A B L E S */
/* */
/****************************************************************/
/* enum type ErrCode of decoder return value */
_DECODE_OK equ 0 /* decoding message */
_MPG_SYNC_NOT_FOUND equ 1
_EXT_SYNC_NOT_FOUND equ 2
_BASE_CRC_ERROR equ 3
_MC_CRC_ERROR equ 4
_AUG_CRC_ERROR equ 5
_EXT_CRC_ERROR equ 6
_CRC_RECOVERED equ 7
_ILLEGAL_LAYER equ 8
_ILLEGAL_MTX_MODE equ 9
_ILLEGAL_AUG_MTX_MODE equ 10
_ILLEGAL_DOWNMIX_MODE equ 11
_ILLEGAL_MC_PRED_MODE equ 12
_NO_MAIN_AUDIO_DATA equ 13
_NO_EXT_AUDIO_DATA equ 14
_END_OF_BITSTREAM equ 15
_NO_DRC_INFO_IN_STREAM equ 16
_INVALID_DRC_GAIN equ 17
_STREAM_IS_BROKEN equ 18
_SPDIF_BUF_OVERLAY equ 19
_END_OF_FILE equ 20
_UNKNOWN_ERROR equ -1 /* stream information */
MAX_ERROR_COUNT equ 10 /* if error count 10, return to system */
/* CodecShared_t parameter offset, pointer A10 */
_CodecStartFlag equ 0 ; char
_AudioMode equ 1 ; char
_pParameter equ 2 ; long
_NumberOfSample equ 6 ; int
_OutPCMSize equ 8 ; char
_DecodeErrFlag equ 9 ; char
_SamplingRate equ 10 ; long
_BitRate equ 14 ; long
_InputBufferOffset equ 18 ; long
_InputBufferSize equ 22 ; long
_OutputBufferOffset equ 26 ; long
_ExtInputBufferOffset equ 30 ; long
_FrameSize equ 34 ; int
_StreamBufOffset equ 36 ; long
/* MPA_Param_t variable offset, pointer _pParameter */
_Version equ 0 ; char
_CH_Mode equ 1 ; char
_LFE_Enable equ 2 ; char
_DRC_Mode equ 3 ; char
_CRC_Option equ 4 ; char
_EXT_Present equ 5 ; char
_CH_Content equ 6 ; char
/* MPEG decoder version */
_MPEG_1_AUDIO equ 0 /* mpeg audio stereo decoder */
_MPEG_2_AUDIO equ 1 /* mpeg audio 5.1-ch decoder */
_MPEG_2_AUG_AUDIO equ 2 /* mpeg audio 7.1-ch decoder */
/* listening output channel */
/* type defined MPA_Output_t in "Codec.h" */
_AUDIO_NULL equ 0
_MPEG1_MONO equ 1 /* mono and downmix channel */
_MPEG1_STEREO equ 2 /* stereo and downmix channel */
_MPEG2_5CH equ 3 /* 5.1-ch output and downmix */
_MPEG2_7CH equ 4 /* 7.1-ch output and downmix */
_MPEG2_DOWNMIX equ 5 /* downmix channel only */
_CHANNEL_TEST equ 6 /* All channels output, no downmix */
/* Input buffer pointer index */
_MPG_BUF_BASE equ 0 //SB0_BASE
_MPG_BUF_LIMIT equ 4 //MPG_BUF_BASE+INPUT_CHUNK_SIZE
_EXT_BUF_BASE equ 8 //MPG_BUF_LIMIT
_EXT_BUF_LIMIT equ 12 //EXT_BUF_BASE+INPUT_CHUNK_SIZE
_BS_MAIN equ 16 //EXT_BUF_LIMIT
_BS_EXTENSION equ 20 //BS_MAIN+MAX_BS_SIZE ; used of layer 1
_BS_MULTICHANNEL equ 24 //BS_EXTENSION+MAX_BS_SIZE
_BS_SPDIF_BASE equ 28 //SB0_BASE
/* Header Infomation (rpd0); decoder->header */
syncword equ 0
version equ 1
layer equ 2
protection_bit equ 3
bitrate_index equ 4
sampling_frequency equ 5
padding_bit equ 6
private_bit equ 7
mode equ 8
mode_extension equ 9
copyright equ 10
original equ 11
emphasis equ 12
crc_val equ 13
ext_stream_present equ 14
n_ad_bytes equ 15
center equ 16
surround equ 17
lfe equ 18
audio_mix equ 19
dematrix_procedure equ 20
no_of_multi_lingual_ch equ 21
multi_lingual_fs equ 22
multi_lingual_layer equ 23
copyright_ident_bit equ 24
copyright_ident_start equ 25
mc_crc_val equ 26
ext_syncword equ 27
ext_crc_val equ 28
ext_length equ 29
ext_ID equ 30
aug_crc_val equ 31
/* global variables (rpd0); decoder->layer */
frameNo equ 0
frame_size equ 1
stereo equ 2
sblimit equ 3 /* 1 for mono, 2 for stereo */
jsbound equ 4 /* total number of sub bands */
tbl_num equ 5 /* first band of joint stereo coding */
sblimit_mc equ 6 /* allocation table number 0..3 */
mc_channel equ 7 /* total number of MC subbands */
mc_prediction_on equ 8
tc_sbgr_select equ 9
tc_allocation equ 10
tc_alloc_bits equ 11
dyn_cross_on equ 12 /* to read the right length of tc_alloc field */
dyn_cross_LR equ 13
dyn_cross_bits equ 14
lfe_allocation equ 15 /* to read the right length of dyn_cross field */
lfe_scalefactor equ 16
aug_mtx_proc equ 17
aug_dyn_cross_on equ 18
aug_future_ext equ 19
aug_channel equ 20
layer_I_frames equ 21
layer_I_parts equ 22
alloc_tbl_ptr equ 23
error_count equ 24
mandatory_crc_check equ 25
mpeg_version equ 26
channel_config equ 27
base_last_pos equ 28 /* the last rSBL0OFF value in main frame buffer */
mc_last_pos equ 29 /* the last rSBL0OFF value in mc frame buffer */
mc_bs_size equ 30 /* mc frame size if have extension frame */
drc_gain equ 31 /* DRC gain value(G) in mpa_drc.h */
/* bs_status: direct addressing offset */
mpg_curpos equ 0
ext_curpos equ 1
mc_curpos equ 2
bit_buffer equ 3
bit_count equ 4
I_mc_totbits equ 5
I_frame_size equ 6
mpg_base_ptr equ 7
ext_base_ptr equ 8
bs_buf_size equ 9
/* buffer pointer area offset */
area_synthesis equ 0
area_backup equ 1
/****************************************************************/
/* */
/* G L O B A L V A R I A B L E S */
/* MEMORY ALLOCATION */
/* */
/****************************************************************/
.ifdef _MPA_MEMALLOC
secFractionBuffer_mac section udata, word3, overlay, abs xmem_FRACTION
secFractionBuffer_mac
/* intermediate data buffer */
fraction:: ds3 SBLIMIT*NCH*GRANULES*PARTS
.if( _DECODER_TYPE != MPEG_1_AUDIO )
fraction_mc:: ds3 SBLIMIT*(MAX_CHANNEL-NCH)*GRANULES*PARTS
lfe_fraction:: ds3 GRANULES + 1 // for previous sample store
.endif
secFast32IDCT_mac section udata, word3, overlay, abs xmem_DCT32_BUF
secFast32IDCT_mac
/* DCT buffer */
synth_dct32:: ds3 32
secSynthesisBuffer_mac section udata, word3, overlay, abs xmem_SYNTH_BUF
secSynthesisBuffer_mac
/* synthesis subband filter part */
synthesis_buffer:: ds3 WINDOW_SIZE*NCH
.if( _DECODER_TYPE != MPEG_1_AUDIO )
synthesis_buffer_mc:: ds3 WINDOW_SIZE*(MAX_CHANNEL-NCH)
secLfeFilterBuffer_mac section udata, word3, overlay, abs xmem_LFE_FILTER
secLfeFilterBuffer_mac
v1:: ds3 8
v2:: ds3 8
w1:: ds3 8
w2:: ds3 8
.endif
secPcmOutputBuffer_mac section udata, word3, overlay, abs ymem_PCM_BUF
secPcmOutputBuffer_mac
/* pcm output buffer */
pcm_ch_buffer:: ds3 SAMPLES_PER_FRAME*NCH
.if( _DECODER_TYPE != MPEG_1_AUDIO )
pcm_ch_buffer_mc:: ds3 SAMPLES_PER_FRAME*(MAX_CHANNEL-NCH)
pcm_dm_buffer:: ds3 SAMPLES_PER_FRAME*NCH
pcm_lfe_buffer:: ds3 SAMPLES_PER_FRAME
.endif
secMpegInformation_mac section udata, word3, overlay, abs ymem_MPEG_INFO
secMpegInformation_mac
header_info:: ds3 PAGE_SIZE/2
layer_info:: ds3 PAGE_SIZE/2
secDecodeBuffer_mac section udata, word3, overlay, abs ymem_DECODE_BUF
secDecodeBuffer_mac
/* mpeg-1 audio data */
bit_alloc:: ds3 SBLIMIT*2
.if( _DECODER_TYPE != MPEG_1_AUDIO )
bit_alloc_mc:: ds3 SBLIMIT*(MAX_CHANNEL-NCH)
.endif
.if( _DECODER_TYPE == MPEG_1_AUDIO )
scfsi:: ds3 SBLIMIT*NCH
scale_index:: ds3 SBLIMIT*NCH*PARTS
.else
scfsi:: ds3 SBLIMIT*NMCH
scale_index:: ds3 SBLIMIT*(NCH+NMCH+AUGCH)*PARTS
/* mc composite status information layer I, II */
tc_alloc:: ds3 GRANULES
dyn_cross_mode:: ds3 GRANULES
dyn_second_stereo:: ds3 GRANULES
aug_tc_alloc:: ds3 GRANULES
aug_dyn_cross_mode:: ds3 GRANULES
//mc_prediction:: ds3 SB_GRANULES
//mc_predsi:: ds3 SB_GRANULES*PRED_INDEX
/* mc audio data layer I, II */
//mc_delay_comp:: ds3 SB_GRANULES*PRED_INDEX
//mc_pred_coeff:: ds3 SB_GRANULES*PRED_INDEX*PCI
//pred_buf:: ds3 2*8*(36+(2+7))
.endif
secBackupRegister_mac section udata, word3, overlay, abs ymem_BACKUP_REG
secBackupRegister_mac
/* temporal backup register area; short direct offset 0,1 */
backup_register:: ds3 32
secBitStream_mac section udata, word3, overlay, abs ymem_BITSTREAM
secBitStream_mac
/* saved bit stream status (bit_buffer, bit_count) */
bs_status:: ds3 16
secInputBufferPtr_mac section udata, word3, overlay, abs ymem_BUFFERPTR
secInputBufferPtr_mac
/* saved input buffer pointer and limit */
buffer_ptr:: ds3 16
/*****************[ shared memory between CALM and MAC ]*******************/
/* */
.if( 1 )
/* mpeg audio decoder information for calm access */
calm_MPEG_INFO equ (ymem_MPEG_INFO-INT_YM_BASE_MAC)*2+INT_YM_BASE
secMpegInformation_calm section udata, overlay, abs calm_MPEG_INFO
secMpegInformation_calm
_header_info:: dsw PAGE_SIZE/2
_layer_info:: dsw PAGE_SIZE/2
calm_SYNTH_BUF equ (xmem_SYNTH_BUF-INT_XM_BASE_MAC)*2+INT_XM_BASE
secSynthesisBuffer_calm section udata, overlay, abs calm_SYNTH_BUF
secSynthesisBuffer_calm
/* synthesis subband filter part */
_syn_buffer:: dsw MAX_CHANNEL*WINDOW_SIZE
calm_BUFFERPTR equ (ymem_BUFFERPTR-INT_YM_BASE_MAC)*2+INT_YM_BASE
secInputBufferPtr_calm section udata, overlay, abs calm_BUFFERPTR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -