Skip to content

Volume: Fix overflow in s16 and s24 output conversions - #528

Merged
lgirdwood merged 1 commit into
thesofproject:masterfrom
singalsu:fix_volume_generic_overflow
Nov 6, 2018
Merged

lgirdwood merged 1 commit into
thesofproject:masterfrom
singalsu:fix_volume_generic_overflow

Conversation

@singalsu

@singalsu singalsu commented Nov 2, 2018

Copy link
Copy Markdown
Collaborator

The problem could be heard with extremely loud music content. The
32x32 saturating multiply function works for 32 bit output but
the result will overflow when less number of bits are used from output.

This patch adds to format.h rounded 32x32 multiply inline functions for
saturated s24 and s16 formats. The generic volume function is updated
to utilize them and the code structure is cleaned for easier maintenance
and simpler look.

The format.h file is cleaned up with function parameter indents and
remove of redundant code in saturate function.

Signed-off-by: Seppo Ingalsuo seppo.ingalsuo@linux.intel.com

The problem could be heard with extremely loud music content. The
32x32 saturating multiply function works for 32 bit output but
the result will overflow when less number of bits are used from output.

This patch adds to format.h rounded 32x32 multiply inline functions for
saturated s24 and s16 formats. The generic volume function is updated
to utilize them and the code structure is cleaned for easier maintenance
and simpler look.

The format.h file is cleaned up with function parameter indents and
remove of redundant code in saturate function.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu

singalsu commented Nov 2, 2018

Copy link
Copy Markdown
Collaborator Author

This fixes issue #416.

@juimonen juimonen left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

lgtm

@lgirdwood
lgirdwood merged commit 528870a into thesofproject:master Nov 6, 2018
@singalsu
singalsu deleted the fix_volume_generic_overflow branch May 18, 2020 08:53
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.

3 participants