Skip to content

topology: add macro to support multiple fir iir eq filters - #2660

Merged
lgirdwood merged 2 commits into
thesofproject:masterfrom
fredoh9:fix/tplg_fir_iir_enhance
Apr 7, 2020
Merged

lgirdwood merged 2 commits into
thesofproject:masterfrom
fredoh9:fix/tplg_fir_iir_enhance

Conversation

@fredoh9

@fredoh9 fredoh9 commented Mar 29, 2020 •

Copy link
Copy Markdown
Contributor

The patch shows a proposal how to propagate pipeline filter
coefficients data definition at topology top level. It is an
useful way to avoid to create different new pipeline macros for
different filter. Define filter coefficients data with macro
DEF_EQFIR_PRIV and DEF_EQFIR_COEF, which will be replaced
unique name by adding PIPELINE number. For IIR filter, equivalent macro
is DEF_EQIIR_PRIV and DEF_EQIIR_COEF.

Makefile define each pipeline processing HSEARPROC, HSMICRPOC, SPKPROC,
DMICPROC etc. Each variable should support default value to minimize
current topologies. When new filter blob is required, define
PIPELINE_FILTERx in makefile. This method provides more flexible way
to support variable number of filters in the pipeline.

The other clean up for topology macros include definions for unique
volume tokens and unique filter coefficient definitions.

Signed-off-by: Fred Oh fred.oh@linux.intel.com

Related issues: #2535, #2534

@fredoh9
fredoh9 requested a review from singalsu March 30, 2020 00:37

@singalsu singalsu left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry for causing a misunderstanding. The applying of low-pass into CML RM5682 should not be up-streamed. Only the general technique to pass from topology top level or even makefile the filter blob reference is the part that's needed. The low-pass FIR was an experiment to attenuate bits corruption effect that happened in this platform due to SSP clocks issue and the capability to conceal the issue fir FIR was weak. So, please change the topic of this PR to reflect the processing define updates and drop totally the 7 kHz low-pass blob. The brick-wall FIR is not a very good demo response and it's hard to measure the stop-band spec due to to lot of attenuation.

The demo case to upstream for the technique could be maybe an alternative topology with bass boost IIR or loudness IIR applied (I can make PR for the the m4 filter blobs today -- I need them for testbench usage as well as test response) to headset output PCM with pipe-eq-iir-volume-playback.m4. Also the various 40 Hz high-pass with gain (20 dB) and without should be cleaned up and implemented this way with generic filter blob reference and pipe-eq-iir-volume-capture.m4. Then we would have test cases for both playback and capture EQ.

I can also email to you the demo blobs to let you continue immediately with them and not wait for my PR to get merged. If you'd like to include them to your PR I can close my coming PR. We can proceed like you prefer with them!

Instead of defining keyword lowpass and interpreting it in pipeline macro the macro should get the filename reference directly. There would be eventually tons of this kind keywords and the maintenance would be impossible and at top level no idea what coefficients set gets requested. Even of top level gets a bit clutter I'd prefer that. Since the processing effect is strong it should be very visible at upper level to not accidentally enable something not desired.

Also this approach does not seem to enable to define at top level filter blobs for this kind of speaker rendering pipeline:

PCM --> EQ-IIR --> EQ-FIR --> volume --> DAI

The needs to be a way to pass the separate m4 coefficients blobs for IIR and FIR the pipeline. Currently we don't have more than max. two processing components (+volume) in pipeline but in future there can be more, e.g. three or four. So this system should scale up a bit from this proposal.

Note: I've done several edits to this while trying to make my mind so please ignore the intermediate versions emails you've possibly received.

Comment thread tools/topology/CMakeLists.txt Resolved
Comment thread tools/topology/CMakeLists.txt Resolved
Comment thread tools/topology/m4/eq_fir_coef_flat.m4 Resolved
Comment thread tools/topology/m4/eq_iir_coef_flat.m4 Resolved
Comment thread tools/topology/sof-cml-rt5682.m4 Resolved
@singalsu

Copy link
Copy Markdown
Collaborator

@fredoh9 I added with PR #2667 new FIR and IIR EQ m4 blobs those can be used for testing and as examples. There's responses like loudness and bass boost for FIR and IIR those are easy to verify subjectively or by measurement if set up in topology.

@fredoh9
fredoh9 force-pushed the fix/tplg_fir_iir_enhance branch from 3c46031 to 53de585 Compare March 31, 2020 20:04
@fredoh9 fredoh9 changed the title topology: low-pass capture FIR for sof-cml-rt5682 [WIP] topology: add macro to support multiple fir iir eq filters Mar 31, 2020
@fredoh9

fredoh9 commented Mar 31, 2020

Copy link
Copy Markdown
Contributor Author

I updated to address @singalsu comments. I changed title and put [WIP] as I added some examples which may not need to go to master. Or I may need to add some more real life examples to demonstrate this changes. I'm pretty sure this provide very flexible way to add more topology with different piplines.

@fredoh9
fredoh9 requested a review from singalsu March 31, 2020 20:13
@fredoh9
fredoh9 force-pushed the fix/tplg_fir_iir_enhance branch 2 times, most recently from 710c67b to 41aec89 Compare April 1, 2020 15:19
@fredoh9 fredoh9 changed the title [WIP] topology: add macro to support multiple fir iir eq filters topology: add macro to support multiple fir iir eq filters Apr 1, 2020
@fredoh9

fredoh9 commented Apr 1, 2020 •

Copy link
Copy Markdown
Contributor Author

@singalsu
HSMICPROC, HSEARPROC, DMICPROC are defined in sof-cml-rt5682 pipes.

Default response is flat for iir and fir filters. It can be set by makefile, PIPELINE_FILTER1 or PIPELINE_FILTER2.

CMakeLists.txt changes for demonstration for usage of this PR. By default, fir/iir flat coefficient is set. One of topology overrides fir flat with fir loudness.

	"sof-cml-rt5682\;sof-cml-eq-fir-rt5682\;-DPLATFORM=cml\;-DHSMICPROC=eq-fir-volume"
	"sof-cml-rt5682\;sof-cml-eq-fir-loud-rt5682\;-DPLATFORM=cml\;-DHSMICPROC=eq-fir-volume\;-DPIPELINE_FILTER1=eq_fir_coef_loudness.m4"
	"sof-cml-rt5682\;sof-cml-eq-iir-rt5682\;-DPLATFORM=cml\;-DHSEARPROC=eq-iir-volume"

Comment thread tools/topology/CMakeLists.txt Resolved
Comment thread tools/topology/sof-cml-rt5682.m4 Outdated

@singalsu singalsu Apr 2, 2020 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since this is direct attach DMIC the default should be eq-iir-volume and filter blob 40 Hz high-pass for 48 kHz for dmic01 and 40 Hz highpass for 16 kHz for dmic16k. The gain can be the 0 dB version.

This reveals need for added DMIC16KPROC and DMIC16K_FILTER1 macros handling to get different filter blob for 16 kHz pipeline. The DMICPROC could be reused but for flexibility better to have them separated.

Comment thread tools/topology/CMakeLists.txt Resolved
@singalsu

singalsu commented Apr 2, 2020 •

Copy link
Copy Markdown
Collaborator

Good work, thanks! I proposed some changes for processing setup for enhanced topologies. Also need to add the upper endpoint specific layer for PIPELINE_FILTERx. Also I realized that we need to be able to differentiate the filter configs for 48 kHz and 16 kHz DMIC DAI. But you've done most of the work so those are fairly small further edits.

The patch shows a proposal how to propagate pipeline filter
coefficients data definition at topology top level. It is an
useful way to avoid to create different new pipeline macros for
different filter. Define filter coefficients data with macro
DEF_EQFIR_PRIV and DEF_EQFIR_COEF, which will be replaced
unique name by adding PIPELINE number. For IIR filter, equivalent macro
is DEF_EQIIR_PRIV and DEF_EQIIR_COEF.

Makefile define each pipeline processing HSEARPROC, HSMICRPOC, SPKPROC,
DMICPROC etc. Each variable should support default value to minimize
current topologies. When new filter blob is required, define
PIPELINE_FILTERx in makefile. This method provides more flexible way
to support variable number of filters in the pipeline.

The other clean up for topology macros include definions for unique
volume tokens and unique filter coefficient definitions.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
@fredoh9
fredoh9 force-pushed the fix/tplg_fir_iir_enhance branch from 41aec89 to 77adb46 Compare April 3, 2020 02:44
@fredoh9
fredoh9 requested a review from singalsu April 3, 2020 02:45
@fredoh9
fredoh9 force-pushed the fix/tplg_fir_iir_enhance branch from 77adb46 to 55fe276 Compare April 3, 2020 13:34

@singalsu singalsu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, this is OK for now. In the next step when PIPELINE_FILTERx is definable per end-point we can make more interesting topology variants.

@singalsu

singalsu commented Apr 3, 2020

Copy link
Copy Markdown
Collaborator

The CI checks output will be interesting. Please update your PR if there are issues.

Comment thread tools/topology/sof-cml-rt5682.m4 Resolved
@fredoh9
fredoh9 force-pushed the fix/tplg_fir_iir_enhance branch from 55fe276 to 1f7de36 Compare April 3, 2020 14:22
@fredoh9

fredoh9 commented Apr 3, 2020

Copy link
Copy Markdown
Contributor Author

Thanks, this is OK for now. In the next step when PIPELINE_FILTERx is definable per end-point we can make more interesting topology variants.

I will create new issue to follow up this.

@fredoh9
fredoh9 force-pushed the fix/tplg_fir_iir_enhance branch from 1f7de36 to da9050b Compare April 3, 2020 15:44
For headset playback or capture, default pipe is volume. If The high pass
filter is required to prevent HDA codec headset glitches, it can be set by
HSMICPROC=eq-iir-volume. It use use 40 Hz high pass filter with +0 db
boost. If there is DMIC, this set default pipe as eq-iir, which use
the same 40 Hz high-pass filter too. For DMIC16K, 40 Hz high-pass for 16khz
version filter is used.

Default coefficient for FIR/IIR is changed fr m coef flat to coef pass.
Pass configuration has the advantage of low system load.
    eq_fir_coef_flat.m4 to eq_fir_coef_pass.m4
    eq_iir_coef_flat.m4 to eq_iir_coef_pass.m4

Below pipe files are renamed for naming convention,
    pipe-eq-volume-playback.m4 -> pipe-eq-iir-eq-fir-volume-playback.m4
    pipe-eq-capture-16khz.m4 -> pipe-eq-iir-volume-capture-16khz.m4
    pipe-eq-capture.m4 -> pipe-eq-iir-volume-capture.m4

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
@fredoh9

fredoh9 commented Apr 3, 2020

Copy link
Copy Markdown
Contributor Author

Thanks, this is OK for now. In the next step when PIPELINE_FILTERx is definable per end-point we can make more interesting topology variants.

I will create new issue to follow up this.

#2707 is created

@fredoh9

fredoh9 commented Apr 6, 2020

Copy link
Copy Markdown
Contributor Author

SOFCI TEST

@lgirdwood

Copy link
Copy Markdown
Member

CI known issues.

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.

4 participants