1# Acoustic echo cancelling Pipeline and PCM 2# 3# Pipeline Endpoints for connection are :- 4# 5# host PCM_C <-- B0 <- NC <-- B1 <-- AEC <-- B2 <-- source DAI0 6# ^----- B3 <-- AEC reference 7 8# Include topology builder 9include(`utils.m4') 10include(`buffer.m4') 11include(`pcm.m4') 12include(`dai.m4') 13include(`mixercontrol.m4') 14include(`pipeline.m4') 15include(`bytecontrol.m4') 16include(`enumcontrol.m4') 17include(`google_rtc_audio_processing.m4') 18include(`rtnr.m4') 19 20define(GOOGLE_RTC_AUDIO_PROCESSING_priv, concat(`google_rtc_audio_processing_bytes_', PIPELINE_ID)) 21define(GOOGLE_RTC_AUDIO_PROCESSING_CTRL, concat(`google_rtc_audio_processing_control_', PIPELINE_ID)) 22 23include(`google_rtc_audio_processing_default.m4') 24 25define(DEF_RTNR_PRIV, concat(`rtnr_priv_', PIPELINE_ID)) 26define(DEF_RTNR_BYTES, concat(`rtnr_bytes_', PIPELINE_ID)) 27define(DEF_RTNR_DATA, concat(`rtnr_data', PIPELINE_ID)) 28define(DEF_RTNR_DATA_BYTES, concat(`rtnr_data_', PIPELINE_ID)) 29 30ifdef(`RTNR_BUFFER_SIZE_MIN',`', define(RTNR_BUFFER_SIZE_MIN, `65536')) 31ifdef(`RTNR_BUFFER_SIZE_MAX',`', define(RTNR_BUFFER_SIZE_MAX, `65536')) 32 33CONTROLBYTES_PRIV(DEF_RTNR_PRIV, 34` bytes "0x53,0x4f,0x46,0x00,0x00,0x00,0x00,0x00,' 35` 0x20,0x00,0x00,0x00,0x00,0x30,0x01,0x03,' 36` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' 37` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' 38` 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' 39` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' 40` 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,' 41` 0x80,0xbb,0x00,0x00,0x00,0x00,0x00,0x00"' 42) 43 44# RTNR Bytes control with max value of 255 45C_CONTROLBYTES_READONLY(DEF_RTNR_BYTES, PIPELINE_ID, 46 CONTROLBYTES_OPS(bytes, 258 binds the mixer control to bytes get/put handlers, 258), 47 CONTROLBYTES_EXTOPS(258 binds the mixer control to bytes get/put handlers, 258), 48 , , , 49 CONTROLBYTES_MAX(, 256), 50 , 51 DEF_RTNR_PRIV) 52 53CONTROLBYTES_PRIV(DEF_RTNR_DATA, 54` bytes "0x53,0x4f,0x46,0x00,0x01,0x00,0x00,0x00,' 55` 0x00,0x00,0x00,0x00,0x00,0x30,0x01,0x03,' 56` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' 57` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"' 58) 59 60# Bytes control for RTNR Data blob 61C_CONTROLBYTES(DEF_RTNR_DATA_BYTES, PIPELINE_ID, 62 CONTROLBYTES_OPS(bytes, 258 binds the mixer control to bytes get/put handlers, 258, 258), 63 CONTROLBYTES_EXTOPS(258 binds the mixer control to bytes get/put handlers, 258, 258), 64 , , , 65 CONTROLBYTES_MAX(, 10240), 66 , 67 DEF_RTNR_DATA) 68 69# RTNR Enable switch 70define(DEF_RTNR_ENABLE, concat(`rtnr_enable_', PIPELINE_ID)) 71define(`CONTROL_NAME', `DEF_RTNR_ENABLE') 72 73C_CONTROLMIXER(DEF_RTNR_ENABLE, PIPELINE_ID, 74 CONTROLMIXER_OPS(volsw, 259 binds the mixer control to switch get/put handlers, 259, 259), 75 CONTROLMIXER_MAX(max 1 indicates switch type control, 1), 76 false, 77 , 78 Channel register and shift for Front Center, 79 LIST(` ', KCONTROL_CHANNEL(FC, 3, 0)), 80 "1") 81undefine(`CONTROL_NAME') 82 83C_CONTROLBYTES(`Config', PIPELINE_ID, 84 CONTROLBYTES_OPS(bytes, 258 binds the control to bytes get/put handlers, 258, 258), 85 CONTROLBYTES_EXTOPS(258 binds the control to bytes get/put handlers, 258, 258), 86 , , , 87 CONTROLBYTES_MAX(, 2048), 88 , 89 GOOGLE_RTC_AUDIO_PROCESSING_priv) 90 91# 92# Components and Buffers 93# 94 95# Host "Google RTC Audio Processing Capture" PCM 96# with 0 sink and 2 source periods 97W_PCM_CAPTURE(PCM_ID, Google RTC Audio Processing, 0, DAI_PERIODS, SCHEDULE_CORE) 98 99W_GOOGLE_RTC_AUDIO_PROCESSING(0, PIPELINE_FORMAT, 2, DAI_PERIODS, SCHEDULE_CORE, 100 `', 101 LIST(` ', "Config")) 102 103# "RTNR 0" has 2 sink period and 2 source periods 104W_RTNR(0, PIPELINE_FORMAT, 2, DAI_PERIODS, SCHEDULE_CORE, 105 LIST(` ', "DEF_RTNR_BYTES", "DEF_RTNR_DATA_BYTES"), 106 LIST(` ', "DEF_RTNR_ENABLE")) 107 108# Capture Buffers 109W_BUFFER(0, COMP_BUFFER_SIZE(2, 110 COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), 111 PLATFORM_HOST_MEM_CAP) 112W_BUFFER(1, COMP_BUFFER_SIZE(DAI_PERIODS, 113 COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), 114 PLATFORM_DAI_MEM_CAP) 115W_BUFFER(2, COMP_BUFFER_SIZE(DAI_PERIODS, 116 COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), 117 PLATFORM_DAI_MEM_CAP) 118W_BUFFER(3, COMP_BUFFER_SIZE(DAI_PERIODS, 119 COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), 120 PLATFORM_DAI_MEM_CAP) 121 122define(`N_AEC_REF_BUF',`BUF'PIPELINE_ID`.'3) 123# 124# Pipeline Graph 125# 126# host PCM_P <-- B0 <-- RTNR0 <-- B1 <-- AEC0 <-- B2 <-- sink DAI0 127# ^------- B3 <-- AEC ref 128 129P_GRAPH(pipe-google-aec-capture-PIPELINE_ID, PIPELINE_ID, 130 LIST(` ', 131 `dapm(N_PCMC(PCM_ID), N_BUFFER(0))', 132 `dapm(N_BUFFER(0), N_RTNR(0))', 133 `dapm(N_RTNR(0), N_BUFFER(1))', 134 `dapm(N_BUFFER(1), N_GOOGLE_RTC_AUDIO_PROCESSING(0))', 135 `dapm(N_GOOGLE_RTC_AUDIO_PROCESSING(0), N_BUFFER(2))', 136 `dapm(N_GOOGLE_RTC_AUDIO_PROCESSING(0), N_BUFFER(3))')) 137 138# 139# Pipeline Source and Sinks 140# 141indir(`define', concat(`PIPELINE_SINK_', PIPELINE_ID), N_BUFFER(2)) 142indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Google RTC Audio Processing PCM_ID) 143 144# 145# PCM Configuration 146# 147 148PCM_CAPABILITIES(Google RTC Audio Processing PCM_ID, CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT), 149 PCM_MIN_RATE, PCM_MAX_RATE, PIPELINE_CHANNELS, PIPELINE_CHANNELS, 150 2, 16, 192, 16384, 65536, 65536) 151 152undefine(`DEF_RTNR_ENABLE') 153undefine(`DEF_RTNR_PRIV') 154undefine(`DEF_RTNR_BYTES') 155undefine(`DEF_RTNR_DATA') 156undefine(`DEF_RTNR_DATA_BYTES') 157