Rockbox

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

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#10182 - Addition of librm to svn

Attached to Project: Rockbox
Opened by MohamedTarek (mtarek16) - Saturday, 02 May 2009, 11:14 GMT+2
Last edited by MichaelGiacomelli (saratoga) - Monday, 14 September 2009, 01:52 GMT+2
Task Type Patches
Category Codecs
Status Closed
Assigned To No-one
Player Type Another
Severity Low
Priority Normal
Reported Version Version 3.2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Private No

Details

Addition of rm files to rockbox. It only adds the target files to rb's directory not to the actual build.
librm includes a makefile and a main.c for producing a test program that would convert an input rm file with cook codec to a wav file.
The code still needs a lot of cleaning.
   librm.patch (514.4 KiB)
 librm/ffmpeg_config.h                      |   14 
 librm/bitstream.h                          |  993 ++++++
 librm/cook.h                               |   66 
 librm/cook_decode.h                        |    4 
 librm/libavutil/mem.c                      |  159 
 librm/libavutil/trash/mathematics.c        |  147 
 librm/libavutil/trash/mathematics.h        |   72 
 librm/libavutil/trash/intreadwrite.h       |  192 +
 librm/libavutil/trash/lfg.c                |   64 
 librm/libavutil/trash/rational.c           |  129 
 librm/libavutil/trash/pixfmt.h             |  131 
 librm/libavutil/trash/lfg.h                |   54 
 librm/libavutil/trash/rational.h           |  129 
 librm/libavutil/trash/random.c             |   99 
 librm/libavutil/trash/log.c                |   89 
 librm/libavutil/trash/random.h             |   78 
 librm/libavutil/trash/md5.c                |  182 +
 librm/libavutil/trash/timer.h              |  104 
 librm/libavutil/trash/log.h                |  116 
 librm/libavutil/trash/intfloat_readwrite.c |   97 
 librm/libavutil/trash/md5.h                |   36 
 librm/libavutil/trash/intfloat_readwrite.h |   40 
 librm/libavutil/internal.h                 |  328 ++
 librm/libavutil/bswap.h                    |   99 
 librm/libavutil/mem.h                      |  104 
 librm/libavutil/intreadwrite.h             |  192 +
 librm/libavutil/avutil.h                   |   63 
 librm/libavutil/common.h                   |  286 +
 librm/cookdata_fixpoint.h                  |  433 ++
 librm/rm2wav.c                             |  567 +++
 librm/cookdata_float.h                     |  113 
 librm/fft.c                                |  262 +
 librm/cook_fixpoint.h                      |  243 +
 librm/bswap.h                              |  150 
 librm/rm.h                                 |   69 
 librm/main.c                               |   92 
 librm/dsputil.c                            | 4701 +++++++++++++++++++++++++++++
 librm/id3.h                                |  153 
 librm/bytestream.h                         |   71 
 librm/cook_float.h                         |  226 +
 librm/mdct.c                               |  291 +
 librm/dsputil.h                            |  911 +++++
 librm/cookdata.h                           |  493 +++
 librm/bitstream.c                          |  295 +
 librm/cook.c                               |  923 +++++
 librm/Makefile                             |    9 
 librm/cook_fixp_mdct.h                     |  545 +++
 47 files changed, 14614 insertions(+)

This task depends upon

View Dependency Graph

This task blocks these from closing
 FS#6852 - Ability to play real player files 
Closed by  MichaelGiacomelli (saratoga)
Monday, 14 September 2009, 01:52 GMT+2
Reason for closing:  Accepted
Additional comments about closing:  Accepted in r21695.
Comment by MohamedTarek (mtarek16) - Saturday, 02 May 2009, 11:20 GMT+2
Sorry, forgot to remove the libavutil/trash directory before making the previous patch
   librm.patch (451 KiB)
 librm/ffmpeg_config.h          |   14 
 librm/bitstream.h              |  993 ++++++++
 librm/cook.h                   |   66 
 librm/cook_decode.h            |    4 
 librm/libavutil/mem.c          |  159 +
 librm/libavutil/internal.h     |  328 ++
 librm/libavutil/bswap.h        |   99 
 librm/libavutil/mem.h          |  104 
 librm/libavutil/intreadwrite.h |  192 +
 librm/libavutil/avutil.h       |   63 
 librm/libavutil/common.h       |  286 ++
 librm/cookdata_fixpoint.h      |  433 +++
 librm/rm2wav.c                 |  567 ++++
 librm/cookdata_float.h         |  113 
 librm/fft.c                    |  262 ++
 librm/cook_fixpoint.h          |  243 ++
 librm/bswap.h                  |  150 +
 librm/rm.h                     |   69 
 librm/main.c                   |   92 
 librm/dsputil.c                | 4701 +++++++++++++++++++++++++++++++++++++++++
 librm/id3.h                    |  153 +
 librm/bytestream.h             |   71 
 librm/cook_float.h             |  226 +
 librm/mdct.c                   |  291 ++
 librm/dsputil.h                |  911 +++++++
 librm/cookdata.h               |  493 ++++
 librm/bitstream.c              |  295 ++
 librm/cook.c                   |  923 ++++++++
 librm/Makefile                 |    9 
 librm/cook_fixp_mdct.h         |  545 ++++
 30 files changed, 12855 insertions(+)

Comment by MichaelGiacomelli (saratoga) - Monday, 04 May 2009, 16:46 GMT+2
Good work! Next step is to clean up all the dead code in there.

I only skimmed quickly, but some impressions:

cook_float should probably be removed since we're not going to try and keep fp support.
The libavutil and ffmpeg_config.h defines you're actually using can probably be combined into a cook.h file or similar.
dsputill.h can probably be combined too.
dsputil.c probably doesn't have much in it beyond the windowing functions (ff_vector_fmul_add_add_c, etc), and these can be put into cook.c


Comment by MohamedTarek (mtarek16) - Wednesday, 06 May 2009, 17:25 GMT+2
Modified patch : Major code clean-up. I think it's almost ready to be ported.
   librm.patch (233.2 KiB)
 bitstream.h         | 1001 ++++++++++++++++++++++++++++++++++
 cook.h              |   65 ++
 cookdata_fixpoint.h |  433 ++++++++++++++
 patch               | 1514 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 rm2wav.c            |  566 +++++++++++++++++++
 cook_fixpoint.h     |  287 +++++++++
 bswap.h             |  150 +++++
 rm.h                |   74 ++
 id3.h               |  153 +++++
 main.c              |   92 +++
 cookdata.h          |  493 ++++++++++++++++
 bitstream.c         |  313 ++++++++++
 cook.c              |  923 +++++++++++++++++++++++++++++++
 Makefile            |    9 
 cook_fixp_mdct.h    |  545 ++++++++++++++++++
 15 files changed, 6618 insertions(+)

Comment by MohamedTarek (mtarek16) - Thursday, 07 May 2009, 19:39 GMT+2
patch1 :
rm-wav converter using floating point cook decoder.

patch2 :
rm-wav converter using fixed point cook decoder.

patch3 :
clean code. (no ffmpeg-specific code)
Comment by MohamedTarek (mtarek16) - Saturday, 09 May 2009, 23:37 GMT+2
-Removed main() from cook.c to a separate main.c.
-Created cook.h which defines COOKContext and the decoder's functions protoypes.

Comment by Dave Chapman (linuxstb) - Sunday, 10 May 2009, 01:25 GMT+2
I've committed the last libcook.patch2 as r20897 and r20898 - thanks.
Comment by MohamedTarek (mtarek16) - Sunday, 10 May 2009, 23:27 GMT+2
Convert cook.c to use fixed-point arithmetic. Still didn't drop almost any floating point code, although some functions maybe (#if 0)'ed for cook.c to compile.
@Dave : Thanks for the commit.
Comment by Dave Chapman (linuxstb) - Monday, 11 May 2009, 00:28 GMT+2
libcook.fixp_convert committed as r20901
Comment by MohamedTarek (mtarek16) - Monday, 11 May 2009, 00:47 GMT+2
Drop floating point code from cook.c/h.
Remove fft.c, mdct.c and dsputil.h.
Comment by MohamedTarek (mtarek16) - Monday, 11 May 2009, 00:59 GMT+2
Remove avcodec.h
Comment by MichaelGiacomelli (saratoga) - Monday, 11 May 2009, 01:29 GMT+2
>Drop floating point code from cook.c/h.
>Remove fft.c, mdct.c and dsputil.h.

Committed in r20902.
Comment by Dave Chapman (linuxstb) - Monday, 11 May 2009, 11:02 GMT+2
libcook.del_avcodec committed as r20909
Comment by MohamedTarek (mtarek16) - Friday, 15 May 2009, 23:46 GMT+2
"Preliminary" patch for get_rm_metadata().
This patch enables Rockbox to recognize a rm/ra file and parse it to get the metadata for the WPS.
The only codec supported now is cook. However, cook codec in this patch is just a fake a codec (actually it's just the one I wrote
for my qualification task ) The purpose of the codec is just to make the file run for its length just to be able to check if the parsing
was done correctly.

For read_uint32be to work properly (to eliminate warnings during compiling ) I had to #undef uint32_t, and then redefine it to unsigned
int, as it seems it was defined for "long unsigned int". Not an elegant solution, but it's not my focus currently either.

Also I had to define read_uint8() [just reads a byte] and read_uint16be() as I couldn't find it in metadata_common.h. Should I add
a read_byte() and a read_uint16be() to metadata_common.h, or just define them whenever I need them ?
Comment by MohamedTarek (mtarek16) - Tuesday, 23 June 2009, 15:17 GMT+2
This is a quick-and-dirty patch for getting rm playback to work in the sim.
The patch isn't intended for committing, it's mainly for debugging purposes.
   rm_in_sim.patch (47.2 KiB)
 apps/metadata/rm.c                      |  425 ++++++++++++++++++++++++++++++++
 apps/metadata/metadata_parsers.h        |    1 
 apps/metadata.c                         |   11 
 apps/metadata.h                         |    1 
 apps/SOURCES                            |    1 
 apps/filetypes.c                        |    2 
 apps/codecs/libcook/bitstream.h         |    4 
 apps/codecs/libcook/cook.h              |    2 
 apps/codecs/libcook/cook_fixpoint.h     |   53 ++-
 apps/codecs/libcook/bswap.h             |    2 
 apps/codecs/libcook/cookdata_fixpoint.h |    6 
 apps/codecs/libcook/Makefile.test       |    2 
 apps/codecs/libcook/bitstream.c         |   33 +-
 apps/codecs/libcook/cook.c              |    8 
 apps/codecs/codecs.make                 |    5 
 apps/codecs/SOURCES                     |    1 
 apps/codecs/librm/rm.c                  |  176 ++++++-------
 apps/codecs/librm/rm.h                  |   17 -
 apps/codecs/cook.c                      |  126 +++++++++
 19 files changed, 730 insertions(+), 146 deletions(-)

Comment by MohamedTarek (mtarek16) - Tuesday, 23 June 2009, 16:25 GMT+2
Sorry the patch is no good. I'm working on another one.
Comment by MohamedTarek (mtarek16) - Tuesday, 23 June 2009, 16:47 GMT+2
This one should work. I tried it on a clean source copy.
   rm_in_sim.patch (49.5 KiB)
 apps/metadata/rm.c                      |  425 ++++++++++++++++++++++++++++++++
 apps/metadata/metadata_parsers.h        |    1 
 apps/metadata.c                         |   11 
 apps/metadata.h                         |    1 
 apps/SOURCES                            |    1 
 apps/filetypes.c                        |    2 
 apps/codecs/libcook/bitstream.h         |    4 
 apps/codecs/libcook/cook.h              |    2 
 apps/codecs/libcook/SOURCES             |    3 
 apps/codecs/libcook/Makefile.test       |    2 
 apps/codecs/libcook/cookdata_fixpoint.h |    6 
 apps/codecs/libcook/libcook.make        |   18 +
 apps/codecs/libcook/cook_fixpoint.h     |   53 ++-
 apps/codecs/libcook/bswap.h             |    2 
 apps/codecs/libcook/bitstream.c         |   33 +-
 apps/codecs/libcook/cook.c              |    8 
 apps/codecs/codecs.make                 |    5 
 apps/codecs/SOURCES                     |    1 
 apps/codecs/librm/rm.c                  |  176 ++++++-------
 apps/codecs/librm/librm.make            |   18 +
 apps/codecs/librm/SOURCES               |    1 
 apps/codecs/librm/rm.h                  |   17 -
 apps/codecs/cook.c                      |  126 +++++++++
 23 files changed, 770 insertions(+), 146 deletions(-)

Comment by MohamedTarek (mtarek16) - Saturday, 04 July 2009, 11:44 GMT+2
This patch is to add support for rm playback in rockbox. Still no seeking.
   rm_playback.v1.0.patch (53.2 KiB)
 apps/metadata/rm.c                      |  456 ++++++++++++++++++++++++++++++++
 apps/metadata.c                         |   11 
 apps/metadata.h                         |    1 
 apps/SOURCES                            |    1 
 apps/filetypes.c                        |    2 
 apps/codecs/libcook/bitstream.h         |   10 
 apps/codecs/libcook/cook.h              |    4 
 apps/codecs/libcook/SOURCES             |    3 
 apps/codecs/libcook/Makefile.test       |    4 
 apps/codecs/libcook/cookdata_fixpoint.h |    6 
 apps/codecs/libcook/libcook.make        |   18 +
 apps/codecs/libcook/cook_fixpoint.h     |   53 ++-
 apps/codecs/libcook/bswap.h             |   12 
 apps/codecs/libcook/main.c              |   19 -
 apps/codecs/libcook/bitstream.c         |   33 +-
 apps/codecs/libcook/cook.c              |   11 
 apps/codecs/codecs.make                 |    4 
 apps/codecs/SOURCES                     |    1 
 apps/codecs/librm/rm.c                  |  174 ++++++------
 apps/codecs/librm/rm.h                  |   22 +
 apps/codecs/cook.c                      |  130 +++++++++
 21 files changed, 795 insertions(+), 180 deletions(-)

Comment by MohamedTarek (mtarek16) - Sunday, 05 July 2009, 15:19 GMT+2
Fixed some issues from the previous patch (Pointed out by Dave Chapman on IRC) which are:
-TABs were mistakenly used as indentation in some files.
-svn:executable property was added for some files. (I really don't know how it was added !)
-Some local functions weren't declared static.
-No handling for big endian targets.

Note : I don't have a big endian target, so I'd appreciate it if someone who has one could test this patch on it.
   rm_playback.v1.1.patch (57.1 KiB)
 apps/metadata/rm.c                      |  425 ++++++++++++++++++++++++++++++++
 apps/metadata.c                         |   11 
 apps/metadata.h                         |    1 
 apps/SOURCES                            |    1 
 apps/filetypes.c                        |    2 
 apps/codecs/libcook/bitstream.h         |   21 -
 apps/codecs/libcook/cook.h              |    4 
 apps/codecs/libcook/SOURCES             |    3 
 apps/codecs/libcook/Makefile.test       |    4 
 apps/codecs/libcook/cookdata_fixpoint.h |    6 
 apps/codecs/libcook/libcook.make        |   18 +
 apps/codecs/libcook/cook_fixpoint.h     |   53 ++-
 apps/codecs/libcook/bswap.h             |   12 
 apps/codecs/libcook/main.c              |   25 -
 apps/codecs/libcook/bitstream.c         |   81 +-----
 apps/codecs/libcook/cook.c              |   11 
 apps/codecs/codecs.make                 |    4 
 apps/codecs/SOURCES                     |    1 
 apps/codecs/librm/rm.c                  |  250 ++++++++++--------
 apps/codecs/librm/rm.h                  |   32 +-
 apps/codecs/cook.c                      |  144 ++++++++++
 21 files changed, 843 insertions(+), 266 deletions(-)

Comment by MohamedTarek (mtarek16) - Sunday, 05 July 2009, 19:33 GMT+2
Still fixing for playback on big endian targets.
   rm_playback.v1.2.patch (57.6 KiB)
 apps/metadata/rm.c                      |  425 ++++++++++++++++++++++++++++++++
 apps/metadata.c                         |   11 
 apps/metadata.h                         |    1 
 apps/SOURCES                            |    1 
 apps/filetypes.c                        |    2 
 apps/codecs/libcook/bitstream.h         |   21 -
 apps/codecs/libcook/cook.h              |    4 
 apps/codecs/libcook/SOURCES             |    3 
 apps/codecs/libcook/Makefile.test       |    4 
 apps/codecs/libcook/cookdata_fixpoint.h |    6 
 apps/codecs/libcook/libcook.make        |   18 +
 apps/codecs/libcook/cook_fixpoint.h     |   53 ++-
 apps/codecs/libcook/bswap.h             |   25 -
 apps/codecs/libcook/main.c              |   25 -
 apps/codecs/libcook/bitstream.c         |   81 +-----
 apps/codecs/libcook/cook.c              |   11 
 apps/codecs/codecs.make                 |    4 
 apps/codecs/SOURCES                     |    1 
 apps/codecs/librm/rm.c                  |  250 ++++++++++--------
 apps/codecs/librm/rm.h                  |   32 +-
 apps/codecs/cook.c                      |  144 ++++++++++
 21 files changed, 846 insertions(+), 276 deletions(-)

Comment by MohamedTarek (mtarek16) - Monday, 06 July 2009, 00:21 GMT+2
Playback works on big endian targets. I have duplicated wma's bswap.h since it already optimized for rockbox.
   rm_playback.v1.3.patch (62.2 KiB)
 apps/metadata/rm.c                      |  426 ++++++++++++++++++++++++++++++++
 apps/metadata.c                         |   11 
 apps/metadata.h                         |    1 
 apps/SOURCES                            |    1 
 apps/filetypes.c                        |    2 
 apps/codecs/libcook/bitstream.h         |   21 -
 apps/codecs/libcook/cook.h              |    4 
 apps/codecs/libcook/SOURCES             |    3 
 apps/codecs/libcook/Makefile.test       |    4 
 apps/codecs/libcook/cookdata_fixpoint.h |    6 
 apps/codecs/libcook/libcook.make        |   18 +
 apps/codecs/libcook/cook_fixpoint.h     |   53 ++-
 apps/codecs/libcook/bswap.h             |  169 ++++++++----
 apps/codecs/libcook/main.c              |   25 -
 apps/codecs/libcook/bitstream.c         |   85 +-----
 apps/codecs/libcook/cook.c              |   11 
 apps/codecs/codecs.make                 |    4 
 apps/codecs/SOURCES                     |    1 
 apps/codecs/librm/rm.c                  |  250 ++++++++++--------
 apps/codecs/librm/rm.h                  |   32 +-
 apps/codecs/cook.c                      |  144 ++++++++++
 21 files changed, 955 insertions(+), 316 deletions(-)

Comment by MohamedTarek (mtarek16) - Monday, 06 July 2009, 01:18 GMT+2
Some simple modifications on rm metadata parser.
   rm_playback.v1.4.patch (62.1 KiB)
 apps/metadata/rm.c                      |  421 ++++++++++++++++++++++++++++++++
 apps/metadata.c                         |   11 
 apps/metadata.h                         |    1 
 apps/SOURCES                            |    1 
 apps/filetypes.c                        |    2 
 apps/codecs/libcook/bitstream.h         |   21 -
 apps/codecs/libcook/cook.h              |    4 
 apps/codecs/libcook/SOURCES             |    3 
 apps/codecs/libcook/Makefile.test       |    4 
 apps/codecs/libcook/cookdata_fixpoint.h |    6 
 apps/codecs/libcook/libcook.make        |   18 +
 apps/codecs/libcook/cook_fixpoint.h     |   53 ++--
 apps/codecs/libcook/bswap.h             |  169 ++++++++----
 apps/codecs/libcook/main.c              |   25 -
 apps/codecs/libcook/bitstream.c         |   85 +-----
 apps/codecs/libcook/cook.c              |   13 
 apps/codecs/codecs.make                 |    4 
 apps/codecs/SOURCES                     |    1 
 apps/codecs/librm/rm.c                  |  250 ++++++++++---------
 apps/codecs/librm/rm.h                  |   32 +-
 apps/codecs/cook.c                      |  144 ++++++++++
 21 files changed, 953 insertions(+), 315 deletions(-)

Comment by Maurus Cuelenaere (mcuelenaere) - Monday, 06 July 2009, 10:57 GMT+2
I'm wondering why your read_uint*() implementations require pointers instead of just returning the data?

For example real_read_audio_stream_info() & rm_parse_header() could benefit of this, because the numerous variables could then be registers/on stack instead of memory variables (or am I wrong here and are these already on stack?)
Comment by MohamedTarek (mtarek16) - Wednesday, 08 July 2009, 15:55 GMT+2
The above patch was committed as r21695 after some modifications for reducing bin size.

Loading...