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

TDFB code reorganize #8457

Merged
merged 3 commits into from
Nov 17, 2023
Merged

TDFB code reorganize #8457

merged 3 commits into from
Nov 17, 2023

Conversation

btian1
Copy link
Contributor

@btian1 btian1 commented Nov 8, 2023

move it from include path to tdfb module folder.

@btian1 btian1 marked this pull request as ready for review November 9, 2023 03:13
Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

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

src/audio/tdfb/tdfb.c Show resolved Hide resolved
/* The driver assigns running numbers for control index. If there's single control of
* type switch, enum, binary they all have index 0.
*/
#define CTRL_INDEX_PROCESS 0 /* switch */
Copy link
Collaborator

Choose a reason for hiding this comment

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

These would be good to prefix with TDFB_.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, let me use another patch to address, this patch focus on refine.

ipc_msg_send(cd->msg, cd->ctrl_data, false);
}

int tdfb_sub_init(struct processing_module *mod)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The new function name is not descriptive, it should describe better what is done here.

ipc_msg_send(msg, NULL, false);
}

int tdfb_sub_init(struct processing_module *mod)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Update this function name too. Perhaps tdfb_common_notification_init()?

Copy link
Member

Choose a reason for hiding this comment

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

Cant use common in name as this is within an ipc4 file.

ipc4_base_module_cfg_to_stream_params(&mod->priv.cfg.base_cfg, params);
component_set_nearest_period_frames(dev, params->rate);

sourceb = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I realized here's similar issue as there was with my work with rtc aec. This is similar as original, but it's not handling correctly a typical case where source has more channels than sink. Please add a reminder /* TODO: */ note for it. I can fix it later when I have suitable topology to use for test.

Copy link
Contributor

Choose a reason for hiding this comment

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

@lkoenig FYI

Copy link
Collaborator

Choose a reason for hiding this comment

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

The merged fix for it is here: #8452

tdfb_send_notification(cd->msg, cd->az_value_estimate);
}

int tdfb_get_config_common(struct processing_module *mod,
Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry, not sure why you call these functions *_common()? They differ between IPC3 and IPC4, I would use "common" for functions shared between IPC versions?

Copy link
Member

Choose a reason for hiding this comment

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

ack, sounds like they are not common, otherwise it LGTM. Lets fix the ipc/common naming.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

both ipc3/ipc4 have this function implementation, my purpose is:
keep interface function defined in main source file, i.e, keep: tdfb_get_config & tdfb_set_config in tdfb.c.

Otherwise, I can move tdfb_get_config & tdfb_get_config to ipc3/ipc4 separately, this will make tdfb.c looks lack something

Copy link
Collaborator

Choose a reason for hiding this comment

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

the code separation is good, we're only proposing to change the function naming. "common" in this case suggests that those functions are common for IPC3 and IPC4. The code in tdfb.c is common for IPC3 and IPC4. But functions, implemented separately for IPC3 and IPC4 are IPC-version-specific. I'm not sure I can propose a good name suffix for those version-specific function parts, how about ..._private or ..._priv or ..._specific?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no perfect name actually, let's keep for now?

Copy link
Collaborator

Choose a reason for hiding this comment

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

no perfect name actually, let's keep for now?

personally each of the proposed options seems better to me than "common," e.g. I'd go with "priv"

Copy link
Collaborator

Choose a reason for hiding this comment

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

@btian1 @lyakh Hmm, I agree. "common" is very misleading as the functions actually are different and not common. Naming is hard, let's go with "priv", not great, but good enough.

@btian1 btian1 force-pushed the tdfb_refine branch 2 times, most recently from 3720fa5 to 91b935f Compare November 14, 2023 02:00
Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

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

Looks good @btian1 . Let's change the "common" to "priv" and then I think this is good to go.

tdfb_send_notification(cd->msg, cd->az_value_estimate);
}

int tdfb_get_config_common(struct processing_module *mod,
Copy link
Collaborator

Choose a reason for hiding this comment

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

@btian1 @lyakh Hmm, I agree. "common" is very misleading as the functions actually are different and not common. Naming is hard, let's go with "priv", not great, but good enough.

Copy link
Collaborator

@singalsu singalsu left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks for the clean up!

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

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

Still a few not-common common functions. While at it, I propose a better alternative to "private". Especially if "private" is put in the middle of the function (like get_private_params()), this implies we are getting some private parameters (i..e attribute of params, and not attribution of the function itself).

src/audio/tdfb/tdfb_comp.h Outdated Show resolved Hide resolved
src/audio/tdfb/tdfb_comp.h Outdated Show resolved Hide resolved
src/audio/tdfb/tdfb_comp.h Outdated Show resolved Hide resolved
src/audio/tdfb/tdfb_comp.h Outdated Show resolved Hide resolved
@btian1 btian1 force-pushed the tdfb_refine branch 2 times, most recently from 47484ce to 712443e Compare November 17, 2023 05:59
Move it from include path to tdfb module folder.

Signed-off-by: Baofeng Tian <[email protected]>
Split out ipc3 and ipc4 specific code from tdfb module, also
refined header files for new source file.

Signed-off-by: Baofeng Tian <[email protected]>
Add prefix SOF_TDFB to macros to avoid repeat definition.

Signed-off-by: Baofeng Tian <[email protected]>
Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

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

Thanks @btian1 , looks good now.

@kv2019i kv2019i merged commit f60dd18 into thesofproject:main Nov 17, 2023
43 of 44 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.

6 participants