1 2 #define THRESHOLD_READ_R2_SHM_FAIL_CNT 100 3 #define MP3ENC_MAX_PTS_TBL_NUM 64 4 5 /**************************************************************************************************** 6 * Each R2 Decoder paramter 7 ****************************************************************************************************/ 8 enum 9 { 10 DTS_TYPE_UNKNOWN = 0, 11 DTS_TYPE_CORE = 1, 12 DTS_TYPE_CORE_XLL = 2, 13 DTS_TYPE_LBR = 3, 14 DTS_TYPE_XLL = 4, 15 }; 16 17 typedef struct 18 { 19 MS_U32 drcMode; // 0:line 0: RF more 20 MS_U32 high_cut; //0 - 100, 100 indicate 100% 21 MS_U32 low_boost; //0 - 100, 100 indicate 100% 22 MS_U32 dmxMode; //1: LtRt 0:LoRo 23 MS_U32 gain; // 24 MS_U32 mul_frame_header; 25 MS_U32 DDP_HDMI_bypass; 26 MS_U32 AAC_HDMI_bypass; 27 MS_U32 TB11_enable; //Dolby Technical Bulletin 11 (Loudness matching) 28 MS_U32 ddp_AD_substream; 29 MS_S32 mixer_balance; 30 MS_S16 dap_leveler_enable; 31 MS_S16 leveler_ignore_il; 32 MS_S32 ddp_disable_atmos; 33 MS_U32 DOLBY_PARAM_Reserved[6]; 34 } AUR2_DOLBY_PARAM; 35 36 typedef struct 37 { 38 MS_U32 asf_version; 39 MS_U32 nChannels; 40 MS_U32 smpRate; 41 MS_U32 byteRate; 42 MS_U32 blockAlign; 43 MS_U32 encOpt; 44 MS_U32 parsingByApp; 45 MS_U32 bitsPerSmp; 46 MS_U32 channelMask; 47 MS_U32 drcParamExist; 48 MS_U32 drcRmsAmpRef; 49 MS_U32 drcRmsAmpTarget; 50 MS_U32 drcPeakAmpRef; 51 MS_U32 drcPeakAmpTarget; 52 MS_U32 maxPacketSize; 53 MS_U32 u32AdvancedEncodeOpt; 54 MS_U32 u32AdvancedEncodeOpt2; 55 MS_U32 ASF_PARAM_Reserved[10]; 56 } AUR2_ASF_PARAM; 57 58 typedef struct 59 { 60 MS_U32 xPcmType; 61 MS_U32 nChannels; 62 MS_U32 smpRate; 63 MS_U32 bitsPerSmp; 64 MS_U32 blockSize; 65 MS_U32 samplePerBlock; 66 MS_U32 XPCM_PARAM_Reserved[5]; 67 } AUR2_XPCM_PARAM; 68 69 typedef struct 70 { 71 MS_U32 mNumCodecs; 72 MS_U32 mSamples; 73 MS_U32 mSampleRate; 74 75 MS_U32 Channels[5]; 76 MS_U32 Regions[5]; 77 MS_U32 cplStart[5]; 78 MS_U32 cplQbits[5]; 79 MS_U32 FrameSize[5]; 80 MS_U32 COOK_PARAM_Reserved[5]; 81 } AUR2_COOK_PARAM; 82 83 typedef struct 84 { 85 MS_U32 drcMode; //system certification used 86 MS_U32 dmxLfeEnable; 87 MS_U32 dialnormEnable; //system certification used 88 MS_U32 certMode; //system certification used 89 MS_U32 dmxMode; 90 MS_U32 DTSHD_HDMI_bypass; 91 MS_U32 seamless; //0: no seamless 92 MS_U32 drcPercent; //0~100, 0: no DRC 93 MS_U32 DTS_PARAM_Reserved[9]; 94 } AUR2_DTS_PARAM; 95 96 typedef struct 97 { 98 MS_U32 MPEG_soundMode; 99 MS_U32 gain; 100 MS_U32 MPEG_PARAM_Reserved[5]; 101 } AUR2_MPEG_PARAM; 102 103 /**************************************************************************************************** 104 * Each R2 Decoder info 105 ****************************************************************************************************/ 106 typedef struct 107 { 108 MS_U32 decType; //DDP or DD, 109 MS_U32 frameSize; //DDP frame ES size 110 MS_U32 bsMode; //DDP bsmode on bitstream 111 MS_U32 aac_Type; 112 MS_U32 aac_ES_format; 113 MS_U32 atmos_stream; 114 MS_U32 DDP_71_stream; 115 MS_U32 DOLBY_INFO_Reserved[3]; //reserved for new items 116 } AUR2_DOLBY_INFO; 117 118 typedef struct 119 { 120 MS_U32 cdMode; // 121 MS_U32 dts_ES_frame_size; 122 MS_U32 dts_ES_Type; 123 MS_U32 dts_PCM_frame_size; 124 MS_U32 DTS_INFO_Reserved[5]; //reserved for new items 125 } AUR2_DTS_INFO; 126 127 typedef struct 128 { 129 MS_U32 MPEG_Layer; 130 MS_U32 MPEG_stereoMode; 131 MS_U32 MPEG_Header; 132 //MS_U32 gain; 133 MS_U32 MPEG_INFO_Reserved[5]; //reserved for new items 134 } AUR2_MPEG_INFO; 135 136 typedef struct 137 { 138 MS_U32 SampleRate; //input ES sampling rate 139 MS_U32 spdif_info_flag; //0: disable(init), 1: bypass/convert, 2: transcoder, 3: pcm 140 MS_U32 hdmi_info_flag; //0: disable(init), 1: bypass/convert, 2: transcoder, 3: pcm 141 MS_U32 COMMON_INFO_Reserved[5]; //reserved for new items 142 } AUR2_COMMON_INFO; 143 /**************************************************************************************************** 144 * Common R2 Decoder paramter 145 ****************************************************************************************************/ 146 typedef struct 147 { 148 /* each codec support max output channel */ 149 MS_U32 ch_cap_MEPG; 150 MS_U32 ch_cap_AC3; 151 MS_U32 ch_cap_AAC; 152 MS_U32 ch_cap_DTS; 153 MS_U32 ch_cap_DTS_HD; 154 MS_U32 ch_cap_DTS_LBR; 155 MS_U32 ch_cap_WMA; 156 MS_U32 ch_cap_DRA; 157 MS_U32 ch_cap_COOK; 158 MS_U32 ch_cap_XPCM; 159 MS_U32 ch_cap_VORBIS; 160 } AUR2_ADEC_Ch_INFO_SHM; 161 162 typedef struct 163 { 164 /* decoder info */ 165 MS_U32 capability; // update once 166 MS_U32 decStatus; // update per frame 167 MS_U32 dec_error_id; // update per frame 168 MS_U32 mmFileReqSize; 169 MS_U32 bootMagicID; // identify whether this structure is initialized or not ? // update once 170 171 MS_U32 smpRate; // update per frame 172 MS_U32 spdifTx_smpRate; // update per frame 173 MS_U32 hdmiTx_smpRate; // update per frame 174 MS_U32 bitRate; // update per frame 175 MS_U32 synthRate; // update per frame 176 MS_U32 dec_ch_mode; // update per frame 177 MS_U32 dec_ch_mapping; // update per frame 178 // [15:8]: reserved 179 // [7]: right front 180 // [6]: left front 181 // [5]: LFE 182 // [4]: right surround 183 // [3]: left surround 184 // [2]: right 185 // [1]: left 186 // [0]: center 187 188 /* buffer level */ 189 MS_U32 PCM_Level; // udpate when change 190 MS_U32 spdifbuf_Level; // udpate when change 191 192 /* AV sync info */ 193 MS_U32 STC; // [32:1] skip bit 0 194 MS_U32 PTS; // [32:1] skip bit 0 // update per frame 195 MS_U32 currPTS; // [32:1] skip bit 0 // update when change 196 MS_S32 Td; // [32:1] STC - APTS // update when change 197 198 MS_U32 MMTs_SyncFlag; // update when change 199 MS_U32 wait1stPtsCnt; // update per sample 200 MS_U32 waitStcCnt; // update per sample 201 MS_U32 smpFlushCnt; // update per sample 202 203 MS_U32 avSyncState; // update per sample 204 MS_U32 freeRunType; // update per sample 205 MS_U32 avSyncOffset; // update per sample 206 207 MS_U32 ptsTagWRIdx; // update per sample 208 MS_U32 ptsTagRDIdx; // update per sample 209 210 /* dec status */ 211 MS_U32 playState; // update per sample 212 MS_U32 decType; // update per sample 213 MS_U32 playSmpFlag; // update per sample 214 MS_U32 decCallingCnt; // update per sample 215 MS_U32 receiveStopCnt; // update per sample 216 MS_U32 pcmBufEmptyCnt; 217 218 /* frame info */ 219 MS_U32 ok_frmCnt; // update per frame 220 MS_U32 err_frmCnt; // update per frame 221 MS_U32 skip_frmCnt; // update per frame 222 MS_U32 rept_frmCnt; // update per frame 223 MS_U32 syncMiss_Cnt; // update per frame 224 225 /* buffer pointer */ 226 MS_U32 PCM_wrPtr; // byte pointer // update when change //range : 0 ~ PCM1_DRAM_SIZE 227 MS_U32 pcmAddr; 228 MS_U32 pcmSize; 229 230 /* uniplayer */ 231 MS_U32 uni_decDone_cnt; 232 MS_U32 uni_decDone_pcmAddr; //range: 0 ~ PCM1_DRAM_SIZE 233 MS_U32 uni_decDone_pcmSize; //unit : bytes 234 235 MS_U32 spdifbuf_wrPtr; // byte pointer // update when change //range : 0 ~ PCM1_DRAM_SIZE 236 MS_U32 spdifbuf_Addr; 237 MS_U32 spdifbuf_Size; 238 239 MS_U32 encRawBuf_wrPtr; 240 MS_U32 encRawBuf_Addr; 241 MS_U32 encRawBuf_Size; 242 243 MS_U32 hdmibuf_Level; // udpate when change 244 MS_U32 hdmibuf_wrPtr; // byte pointer // update when change //range : 0 ~ PCM1_DRAM_SIZE 245 MS_U32 hdmibuf_Addr; 246 MS_U32 hdmibuf_Size; 247 MS_U32 hdmi_hbr_mode; //1 or 0 248 249 /* PTS latency */ 250 MS_U32 pts_latency; 251 252 AUR2_DOLBY_INFO dolby_info; 253 AUR2_DTS_INFO dts_info; 254 AUR2_MPEG_INFO mpeg_info; 255 AUR2_COMMON_INFO common_info; 256 257 MS_U32 unsupport_type; 258 MS_U32 syncword_count; 259 MS_U32 dec_pcm_channel; 260 261 MS_U32 PCM_DMX_Level; 262 MS_U32 omx_no_mixing; 263 MS_U32 omx_ES_bypass; 264 MS_U32 mch_valid; // [0]: multi-channel [1]:downmix-channel 265 MS_U32 ADEC_INFO_SHM_Reserved[16]; //reserved for new items 266 } AUR2_ADEC_INFO_SHM; // audio R2 report info to MCU / MM_AEON 267 268 //for spdif_type 269 #define SPDIF_NONE 0 270 #define SPDIF_PCM 1 271 #define SPDIF_AUTO 2 272 //for OMX_SPDIF_Ctrl param 273 #define OMX_SPDIF_MODE_EN_BIT _BIT_0_ 274 #define OMX_SPDIF_PLAY_BIT _BIT_1_ 275 276 typedef struct 277 { 278 /* DTV avSync offset */ 279 MS_S32 dtv_mpg_avDelay; 280 MS_S32 dtv_ac3_avDelay; 281 MS_S32 dtv_aac_avDelay; 282 283 /* DTV asoc avSync offset */ 284 MS_S32 dtv_asoc_mpg_avDelay; 285 MS_S32 dtv_asoc_ac3_avDelay; 286 MS_S32 dtv_asoc_aac_avDelay; 287 288 /* external synthsizer control */ 289 MS_U32 extSynthsizer_en; 290 MS_U32 extSynthsizer_value; 291 292 /* AD volume */ 293 MS_U32 adMix_mainVol; 294 MS_U32 adMix_asocVol; 295 296 /* MM ctrl flag */ 297 MS_U32 mmTs_ctrl_flag; // MMTS control flag, ex: bit0: syncSTC ... 298 MS_U32 mmUni_needDecodeFrmCnt; 299 MS_U32 OMX_SPDIF_Ctrl; // [0]: SPDIF mode, [1]: SPDIF play 300 MS_U32 OMX_SPDIF_PCM_Level; 301 MS_U32 fast_forward; 302 MS_U32 spdif_type; //NONE, PCM, AUTO 303 MS_U32 hdmi_type; //NONE, PCM, AUTO 304 /* specific decoder param */ 305 AUR2_DOLBY_PARAM dolby_param; 306 AUR2_ASF_PARAM asf_param; 307 AUR2_XPCM_PARAM xpcm_param; 308 AUR2_COOK_PARAM cook_param; 309 AUR2_DTS_PARAM dts_param; 310 AUR2_MPEG_PARAM mpeg_param; 311 312 /* ES limiter */ 313 MS_U32 ES_Limiter_EN; 314 MS_U32 ES_Limiter_Threshold; 315 316 /* PCM limiter */ 317 MS_U32 PCM_Limiter_EN; 318 MS_U32 PCM_Limiter_Threshold; 319 320 /* general decoder control */ 321 MS_U32 mmFileReqSize; 322 MS_U32 bootMagicID; // identify whether this structure is initialized or not ? 323 MS_U32 decCtrl; // decode control 324 // [10]: STC from TSP0/1 0: from TSP 0, 1: from TSP 1. 325 // [9]: Slow forward 0.5x 326 // [8]: Parser Spec flag 1:11172-1 , 0: 13818-1 327 // [7]: PES Bypass flag 328 // [6]: PUSI disable flag 329 // [5]: MMTS PTS report: 1 : report PTS with MSB, 0: report PTS without MSB 330 // [4]: MM TS sync STC 331 // [3]: Fast forward 2x 332 // [2]: decoder mute 333 // [1:0]: sound mode 334 MS_U32 DPGA_Disable_flag; 335 MS_U32 hashKey; 336 MS_U32 arib_mmd_mode; 337 MS_U32 force_mmuni_mch_pcm; 338 MS_U32 vorbis_header_size; 339 MS_U32 TTS_On_flag; 340 MS_U32 DAP_enable; 341 MS_U32 speaker_enable; 342 MS_U32 DDP_encode_enable; 343 MS_U32 OMX_SPDIF_PAUSE; 344 345 MS_U32 Low_Latency_Limiter_ES_Threshold; 346 MS_U32 Low_Latency_Limiter_PCM_Threshold; 347 MS_U32 Low_Latency_Limiter_PCM_Skip_Target; 348 349 MS_U32 ADEC_PARAM_SHM_Reserved[13]; //reserved for new items 350 } AUR2_ADEC_PARAM_SHM; // MCU set param to audio R2 351 352 typedef struct 353 { 354 MS_U32 ES_Level; // update when change 355 MS_U32 ES_rdPtr; // byte pointer // update when change //range : 0 ~ ES1_DRAM_SIZE 356 MS_U32 ES_accumCnt; // update per frame 357 MS_U32 ES_INFO_Reserved[5]; //reserved for new items 358 } AUR2_ADEC_ES_INFO_SHM; 359 360 typedef struct 361 { 362 MS_U32 MM_inputPTS; // input PTS 363 MS_U32 ES_wrPtr; // byte pointer //range : ES1_DRAM_ADDR ~ (ES1_DRAM_ADDR + ES1_DRAM_SIZE) 364 MS_U32 ES_PARAM_Reserved[5]; //reserved for new items 365 } AUR2_ADEC_ES_PARAM_SHM; 366 367 /**************************************************************************************************** 368 * Common R2 encoder paramter 369 ****************************************************************************************************/ 370 typedef struct 371 { 372 MS_U32 acmod; 373 MS_U32 lfe_on; 374 MS_U32 sampleRate; 375 376 /* pcm info from decoder */ 377 MS_U32 mchPcm_dram_offset; 378 MS_U32 mchPcm_dram_size; 379 MS_U32 mchPcm_dram_wrPtr; 380 381 /* meta data from decoder */ 382 MS_U32 metaData_dram_offset; 383 MS_U32 metaData_dram_size; 384 MS_U32 metaData_dram_wrPtr; 385 MS_U32 AENC_PARAM_Reserved[10]; //reserved for new items 386 } AUR2_AENC_PARAM; 387 388 /**************************************************************************************************** 389 * each Sound effect param 390 ****************************************************************************************************/ 391 typedef struct 392 { 393 MS_U32 lcl_enable; //0 or 1, 1 is default 394 MS_U32 leveler_enable; //0 or 1, 1 is default 395 MS_U32 modeler_enable; //0 or 1, 1 is default 396 MS_U32 half_mode_enable; //0 or 1, 0 is default 397 MS_U32 amount; //0 ~ 10, 9 is default 398 399 MS_U32 avm; //-1536 ~ 480, default is 0 400 MS_U32 dvm; //-1536 ~ 480, default is 0 401 402 MS_U32 irl; //0 ~ 2080, default is 1360 403 MS_U32 orl; //0 ~ 2080, default is 1360 404 MS_U32 pregain; //-480 ~ 480, default is 0 405 MS_U32 agcGain; //0 ~ 20, default is 0 406 407 MS_U32 limiter_enable; //0 or 1, default is 1 408 MS_U32 limiter_peak; //0 ~ 0x7FFF, default is 0x3f8d 409 MS_U32 limiter_rms; //0 ~ 0x7FFF, default is 0x7101 410 MS_U32 limiter_boost; //0 ~ 0x7FFF, default is 0x7f19 411 MS_U32 AASE_DV258_PARAM_Reserved[10]; 412 } AUR2_AASE_DV258_PARAM; 413 414 typedef struct 415 { 416 MS_U32 MP3E_info_ES_wrPtr; //mp3e wrptr 417 MS_U32 MP3E_info_threshold; //threshold between rdPtr and wrPtr 418 MS_U32 MP3E_info_frame_size; //mp3e frame size 419 MS_U32 MP3E_info_available_size; //mp3e avail size 420 MS_U32 MP3E_info_frame_cnt; 421 MS_U32 MP3E_info_APTS; 422 423 MS_U32 MP3E_info_wrTabIndex; //mp3e wrptr index 424 MS_U32 MP3E_info_ES_wrPtrTab[64]; //mp3e wrptr table for PTS 425 MS_U32 MP3E_info_curPTSTab[64]; //mp3e current PTS table 426 427 MS_U32 MP3E_INFO_Reserved[6]; //reserved for new items 428 } AUR2_MP3E_INFO; 429 430 typedef struct 431 { 432 MS_U32 MP3E_param_ES_rdPtr; //mp3e rdrptr 433 MS_U32 MP3E_PARAM_Reserved[7]; //reserved for new items 434 } AUR2_MP3E_PARAM; 435 436 typedef struct 437 { 438 MS_U32 sound_mode; //pcmr sound mode for sw decoder 439 MS_U32 PCMR_PARAM_Reserved[7]; //reserved for new items 440 } AUR2_PCMR_PARAM;