-
Notifications
You must be signed in to change notification settings - Fork 349
sof: drc: Add DRC component with floating-point calculations #3415
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
Conversation
lgirdwood
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @singalsu any comments.
44d7e40 to
b11230b
Compare
|
I updated a compile-ok version of commit with the following modifications:
|
src/audio/drc/drc.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably OK, but this would be a very small value as linear :)
src/audio/drc/drc_generic.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing this is already in your list of things to do but probably good idea to write own fractional version of logf() to avoid the C float math library.
src/audio/drc/drc_generic.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you plan to keep the floats? It might be OK with HiFi3 already but better to check impact to code size and speed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we have the hifi spec handy, would need help managing that implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cujomalainey I'll help to get the spec to you. It's very useful.
src/audio/drc/drc_generic.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you plan to keep floats, would fast-math optimization avoid need for isnormal() check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are planning to remove floats. just doing floats initially for "get it up and running" then will move to fixed point
src/audio/drc/drc_generic.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sinf() looks expensive computationally. Is this executed when processing copy()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is called from copy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately all math functions in the latest code are called from copy, and will be called multiple times.
We will try to implement the approximated cheaper alternatives.
src/audio/drc/drc_generic.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would exponential settling of a recursive filter (IIR) be more economical to compute?
src/include/sof/audio/drc/drc_math.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a version in sof/math/decibels.h. Though I'm not sure if fit your needs. To achieve fast speed it's not as accurate expf(). The other way for lin2db is missing from there. If you plan to do a fractional version contributing there is welcome!
b11230b to
78ed966
Compare
|
Hi @singalsu , thanks for the detailed reviews. |
78ed966 to
2391fe0
Compare
|
The PR is updated. I have verified the functionality of DRC implementation by testbench, comparing input and output stream samples with the golden model - DRC kernel in ChromeOS user space. Note that this DRC firmware is still floating-point calculations. So of course the next step is to implement the fixed-point arithmetic version upon it. |
93a9758 to
c3082b0
Compare
|
@cujomalainey @johnylin76 should we merge the DRC once it's functionally correct and then incrementally merge the optimisations as they are ready ? I'm thinking this may reduce the technical debt that has to be carried and reduce the reviewer load ? |
|
I'm ok with merging floating point if you are @lgirdwood, i think that would be a good way to keep the review clean. |
@singalsu any comment. This would mean it would run on testbench (and would keep the review straight forward), not sure what other changes it would need to run on xtensa floating point though ? |
|
My guess is little to none, but it would likely be so slow that it would overrun every system we currently support |
|
@lgirdwood Currently I use a fake UUID since we haven't decide the UUID of DRC yet. Should we determine the UUID of DRC before merging? |
c3082b0 to
abee491
Compare
|
I also have implemented the delay-only mode which is used when DRC is disabled. Please refer to: |
|
@lgirdwood Also my +1 for merging floating point with testbench execute capability when OK for Johnny. It reduces effort to work with optimized version. I've noticed that recent platforms (TGL) have quite a lot more processing power, even gcc built beamformer survives in real-time, so even some light optimization might allow starting real time tests with DRC. |
Yes please, just use a UUID generation tool and attach it. We can change it when significant updates are made. Please also change PR from draft. |
This commit adds Dynamic Range Compression (DRC) to the list of SOF components. DRC in audio processing is intentional to reduce the volume of loud sounds and amplify the silent sounds as compressing an audio signal's dynamic range. This is the intermediate implementation with floating-point calculations. Signed-off-by: Pin-chih Lin <johnylin@google.com>
This commit adds the topology files for the drc component. The control bytes are generated by the tools in tune/drc. Signed-off-by: Pin-chih Lin <johnylin@google.com>
This commit adds the tools to generate the control bytes for the drc component. To generate the control bytes, run the example_drc.m script. To tweak the parameters modify the values in example_drc.m and run it. This is still WIP. A fixed set of coefficients is temporarily used in drc_generate_config.m Signed-off-by: Pin-chih Lin <johnylin@google.com>
Signed-off-by: Pin-chih Lin <johnylin@google.com>
Delay the input sample only and don't do other processing. This is used when the DRC is disabled. We want to do this to match the processing delay of other bands in multi-band DRC kernel case. Signed-off-by: Pin-chih Lin <johnylin@google.com>
abee491 to
e4cba04
Compare
Thanks. Done. Is is then for me to merge. |
|
@johnylin76 merged, now good for the next phase ! |
This commit adds Dynamic Range Compression (DRC) to the list of SOF
components. DRC in audio processing is intentional to reduce the
volume of loud sounds as compressing an audio signal's dynamic range.
This is still WIP.