Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#12443 - Multichannel downmix for flac

Attached to Project: Rockbox
Opened by Andree Buschmann (Buschel) - Sunday, 11 December 2011, 01:00 GMT+2
Last edited by Andree Buschmann (Buschel) - Wednesday, 14 December 2011, 20:18 GMT+2
Task Type Patches
Category Codecs
Status Closed
Assigned To No-one
Player Type All players
Severity Low
Priority Normal
Reported Version Release 3.9
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Private No

Details

The attached patch implements multichannel-to-stereo downmixing for flac. For this all channels need to be decoded and saved in a dedicated sample buffer. For each channel configuration (3.0, 4.0, 5.0, 5.1) there is a matrix for the downmixing defined and applied.

The following file very clearly proves and shows the effect of the downmixing: http://download.linnrecords.com/test/flac/surround88.aspx
   flac_downmix_v01.patch (4.2 KiB)
 apps/codecs/libffmpegFLAC/decoder.c |   82 ++++++++++++++++++++++++++++++++++++
 apps/codecs/flac.c                  |    4 -
 2 files changed, 84 insertions(+), 2 deletions(-)

This task depends upon

Closed by  Andree Buschmann (Buschel)
Wednesday, 14 December 2011, 20:18 GMT+2
Reason for closing:  Accepted
Additional comments about closing:  Submitted with r31253
Comment by Andree Buschmann (Buschel) - Sunday, 11 December 2011, 11:14 GMT+2
Next version:
- Moved donwmix to an own function
- Moved scaling into downmixing to improve performance
- Avoid divisisions to improve performance

A sample file (5.1, 88.2 kHz, 24 bit) on iPod Video needs:
svn -> 96.8 MHz (no downmix, left/right only)
v02 -> 101.9 MHz (5.1-downmix)
   flac_downmix_v02.patch (5.1 KiB)
 apps/codecs/libffmpegFLAC/decoder.c |   90 ++++++++++++++++++++++++++++++++++--
 apps/codecs/flac.c                  |    4 -
 2 files changed, 89 insertions(+), 5 deletions(-)

Comment by Andree Buschmann (Buschel) - Sunday, 11 December 2011, 13:04 GMT+2
Now with manual changes as well.

ToDo's (maybe after the patch is in): A little more tweaking with IRAM allows a speed up of ~3 MHz on PP5022.
   flac_downmix_v04.patch (6.1 KiB)
 apps/codecs/libffmpegFLAC/decoder.c |   93 ++++++++++++++++++++++++++++++++++--
 apps/codecs/flac.c                  |    5 -
 manual/appendix/file_formats.tex    |    5 +
 3 files changed, 94 insertions(+), 9 deletions(-)

Comment by Jean-Louis Biasini (JeanLouisBiasini) - Sunday, 11 December 2011, 16:13 GMT+2
this is working on my device. (fuze+)
Comment by Jean-Louis Biasini (JeanLouisBiasini) - Sunday, 11 December 2011, 16:23 GMT+2
tested: patch v04 on both test file and a regular song, stereo flac still plays
Comment by MichaelGiacomelli (saratoga) - Sunday, 11 December 2011, 22:26 GMT+2
FWIW if you're concerned about speed, the rounding probably isn't needed for 32 bit samples.
Comment by Andree Buschmann (Buschel) - Monday, 12 December 2011, 06:57 GMT+2
You are talking about sections like "(b + (b<<2))>>5"? This is equal to b*(1+4)/32 = b*5/32 ~= 1/6, but avoids multiplication or division.

Loading...