-
Notifications
You must be signed in to change notification settings - Fork 370
Audio: Volume: Fix the ramping and ZC mode align #10704
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
07815d2
Audio: Audio Stream: Add function to calculate aligned number of frames
singalsu 531c255
Audio: Volume: Fix the ramping and ZC mode align
singalsu ab79b4e
Audio: Volume: Set align constraints for source only
singalsu 20c06c4
Audio: Set default audio stream align to SOF_FRAME_BYTE_ALIGN
singalsu 2427f43
Audio: Modify audio_stream_avail_frames_aligned() to align for source
singalsu 40eac58
Audio: Do not set sink align constraints in modules and use default
singalsu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -612,6 +612,52 @@ audio_stream_avail_frames_aligned(const struct audio_stream *source, | |
| return MIN(src_frames, sink_frames); | ||
| } | ||
|
|
||
| /** | ||
| * Rounds down a frame count to meet the alignment constraint of the stream. | ||
| * @param stream Audio stream with alignment requirements set. | ||
| * @param frames Frame count to round down. | ||
| * @return Largest aligned frame count less than or equal to frames. | ||
| */ | ||
| static inline uint32_t audio_stream_align_frames_round_down(const struct audio_stream *stream, | ||
| uint32_t frames) | ||
| { | ||
| uint16_t align = stream->runtime_stream_params.align_frame_cnt; | ||
|
|
||
| return ROUND_DOWN(frames, align); | ||
| } | ||
|
|
||
| /** | ||
| * Rounds up a frame count to meet the alignment constraint of the stream. | ||
| * @param stream Audio stream with alignment requirements set. | ||
| * @param frames Frame count to round up. | ||
| * @return Smallest aligned frame count greater than or equal to frames. | ||
| */ | ||
| static inline uint32_t audio_stream_align_frames_round_up(const struct audio_stream *stream, | ||
| uint32_t frames) | ||
| { | ||
| uint16_t align = stream->runtime_stream_params.align_frame_cnt; | ||
| uint32_t aligned_frames = ROUND_DOWN(frames, align); | ||
|
|
||
| if (aligned_frames < frames) | ||
| aligned_frames += align; | ||
|
|
||
| return aligned_frames; | ||
| } | ||
|
|
||
| /** | ||
| * Rounds to nearest a frame count to meet the alignment constraint of the stream. | ||
| * @param stream Audio stream with alignment requirements set. | ||
| * @param frames Frame count to round to nearest. | ||
| * @return Aligned frame count. | ||
| */ | ||
| static inline uint32_t audio_stream_align_frames_round_nearest(const struct audio_stream *stream, | ||
| uint32_t frames) | ||
| { | ||
| uint16_t align = stream->runtime_stream_params.align_frame_cnt; | ||
|
|
||
| return ROUND_DOWN(frames + (align >> 1), align); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need proper |
||
| } | ||
|
|
||
| /** | ||
| * Updates the buffer state after writing to the buffer. | ||
| * @param buffer Buffer to update. | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.