Skip to content

sof: drc: fix drc_inv_fixed function and refine comments - #3810

Merged
lgirdwood merged 4 commits into
masterfrom
fix_drc_sin
Feb 22, 2021
Merged

sof: drc: fix drc_inv_fixed function and refine comments#3810
lgirdwood merged 4 commits into
masterfrom
fix_drc_sin

Conversation

@johnylin76

Copy link
Copy Markdown
Contributor

Used ABS(x) instead of x for comparing to ONE_OVERT_SQRT2(~0.707)
because x could be a negative value and here we want to transfrom x
from range (-1, -0.5];[0.5, 1) to (-1, -0.707];[0.707, 1)

Revised code line 237~241 to be easier to understand.

Refined some comments to prevent confusion of function usage.

Comment thread src/audio/drc/drc_math_generic.c

@ShriramShastry ShriramShastry left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes looks good!
int precision_inv; change to int32_t precision_inv;
change qc to QC

Comment thread src/audio/drc/drc_math_generic.c Outdated
Comment thread src/audio/drc/drc_math_generic.c Outdated
Comment thread src/audio/drc/drc_math_generic.c

@ShriramShastry ShriramShastry left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes looks fine

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Will get this into v1.7-rc2

@lgirdwood lgirdwood added this to the v1.7 milestone Feb 3, 2021
Used ABS(x) instead of x for comparing to ONE_OVERT_SQRT2(~0.707)
because x could be a negative value and here we want to transfrom x
from range (-1, -0.5];[0.5, 1) to (-1, -0.707];[0.707, 1)

And revised code line 233~237 to be easier to understand.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
@johnylin76

Copy link
Copy Markdown
Contributor Author

Split to 3 commits, PTAL thanks.

Comment thread src/audio/drc/drc_math_generic.c Outdated
Comment thread src/audio/drc/drc_math_generic.c Outdated
Comment thread src/audio/drc/drc_math_generic.c Outdated
The proposed calculation doesn't take negative or zero input-x into
consideration, and we also don't need such use cases. Just return 0
for those input-x.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
Refined some function comments to prevent confusion of usage.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
@cujomalainey

Copy link
Copy Markdown
Contributor

make it 1 to 32. Unsupported cases log(0)/log10(0)/log2(0) = -Inf

yep, range is now non inclusive of 0

Comment thread src/audio/drc/drc_math_generic.c
@lgirdwood

Copy link
Copy Markdown
Member

@johnylin76 I've tagged this for v1.7 rc2. DUe in 2 weeks, let me know if we should push this back.

@cujomalainey

Copy link
Copy Markdown
Contributor

@johnylin76 i think we are just missing the type fixes then we are good

@johnylin76

Copy link
Copy Markdown
Contributor Author

@johnylin76 i think we are just missing the type fixes then we are good

Finished the type fixes. Thanks a lot.

Comment thread src/audio/drc/drc_math_generic.c Outdated

@ShriramShastry ShriramShastry left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes looks fine

In order to make the algorithm portable to non-xtensa arch.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
inline int32_t drc_inv_fixed(int32_t x, int precision_x, int precision_y)
inline int32_t drc_inv_fixed(int32_t x, int32_t precision_x, int32_t precision_y)
{
#define qc 25

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can qc be defined in capital [QC] instead of small?

@ShriramShastry ShriramShastry left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes looks fine to me

@cujomalainey

Copy link
Copy Markdown
Contributor

Changes looks fine to me

@ShriramShastry if changes are good please mark "approved" when doing a code review.

@cujomalainey

Copy link
Copy Markdown
Contributor

Also, @ShriramShastry , we should look eventually at moving common math code to the math lib and de-duplicating functions used across multiple audio components

@lgirdwood

Copy link
Copy Markdown
Member

CI unrelated.

@lgirdwood
lgirdwood merged commit 3bc52f8 into master Feb 22, 2021
@lgirdwood
lgirdwood deleted the fix_drc_sin branch February 22, 2021 19:55
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.

5 participants