-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Audio: Use generic saturation logic for improved efficiency
This check-in refactors saturation functions to use bitwise operations for handling overflow and underflow, improving efficiency. - Replaced if-else checks with bitwise masks to handle overflow and underflow for int32, int24, int16, and int8 saturation functions. - For each bit width, created masks by shifting the results of comparisons (x - MIN_VAL) and (MAX_VAL - x) to the respective overflow/underflow detection bits. - Mask >> 31 or >> 63 results in either 0 (no overflow/underflow) or -1 (overflow/underflow occurred). - Applied bitwise operations to conditionally replace original values with boundary values (MIN or MAX) based on the computed masks. - This approach avoids branching, improves efficiency, and ensures accurate saturation within specified bit-width limits. Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
- Loading branch information
1 parent
c97bba3
commit 06939dd
Showing
2 changed files
with
100,221 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
Oops, something went wrong.