Rockbox

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

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#11079 - musepack sv8 support

Attached to Project: Rockbox
Opened by Andree Buschmann (Buschel) - Friday, 05 March 2010, 21:18 GMT+2
Last edited by Andree Buschmann (Buschel) - Sunday, 07 March 2010, 21:30 GMT+2
Task Type Patches
Category Codecs
Status Closed
Assigned To Andree Buschmann (Buschel)
Player Type All players
Severity Low
Priority Normal
Reported Version Release 3.4
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Private No

Details

This patch exchanges the current svn musepack decoder against the current official decoder from musepack.net (r458). With this patch musepack sv8 is supported in addition to svn's sv7 -- including playback and seek. For better performance r458 was merged against rockbox svn to use the already highly optimized filterbanks.

Remarks:
1) Building with this patch will throw several warnings. I am working on this.
2) Tested on pcsim and arm. Results on coldfire are still needed, appreciated and helpful.
3) Decoding is still slower than svn for now (arm svn ~22MHz, arm patched ~27MHz).
4) The metadata check does still use dummy results for sv8 streams.

sv7 and sv8 streams for testing can be found at http://samples.mplayerhq.hu/A-codecs/musepack/
   mpc_sv8_v01.patch (275 KiB)
 apps/metadata/mpc.c                        |    4 
 apps/plugins/SOURCES                       |    3 
 apps/codecs/libmusepack/config_types.h     |   51 
 apps/codecs/libmusepack/mpc_decoder.c      | 1976 ++++++-----------------------
 apps/codecs/libmusepack/AUTHORS            |    2 
 apps/codecs/libmusepack/reader.h           |   66 
 apps/codecs/libmusepack/mpc_types.h        |  149 ++
 apps/codecs/libmusepack/mpcdec_math.h      |  239 +++
 apps/codecs/libmusepack/decoder.h          |  120 -
 apps/codecs/libmusepack/crc32.c            |   56 
 apps/codecs/libmusepack/musepack.h         |  163 --
 apps/codecs/libmusepack/requant.c          |   95 -
 apps/codecs/libmusepack/mpc_bits_reader.c  |  179 ++
 apps/codecs/libmusepack/requant.h          |   36 
 apps/codecs/libmusepack/mpc_bits_reader.h  |  149 ++
 apps/codecs/libmusepack/config-mpc.h       |  105 -
 apps/codecs/libmusepack/synth_filter_arm.S |    2 
 apps/codecs/libmusepack/mpcmath.h          |  155 ++
 apps/codecs/libmusepack/math.h             |  237 ---
 apps/codecs/libmusepack/mpcdec.h           |  172 ++
 apps/codecs/libmusepack/SOURCES            |    7 
 apps/codecs/libmusepack/datatypes.h        |   38 
 apps/codecs/libmusepack/ChangeLog          |   28 
 apps/codecs/libmusepack/streaminfo.c       |  376 ++---
 apps/codecs/libmusepack/minimax.h          |   57 
 apps/codecs/libmusepack/mpc_config.h       |   50 
 apps/codecs/libmusepack/synth_filter.c     |   12 
 apps/codecs/libmusepack/huffsv46.c         |   75 -
 apps/codecs/libmusepack/streaminfo.h       |   89 -
 apps/codecs/libmusepack/README             |    8 
 apps/codecs/libmusepack/internal.h         |   89 -
 apps/codecs/libmusepack/mpc_demux.c        |  665 +++++++++
 apps/codecs/libmusepack/README.rockbox     |   27 
 apps/codecs/libmusepack/huffman.c          |  358 +++++
 apps/codecs/libmusepack/mainpage.h         |   38 
 apps/codecs/libmusepack/huffsv7.c          |   81 -
 apps/codecs/libmusepack/idtag.c            |   83 -
 apps/codecs/libmusepack/huffman.h          |   56 
 apps/codecs/mpc.c                          |  109 -
 39 files changed, 3231 insertions(+), 2974 deletions(-)

This task depends upon

Closed by  Andree Buschmann (Buschel)
Sunday, 07 March 2010, 21:30 GMT+2
Reason for closing:  Accepted
Additional comments about closing:  Committed with r25057.
Comment by Andree Buschmann (Buschel) - Saturday, 06 March 2010, 01:18 GMT+2
Next patch version:
- removed tabs
- removed compile warnings (3 warnings were inserted as reminder)
- put some more stuff to iram

Speed on iPod Video is decent now: 22.6 MHz.
Speed on other targets will need some more work as a major data structure could not been moved to iram yet.
   mpc_sv8_v02.patch (287.8 KiB)
 apps/metadata/mpc.c                        |    5 
 apps/plugins/SOURCES                       |    3 
 apps/codecs/libmusepack/config_types.h     |   51 
 apps/codecs/libmusepack/mpc_decoder.c      | 1928 ++++++-----------------------
 apps/codecs/libmusepack/AUTHORS            |    2 
 apps/codecs/libmusepack/reader.h           |   66 
 apps/codecs/libmusepack/mpc_types.h        |  148 ++
 apps/codecs/libmusepack/mpcdec_math.h      |  238 +++
 apps/codecs/libmusepack/decoder.h          |  118 -
 apps/codecs/libmusepack/crc32.c            |   56 
 apps/codecs/libmusepack/musepack.h         |  163 --
 apps/codecs/libmusepack/requant.c          |   90 -
 apps/codecs/libmusepack/mpc_bits_reader.c  |  179 ++
 apps/codecs/libmusepack/requant.h          |   36 
 apps/codecs/libmusepack/mpc_bits_reader.h  |  149 ++
 apps/codecs/libmusepack/config-mpc.h       |  105 -
 apps/codecs/libmusepack/synth_filter_arm.S |    2 
 apps/codecs/libmusepack/mpcmath.h          |  155 ++
 apps/codecs/libmusepack/math.h             |  237 ---
 apps/codecs/libmusepack/mpcdec.h           |  175 ++
 apps/codecs/libmusepack/SOURCES            |    7 
 apps/codecs/libmusepack/datatypes.h        |   38 
 apps/codecs/libmusepack/ChangeLog          |   28 
 apps/codecs/libmusepack/streaminfo.c       |  373 ++---
 apps/codecs/libmusepack/minimax.h          |   57 
 apps/codecs/libmusepack/mpc_config.h       |   50 
 apps/codecs/libmusepack/synth_filter.c     |   30 
 apps/codecs/libmusepack/huffsv46.c         |   75 -
 apps/codecs/libmusepack/streaminfo.h       |   89 -
 apps/codecs/libmusepack/README             |    8 
 apps/codecs/libmusepack/internal.h         |   89 -
 apps/codecs/libmusepack/mpc_demux.c        |  665 ++++++++++
 apps/codecs/libmusepack/README.rockbox     |   27 
 apps/codecs/libmusepack/huffman.c          |  361 +++++
 apps/codecs/libmusepack/mainpage.h         |   38 
 apps/codecs/libmusepack/huffsv7.c          |   81 -
 apps/codecs/libmusepack/idtag.c            |   83 -
 apps/codecs/libmusepack/huffman.h          |   56 
 apps/codecs/mpc.c                          |  109 -
 39 files changed, 3211 insertions(+), 2959 deletions(-)

Comment by Andree Buschmann (Buschel) - Saturday, 06 March 2010, 14:31 GMT+2
Final (?) patch version:
- reformated lots of tables
- moved some more tables to iram
- rearranged decoder's data structure to fit it into iram on most targets
- adapted handling of first frame (cutting first samples) to non-interleaved sample format
- fully implemented metadata for mpc sv8
   mpc_sv8_v06.patch (295.2 KiB)
 apps/metadata/mpc.c                        |   92 +
 apps/plugins/SOURCES                       |    3 
 apps/codecs/libmusepack/config_types.h     |   51 
 apps/codecs/libmusepack/mpc_decoder.c      | 1961 ++++++-----------------------
 apps/codecs/libmusepack/AUTHORS            |    2 
 apps/codecs/libmusepack/reader.h           |   66 
 apps/codecs/libmusepack/mpc_types.h        |  148 ++
 apps/codecs/libmusepack/mpcdec_math.h      |  238 +++
 apps/codecs/libmusepack/decoder.h          |  118 -
 apps/codecs/libmusepack/crc32.c            |   56 
 apps/codecs/libmusepack/musepack.h         |  163 --
 apps/codecs/libmusepack/requant.c          |   90 -
 apps/codecs/libmusepack/mpc_bits_reader.c  |  179 ++
 apps/codecs/libmusepack/requant.h          |   36 
 apps/codecs/libmusepack/mpc_bits_reader.h  |  149 ++
 apps/codecs/libmusepack/config-mpc.h       |  105 -
 apps/codecs/libmusepack/synth_filter_arm.S |    2 
 apps/codecs/libmusepack/mpcmath.h          |  155 ++
 apps/codecs/libmusepack/math.h             |  237 ---
 apps/codecs/libmusepack/mpcdec.h           |  184 ++
 apps/codecs/libmusepack/SOURCES            |    7 
 apps/codecs/libmusepack/datatypes.h        |   38 
 apps/codecs/libmusepack/ChangeLog          |   28 
 apps/codecs/libmusepack/streaminfo.c       |  374 ++---
 apps/codecs/libmusepack/minimax.h          |   57 
 apps/codecs/libmusepack/mpc_config.h       |   50 
 apps/codecs/libmusepack/synth_filter.c     |   30 
 apps/codecs/libmusepack/huffsv46.c         |   75 -
 apps/codecs/libmusepack/streaminfo.h       |   89 -
 apps/codecs/libmusepack/README             |    8 
 apps/codecs/libmusepack/internal.h         |   89 -
 apps/codecs/libmusepack/mpc_demux.c        |  664 +++++++++
 apps/codecs/libmusepack/README.rockbox     |   27 
 apps/codecs/libmusepack/huffman.c          |  530 +++++++
 apps/codecs/libmusepack/mainpage.h         |   38 
 apps/codecs/libmusepack/huffsv7.c          |   81 -
 apps/codecs/libmusepack/idtag.c            |   83 -
 apps/codecs/libmusepack/huffman.h          |   56 
 apps/codecs/mpc.c                          |  109 -
 39 files changed, 3500 insertions(+), 2968 deletions(-)

Comment by Andree Buschmann (Buschel) - Saturday, 06 March 2010, 19:55 GMT+2
Important change in sv8 calculation of replay gain.
   mpc_sv8_v11.patch (288.9 KiB)
 apps/metadata/mpc.c                        |  113 +
 apps/plugins/SOURCES                       |    3 
 apps/codecs/libmusepack/config_types.h     |   51 
 apps/codecs/libmusepack/mpc_decoder.c      | 1961 ++++++-----------------------
 apps/codecs/libmusepack/AUTHORS            |    2 
 apps/codecs/libmusepack/reader.h           |   66 
 apps/codecs/libmusepack/mpc_types.h        |  148 ++
 apps/codecs/libmusepack/mpcdec_math.h      |  231 +++
 apps/codecs/libmusepack/decoder.h          |  118 -
 apps/codecs/libmusepack/crc32.c            |   56 
 apps/codecs/libmusepack/musepack.h         |  163 --
 apps/codecs/libmusepack/requant.c          |   90 -
 apps/codecs/libmusepack/mpc_bits_reader.c  |  179 ++
 apps/codecs/libmusepack/requant.h          |   36 
 apps/codecs/libmusepack/mpc_bits_reader.h  |  149 ++
 apps/codecs/libmusepack/config-mpc.h       |  105 -
 apps/codecs/libmusepack/synth_filter_arm.S |    2 
 apps/codecs/libmusepack/math.h             |  237 ---
 apps/codecs/libmusepack/mpcdec.h           |  184 ++
 apps/codecs/libmusepack/SOURCES            |    7 
 apps/codecs/libmusepack/ChangeLog          |   28 
 apps/codecs/libmusepack/streaminfo.c       |  374 ++---
 apps/codecs/libmusepack/minimax.h          |   57 
 apps/codecs/libmusepack/mpc_config.h       |   50 
 apps/codecs/libmusepack/synth_filter.c     |   30 
 apps/codecs/libmusepack/huffsv46.c         |   75 -
 apps/codecs/libmusepack/streaminfo.h       |   89 -
 apps/codecs/libmusepack/README             |    6 
 apps/codecs/libmusepack/internal.h         |   89 -
 apps/codecs/libmusepack/mpc_demux.c        |  658 +++++++++
 apps/codecs/libmusepack/README.rockbox     |   27 
 apps/codecs/libmusepack/huffman.c          |  530 +++++++
 apps/codecs/libmusepack/mainpage.h         |   38 
 apps/codecs/libmusepack/huffsv7.c          |   81 -
 apps/codecs/libmusepack/idtag.c            |   83 -
 apps/codecs/libmusepack/huffman.h          |   56 
 apps/codecs/mpc.c                          |  109 -
 manual/appendix/file_formats.tex           |    2 
 38 files changed, 3310 insertions(+), 2973 deletions(-)

Comment by Andree Buschmann (Buschel) - Saturday, 06 March 2010, 23:32 GMT+2
Works on pcsim, arm (iPod 5G) and coldfire (H140, tested by AlexP on irc).
Still slower as svn for coldfire (svn: ~25 MHz, patch: ~32 MHz).
   mpc_sv8_v14.patch (289.6 KiB)
 apps/metadata/mpc.c                        |  126 +
 apps/plugins/SOURCES                       |    3 
 apps/codecs/libmusepack/config_types.h     |   51 
 apps/codecs/libmusepack/mpc_decoder.c      | 1961 ++++++-----------------------
 apps/codecs/libmusepack/AUTHORS            |    2 
 apps/codecs/libmusepack/reader.h           |   66 
 apps/codecs/libmusepack/mpc_types.h        |  148 ++
 apps/codecs/libmusepack/mpcdec_math.h      |  231 +++
 apps/codecs/libmusepack/decoder.h          |  118 -
 apps/codecs/libmusepack/crc32.c            |   56 
 apps/codecs/libmusepack/musepack.h         |  163 --
 apps/codecs/libmusepack/requant.c          |   90 -
 apps/codecs/libmusepack/mpc_bits_reader.c  |  179 ++
 apps/codecs/libmusepack/requant.h          |   36 
 apps/codecs/libmusepack/mpc_bits_reader.h  |  149 ++
 apps/codecs/libmusepack/config-mpc.h       |  105 -
 apps/codecs/libmusepack/synth_filter_arm.S |    2 
 apps/codecs/libmusepack/math.h             |  237 ---
 apps/codecs/libmusepack/mpcdec.h           |  184 ++
 apps/codecs/libmusepack/SOURCES            |    7 
 apps/codecs/libmusepack/ChangeLog          |   28 
 apps/codecs/libmusepack/streaminfo.c       |  374 ++---
 apps/codecs/libmusepack/minimax.h          |   57 
 apps/codecs/libmusepack/mpc_config.h       |   50 
 apps/codecs/libmusepack/synth_filter.c     |   32 
 apps/codecs/libmusepack/huffsv46.c         |   75 -
 apps/codecs/libmusepack/streaminfo.h       |   89 -
 apps/codecs/libmusepack/README             |    6 
 apps/codecs/libmusepack/internal.h         |   89 -
 apps/codecs/libmusepack/mpc_demux.c        |  658 +++++++++
 apps/codecs/libmusepack/README.rockbox     |   27 
 apps/codecs/libmusepack/huffman.c          |  530 +++++++
 apps/codecs/libmusepack/mainpage.h         |   38 
 apps/codecs/libmusepack/huffsv7.c          |   81 -
 apps/codecs/libmusepack/idtag.c            |   83 -
 apps/codecs/libmusepack/huffman.h          |   56 
 apps/codecs/mpc.c                          |  109 -
 manual/appendix/file_formats.tex           |    2 
 38 files changed, 3323 insertions(+), 2975 deletions(-)

Comment by Andree Buschmann (Buschel) - Sunday, 07 March 2010, 14:57 GMT+2
Rearranged demux data structure to be able to move parts of it to IRAM. This speeds up the decoding on coldfire.

Speed on arm (iPod 5.5G) is 22.5 MHz (svn: 22.2 MHz).
Speed on coldfire (h130) is 29.7 MHz (svn: 25.3 MHz).

Measurements by AlexP on irc showed clearly that the main difference in speed on coldfire is located in the bitstream demuxing only (new decoder is about 4 MHz slower in this area). A major change of the new decoder is that it does uses a byte bitstream buffer instead of dword bitstream buffer.
   mpc_sv8_v19.patch (290.4 KiB)
 apps/metadata/mpc.c                        |  126 +
 apps/plugins/SOURCES                       |    3 
 apps/codecs/libmusepack/config_types.h     |   51 
 apps/codecs/libmusepack/mpc_decoder.c      | 1961 ++++++-----------------------
 apps/codecs/libmusepack/AUTHORS            |    2 
 apps/codecs/libmusepack/reader.h           |   66 
 apps/codecs/libmusepack/mpc_types.h        |  148 ++
 apps/codecs/libmusepack/mpcdec_math.h      |  231 +++
 apps/codecs/libmusepack/decoder.h          |  118 -
 apps/codecs/libmusepack/crc32.c            |   56 
 apps/codecs/libmusepack/musepack.h         |  163 --
 apps/codecs/libmusepack/requant.c          |   90 -
 apps/codecs/libmusepack/mpc_bits_reader.c  |  179 ++
 apps/codecs/libmusepack/requant.h          |   36 
 apps/codecs/libmusepack/mpc_bits_reader.h  |  149 ++
 apps/codecs/libmusepack/config-mpc.h       |  105 -
 apps/codecs/libmusepack/synth_filter_arm.S |    2 
 apps/codecs/libmusepack/math.h             |  237 ---
 apps/codecs/libmusepack/mpcdec.h           |  184 ++
 apps/codecs/libmusepack/SOURCES            |    7 
 apps/codecs/libmusepack/ChangeLog          |   28 
 apps/codecs/libmusepack/streaminfo.c       |  377 ++---
 apps/codecs/libmusepack/minimax.h          |   57 
 apps/codecs/libmusepack/mpc_config.h       |   50 
 apps/codecs/libmusepack/synth_filter.c     |   34 
 apps/codecs/libmusepack/huffsv46.c         |   75 -
 apps/codecs/libmusepack/streaminfo.h       |   90 -
 apps/codecs/libmusepack/README             |    6 
 apps/codecs/libmusepack/internal.h         |   89 -
 apps/codecs/libmusepack/mpc_demux.c        |  661 +++++++++
 apps/codecs/libmusepack/README.rockbox     |   27 
 apps/codecs/libmusepack/huffman.c          |  530 +++++++
 apps/codecs/libmusepack/mainpage.h         |   38 
 apps/codecs/libmusepack/huffsv7.c          |   81 -
 apps/codecs/libmusepack/idtag.c            |   83 -
 apps/codecs/libmusepack/huffman.h          |   56 
 apps/codecs/mpc.c                          |  109 -
 manual/appendix/file_formats.tex           |    2 
 38 files changed, 3331 insertions(+), 2976 deletions(-)

Comment by Andree Buschmann (Buschel) - Sunday, 07 March 2010, 18:50 GMT+2
Theory about Coldfire issues with the demux code was correct. I wrote a wrapping function to optimize the performance on Coldfire (see mpc_bits_reader.h), other targets are untouched.

Speed on Coldfire (h130) is 26.3 MHz now (svn: 25.3 MHz).
   mpc_sv8_v24.patch (292 KiB)
 apps/metadata/mpc.c                        |  126 +
 apps/plugins/SOURCES                       |    3 
 apps/codecs/libmusepack/config_types.h     |   51 
 apps/codecs/libmusepack/mpc_decoder.c      | 1961 ++++++-----------------------
 apps/codecs/libmusepack/AUTHORS            |    2 
 apps/codecs/libmusepack/reader.h           |   66 
 apps/codecs/libmusepack/mpc_types.h        |  148 ++
 apps/codecs/libmusepack/mpcdec_math.h      |  231 +++
 apps/codecs/libmusepack/decoder.h          |  118 -
 apps/codecs/libmusepack/crc32.c            |   56 
 apps/codecs/libmusepack/musepack.h         |  163 --
 apps/codecs/libmusepack/requant.c          |   90 -
 apps/codecs/libmusepack/mpc_bits_reader.c  |  179 ++
 apps/codecs/libmusepack/requant.h          |   36 
 apps/codecs/libmusepack/mpc_bits_reader.h  |  175 ++
 apps/codecs/libmusepack/config-mpc.h       |  105 -
 apps/codecs/libmusepack/synth_filter_arm.S |    2 
 apps/codecs/libmusepack/math.h             |  237 ---
 apps/codecs/libmusepack/mpcdec.h           |  186 ++
 apps/codecs/libmusepack/SOURCES            |    7 
 apps/codecs/libmusepack/ChangeLog          |   28 
 apps/codecs/libmusepack/streaminfo.c       |  377 ++---
 apps/codecs/libmusepack/minimax.h          |   57 
 apps/codecs/libmusepack/mpc_config.h       |   50 
 apps/codecs/libmusepack/synth_filter.c     |   34 
 apps/codecs/libmusepack/huffsv46.c         |   75 -
 apps/codecs/libmusepack/streaminfo.h       |   90 -
 apps/codecs/libmusepack/README             |    6 
 apps/codecs/libmusepack/internal.h         |   90 -
 apps/codecs/libmusepack/mpc_demux.c        |  665 +++++++++
 apps/codecs/libmusepack/README.rockbox     |   27 
 apps/codecs/libmusepack/huffman.c          |  530 +++++++
 apps/codecs/libmusepack/mainpage.h         |   38 
 apps/codecs/libmusepack/huffsv7.c          |   81 -
 apps/codecs/libmusepack/idtag.c            |   83 -
 apps/codecs/libmusepack/huffman.h          |   56 
 apps/codecs/mpc.c                          |  109 -
 manual/appendix/file_formats.tex           |    2 
 38 files changed, 3364 insertions(+), 2976 deletions(-)

Comment by Andree Buschmann (Buschel) - Sunday, 07 March 2010, 20:08 GMT+2
Cosmetic changes in comments (do not use 'AB', but 'rockbox').
   mpc_sv8_v25.patch (292.1 KiB)
 apps/metadata/mpc.c                        |  126 +
 apps/plugins/SOURCES                       |    3 
 apps/codecs/libmusepack/config_types.h     |   51 
 apps/codecs/libmusepack/mpc_decoder.c      | 1961 ++++++-----------------------
 apps/codecs/libmusepack/AUTHORS            |    2 
 apps/codecs/libmusepack/reader.h           |   66 
 apps/codecs/libmusepack/mpc_types.h        |  148 ++
 apps/codecs/libmusepack/mpcdec_math.h      |  231 +++
 apps/codecs/libmusepack/decoder.h          |  118 -
 apps/codecs/libmusepack/crc32.c            |   56 
 apps/codecs/libmusepack/musepack.h         |  163 --
 apps/codecs/libmusepack/requant.c          |   90 -
 apps/codecs/libmusepack/mpc_bits_reader.c  |  179 ++
 apps/codecs/libmusepack/requant.h          |   36 
 apps/codecs/libmusepack/mpc_bits_reader.h  |  175 ++
 apps/codecs/libmusepack/config-mpc.h       |  105 -
 apps/codecs/libmusepack/synth_filter_arm.S |    2 
 apps/codecs/libmusepack/math.h             |  237 ---
 apps/codecs/libmusepack/mpcdec.h           |  186 ++
 apps/codecs/libmusepack/SOURCES            |    7 
 apps/codecs/libmusepack/ChangeLog          |   28 
 apps/codecs/libmusepack/streaminfo.c       |  384 ++---
 apps/codecs/libmusepack/minimax.h          |   57 
 apps/codecs/libmusepack/mpc_config.h       |   50 
 apps/codecs/libmusepack/synth_filter.c     |   34 
 apps/codecs/libmusepack/huffsv46.c         |   75 -
 apps/codecs/libmusepack/streaminfo.h       |   94 -
 apps/codecs/libmusepack/README             |    6 
 apps/codecs/libmusepack/internal.h         |   90 -
 apps/codecs/libmusepack/mpc_demux.c        |  666 +++++++++
 apps/codecs/libmusepack/README.rockbox     |   27 
 apps/codecs/libmusepack/huffman.c          |  530 +++++++
 apps/codecs/libmusepack/mainpage.h         |   38 
 apps/codecs/libmusepack/huffsv7.c          |   81 -
 apps/codecs/libmusepack/idtag.c            |   83 -
 apps/codecs/libmusepack/huffman.h          |   56 
 apps/codecs/mpc.c                          |  109 -
 manual/appendix/file_formats.tex           |    2 
 38 files changed, 3376 insertions(+), 2976 deletions(-)

Loading...