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

Audio: Copier: Use SOF_DIV_ROUND_UP() instead of ROUND_UP() #9579

Merged

Conversation

singalsu
Copy link
Collaborator

The ROUND_UP() is provided by Zephyr headers and can't be used in testbench (IPC4) build.

@singalsu singalsu marked this pull request as ready for review October 15, 2024 12:51
jsarha
jsarha previously approved these changes Oct 15, 2024
Copy link
Collaborator

@lyakh lyakh left a comment

Choose a reason for hiding this comment

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

these are two quite different macros. One rounds up, another one divides, rounding up. The former can however be used here by removing the >> 2 shift

@jsarha jsarha dismissed their stale review October 16, 2024 07:14

@lyakh is correct. SOF_DIV_ROUND_UP() is not equivalent of ROUND_UP().

@singalsu
Copy link
Collaborator Author

Closing, sorry!

@singalsu singalsu closed this Oct 16, 2024
The ROUND_UP() is provided by Zephyr headers and can't be used
in testbench (IPC4) build.

The ROUND_UP is defined in util.h as:

"#define ROUND_UP(x, align)                                   \
	(((unsigned long)(x) + ((unsigned long)(align) - 1)) & \
	 ~((unsigned long)(align) - 1))"

and SOF_DIV_ROUND_UP in common.h as:

"#define SOF_DIV_ROUND_UP(val, div) (((val) + (div) - 1) / (div))"

The round up and divide by shift in original code can be replaced
with the rounding divide macro from SOF. There is no code speed
impact from division since it's done in C pre-processor.

The MAX_GAIN_COEFFS_CNT is much less than default 32 bit integer
range, so these compute the same.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu singalsu reopened this Oct 16, 2024
@singalsu singalsu force-pushed the copier_gain_use_sof_div_round_up branch from 21e275c to c3925e7 Compare October 16, 2024 08:20
@singalsu
Copy link
Collaborator Author

Thanks @lyakh for avoiding me to break totally the code. Fixed now as you suggested.

@kv2019i kv2019i merged commit 5ee1757 into thesofproject:main Oct 17, 2024
44 of 47 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