Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

topology2: google-rtc-aec: adjust the IBS/OBS size based on process needs #8403

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

yongzhi1
Copy link
Contributor

Add new token to adjust the input/output buffer size for process modules.

@yongzhi1
Copy link
Contributor Author

This is written by @ranj063 , posted for review upon her request.

@@ -181,4 +181,8 @@ Object.Base.VendorToken {
node_type 1980
deep_buffer_dma_ms 1981
}
"19" {
name "process"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems currently, you only want this used for RTC-AEC, is it possible to make it as a common attribute?
CPC calculation need set different input/output buffer size, so maybe we can start from here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rander suggested to hide IBS/OBS adjustments inside the tplg instead of asking driver to run the math, which is fine.

@RanderWang
Copy link
Collaborator

please check my comments in Linux kernel side, thanks!

@@ -138,4 +143,6 @@ Class.Widget."google-rtc-aec" {
is_pages 1
num_input_pins 2
num_output_pins 1
# AEC requires 10ms buffers for processing
buffer_period_size 10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be buffer_period_ms ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can use BUFFER_PERIOD_MS in the 2nd version.

@yongzhi1
Copy link
Contributor Author

V2 Update:

Taka a different approach to update buffer_size with IBS/OBS adjusted in tplg.

Copy link
Contributor

@btian1 btian1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, may I know this IBS setting is for AEC module intermediate buffer or AEC's source buffer size?

@@ -96,6 +98,7 @@ Class.Widget."google-rtc-aec" {
input_pin_index 0
in_bit_depth 16
in_valid_bit_depth 16
ibs "$[(($in_channels * ($[($in_rate + 999)] / 1000)) * ($in_bit_depth / 8)) * $M ]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgirdwood @singalsu @ranj063 @marcinszkudlinski , we may need unify these ibs/obs setting.
currently, when we try to set ibs/obs, we always try to do some rounding, like "+999" or "+4", based on discuss in:
77a12d5

from DP perspective, those rounding is not necessary, i, e we should use:
ibs "$[(($in_channels * ($[($in_rate] / 1000)) * ($in_bit_depth / 8)) * $M ]"

this can reduce delay for pipeline, if with rounding, take 11025 as example, it need 12 samples, if current is 11, it have to wait until next come to meet 12 samples, then if set ibs as 11 based, when input 11 samples arrived, it can go without waiting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, thanks for the inputs, can we make a cross-tree changes with the improved formula in a seperate patch?

Copy link
Collaborator

@RanderWang RanderWang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change the PR title. It look good for me

@@ -14,6 +14,8 @@
# Where N is the unique instance number for the google-rtc-aec object within the same alsaconf node.
Define {
AEC_UUID "a6:a0:80:b7:9f:26:6f:46:b4:77:23:df:a0:5a:f7:58"
# AEC requires 10ms buffers for processing
M 10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

M is too simple, is it duration or period?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about BUFFER_PERIOD_MS?

@yongzhi1
Copy link
Contributor Author

please change the PR title. It look good for me

Ack.

@yongzhi1 yongzhi1 changed the title topology2: Introduce new token for buffer period size topology2: google-rtc-aec: adjust the IBS/OBS size based on process needs Oct 30, 2023
@yongzhi1
Copy link
Contributor Author

BTW, may I know this IBS setting is for AEC module intermediate buffer or AEC's source buffer size?

This should be the source buffer size according to the definition found here
https://github.com/thesofproject/sof-docs/blob/63e3905c7b376f11ab828ac4246f0dc3e0d1bc6d/developer_guides/rimage/ipc4_extended_module_config.rst#module-config

…eeds

Example: if a module has 2 input pins, one 16000/16/2, second 48000/16/2 and
one output pin 48000/32/4 and is designed to process 10ms data chunks:

in pin1 IBS should be 16(samples/1ms) * 2 bytes * 2 * 10(ms) = 640
in pin2 IBS should be 48(samples/1ms) * 2 bytes * 2 * 10(ms) = 1920
out pin1 OBS should be 48(samples/1ms) * 4 bytes * 4 * 10(ms) = 7680

Signed-off-by: Ranjani Sridharan <[email protected]>
Signed-off-by: Yong Zhi <[email protected]>
@yongzhi1
Copy link
Contributor Author

Update:

  • Replace $M with $BUFFER_PERIOD_MS.

@kv2019i kv2019i merged commit d294036 into thesofproject:main Nov 1, 2023
36 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants