Audio: Copier: Use SOF_DIV_ROUND_UP() instead of ROUND_UP()#9579
Merged
kv2019i merged 1 commit intothesofproject:mainfrom Oct 17, 2024
Merged
Conversation
lgirdwood
approved these changes
Oct 15, 2024
jsarha
previously approved these changes
Oct 15, 2024
abonislawski
approved these changes
Oct 16, 2024
lyakh
requested changes
Oct 16, 2024
Collaborator
lyakh
left a comment
There was a problem hiding this comment.
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
@lyakh is correct. SOF_DIV_ROUND_UP() is not equivalent of ROUND_UP().
Collaborator
Author
|
Closing, sorry! |
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>
21e275c to
c3925e7
Compare
Collaborator
Author
|
Thanks @lyakh for avoiding me to break totally the code. Fixed now as you suggested. |
lgirdwood
approved these changes
Oct 16, 2024
lyakh
approved these changes
Oct 17, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The ROUND_UP() is provided by Zephyr headers and can't be used in testbench (IPC4) build.