Skip to content

Conversation

@singalsu
Copy link
Collaborator

@singalsu singalsu commented Mar 8, 2022

No description provided.

@singalsu
Copy link
Collaborator Author

singalsu commented Mar 8, 2022

The saving with default DRC configuration was measured from copy() function with added traces to measure execution time. The first test is for normal processing mode and stereo 48 kHz playback stream.

Screenshot from 2022-03-08 18-44-20

The upper row shows execution times with optimized code for s16/s24/s32 formats. The lower row is the same with original version. Based on average execution time the MCPS for optimized are 49.6, 48.8, and 48.8. The MCPS for original are 68.0, 67.6, and 67.2. The saving is 18.4 - 18.8 MCPS.

Note: The processing time for DRC varies a lot during first 10s time and then continues with nearly constant processing time near average.

@singalsu
Copy link
Collaborator Author

singalsu commented Mar 8, 2022

Next test is done for pass-through mode by commenting out line from drc_prepare()
cd->config = comp_get_data_blob(cd->model_handler, NULL, NULL);

Screenshot from 2022-03-08 19-11-50

The MCPS values drop from 22 to 6, the saving is 16 MCPS. The difference in s16/s24/s32 is very small.

@singalsu
Copy link
Collaborator Author

singalsu commented Mar 8, 2022

The last MCPS test is for the delayed but no-processing mode. It can be set from configuration blob or with runtime modification to configuration blob. I did it with added line cd->config->params.enabled = 0; to drc_prepare().

Screenshot from 2022-03-08 19-28-08

The MCPS average was improved from 21.4 to 7.1, saving is 14.4 MCPS.

@singalsu
Copy link
Collaborator Author

singalsu commented Mar 8, 2022

@johnylin76 I have checked the optimization with binary compare of testbench output for original vs. optimized and process_test('drc', 16, 16) (24 and 32 as well). I'll still redo the test for final version and listen some music in s16/s24/s32 formats before turning this to non-draft (to hear if there are glitches).

@lgirdwood
Copy link
Member

@cujomalainey @johnylin76 some DRC savings.

@johnylin76
Copy link
Contributor

Thanks for the great effort!!

@lgirdwood
Copy link
Member

CI has license server timeout. Rerun CI

/localdisk/tools/xtensa/RG-2017.8-linux/XtensaTools/bin/xt-xcc -DBLD_COUNTERS=0 -DRELATIVE_FILE=\"src/audio/tdfb/tdfb_hifiep.c\" -I/quickbuild/workspace1/24733/SOF_FW/src/platform/intel/cavs/include -I/quickbuild/workspace1/24733/SOF_FW/src/arch/xtensa/include -I/quickbuild/workspace1/24733/SOF_FW/src/arch/xtensa/xtos -I/quickbuild/workspace1/24733/SOF_FW/src/platform/tigerlake/include -I/localdisk/tools/xtensa/RG-2017.8-linux/cavs2x_LX6HiFi3_2017_8/xtensa-elf/arch/include -I/localdisk/tools/xtensa/RG-2017.8-linux/cavs2x_LX6HiFi3_2017_8/xtensa-elf/include -I/quickbuild/workspace1/24733/SOF_FW/src/include -I/quickbuild/workspace1/24733/SOF_FW/build_fw/generated/include -I/quickbuild/workspace1/24733/SOF_FW/third_party_include -nostdlib -fno-inline-functions -mlongcalls -O2 -g -Wall -Werror -Wl,-EL -Wmissing-prototypes -Wpointer-arith -mtext-section-literals -imacros/quickbuild/workspace1/24733/SOF_FW/build_fw/generated/include/autoconfig.h -MD -MT CMakeFiles/sof.dir/src/audio/tdfb/tdfb_hifiep.c.o -MF CMakeFiles/sof.dir/src/audio/tdfb/tdfb_hifiep.c.o.d -o CMakeFiles/sof.dir/src/audio/tdfb/tdfb_hifiep.c.o -c /quickbuild/workspace1/24733/SOF_FW/src/audio/tdfb/tdfb_hifiep.c
License checkout failed: No such feature exists.
Feature:       XTENSA_XCC_TIE
License path:  84300@xtensa01p.elic.intel.com:/localdisk/tools/xtensa/RG-2017.8-linux/XtensaTools/Tools/lic/license.dat:
FLEXnet Licensing error:-5,147.  System Error: 104 "Connection reset by peer"
For further information, refer to the FLEXnet Licensing documentation,
available at "www.macrovision.com".
CMakeFiles/sof.dir/build.make:215: recipe for target 'CMakeFiles/sof.dir/src/arch/xtensa/drivers/timer.c.o' failed
make[3]: *** [CMakeFiles/sof.dir/src/arch/xtensa/drivers/timer.c.o] Error 2
make[3]: *** Waiting for unfinished jobs....
License checkout failed: No such feature exists.
Feature:       XTENSA_XCC_TIE
License path:  84300@xtensa01p.elic.intel.com:/localdisk/tools/xtensa/RG-2017.8-linux/XtensaTools/Tools/lic/license.dat:
FLEXnet Licensing error:-5,147.  System Error: 115 "Operation now in progress"
For further information, refer to the FLEXnet Licensing documentation,
available at "www.macrovision.com".
CMakeFiles/sof.dir/build.make:603: recipe for target 'CMakeFiles/sof.dir/src/audio/src/src.c.o' failed
make[3]: *** [CMakeFiles/sof.dir/src/audio/src/src.c.o] Error 2
make[3]: Leaving directory '/quickbuild/workspace1/24733/SOF_FW/build_fw'
CMakeFiles/Makefile2:1399: recipe for target 'CMakeFiles/sof.dir/all' failed

@kkarask @wszypelt fyi

@lgirdwood
Copy link
Member

SOFCI TEST

@kkarask
Copy link

kkarask commented Mar 14, 2022

@lgirdwood thanks for notification, CI tests already passed.

@lgirdwood
Copy link
Member

@singalsu can you fix the conflict. Thanks

@gkbldcig
Copy link
Collaborator

Can one of the admins verify this patch?

@lgirdwood
Copy link
Member

@singalsu can you fix the conflict.

Copy link
Contributor

Choose a reason for hiding this comment

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

this feels generic enough to be in audio_stream.h

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep. I think I'll change this to use audio_stream_samples_without_wrap_sXX() functions those I did after this PR, it will look a bit cleaner.

@lgirdwood
Copy link
Member

@singalsu ping

This patch replaces the audio_stream_read/write_frag_s16/s32
functions based source buffer read and sink buffer write with
audio_stream_bytes_without_wrap() based blocks access.

The drc_s16/s24/s32_default processing functions are simplified
by move of common delay input sample operation to separate
function. The same function is used in DRC disabled and enabled
part of processing functions.

The pass-through mode is optimized with generic audio_stream_copy()
that is a common function for all s16/s24/s32 formats.

The MCPS savings are in TGL-H for stereo 48 kHz stream
- Normal operation 68 to 50 MCPS, saving 18 MCPS
- Pass-through without delay 22 to 6 MCPS, saving 16 MCPS
- Pass-through with delay 21 to 7 MCPS, saving is 14 MCPS

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch enables testing of DRC in HDA generic devices by adding
it to headset/speaker pipeline after mixer.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu singalsu force-pushed the drc_read_write_frag_optimize branch from bbe51cd to 29cba70 Compare April 22, 2022 09:18
@singalsu singalsu requested a review from cujomalainey April 22, 2022 09:24
@singalsu singalsu requested a review from lkoenig April 22, 2022 09:24
Copy link
Contributor

@lkoenig lkoenig left a comment

Choose a reason for hiding this comment

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

This is a really nice change. Thanks you.

@lgirdwood lgirdwood merged commit 09a4aa8 into thesofproject:main Apr 25, 2022
Copy link
Contributor

@cujomalainey cujomalainey left a comment

Choose a reason for hiding this comment

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

Sorry for the late review, LGTM

@singalsu singalsu deleted the drc_read_write_frag_optimize branch September 15, 2022 13:17
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.

7 participants