Google Summer of Code 2011
Rockbox has been accepted to participate in GSoC 2011
Accepted projects for GSoC 2011
Information for students
If you are considering applying to Rockbox (or any other organization, in fact), you may want to have a look at this wiki page: http://code.google.com/p/google-summer-of-code/wiki/AdviceforStudents
. It contains a lot of good advice about what you should expect during the Summer of Code and helps you create a good proposal.
Please use the template from GSoCApplicationTemplate2011
as a guideline when submitting your application to google.
If you're serious about working on Rockbox for SoC, then the best way you can show us is to start getting involved in the project before you make your application - i.e. download the code, hang out in our IRC channel
, subscribe to our mailing lists
, and start submitting patches.
If you are a student planning on applying, please come into our IRC channel on FreeNode and talk to us about it! Please do not contact possible mentors personally at this stage
NOTE: This is not a general wish list for Rockbox features. Don't add a project here without discussing it with the Rockbox developers first.
These are only ideas and suggestions, students are free to make up and describe their own project when they apply.
Audio codec optimisation (multiple possible projects listed)
Rockbox's core function is audio playback, and the efficiency at which Rockbox can do that has a direct impact on the battery run-time of the portable devices Rockbox runs on - codecs can never run too efficiently.
A project to work on codec optimisation assumes a student with some knowledge of either assembly programming, digital signal processing, or processor optimization, but not necessarily an extensive knowledge of audio compression. Learning about fixed-point arithmetic
maybe needed for some of the codecs projects too. Mentoring will be provided to bring a student's knowledge up to par during the project. If in doubt, ask in IRC about any of these proposals, or come up with one that suits you.
Possible optimisation work includes (among many other things):
AAC Codec Optimization
Rockbox has a fixed point AAC decoder based on libfaad. Unfortunately libfaad is not particularly fast even after extensive optimization. For example, on ARM7TDMI, Rockbox uses over 120MHz for 64kbps AAC-HE. The Helix ARM decoder uses only 60 MHz - a difference of over 100%. FFmpeg provides a much more efficient, but floating point decoder. In this project, a student would explore combining some or all of the ffmpeg decoder into Rockbox, either replacing or augmenting libfaad. The ffmpeg decoder would be converted to fixed point and optimized for embedded decoding. The resulting improvements to Rockbox would reduce power consumption and provide the open source community with substantially more efficient embedded MPEG codecs.
Improving the MDCT library
Rockbox has a single MDCT
function used in AAC, WMA, WMA Pro, Vorbis, AC3, Cook and ATRAC3. The performance of this library thus impacts a number of formats. While the current implementation is algorithmically efficient (close to minimum total instruction count) it is not well optimized for many CPUs because it aims to have minimum possible memory use for low memory targets. It could be greatly improved on newer ARM devices at the cost of some memory. Additionally, most ASM is heavily biased in favor of ARMv4. ARMv5/6 or Coldfire implementations would greatly improve performance on other targets.
Optimization for MIPS CPUs
Some new rockbox targets run on MIPS CPUs. In this project, a student would review various ARM assembly optimizations added to MP3, Vorbis, AAC, WMA and FLAC and then port them to MIPS. This would ensure that rockbox's exceptionally fast codec library can be used efficiently on MIPS CPUs, and also provide fast embedded MIPS codecs for formats that currently lack them.
MP3 Codec Optimization
Rockbox has a fixed point MP3 decoder based on libmad. Unfortunately libmad is not particularly fast even after extensive optimization. For example, on ARM7TDMI, Rockbox uses 38MHz for 128k MP3. The official ARM decoder uses 29MHz, a difference of almost 25%. Other libraries exist for decoding mp3, each with their own strengths and weaknesses. In this project, a student would explore the performance of each of the major components of our decoder and then evaluate possible replacements in other codec libraries (ffmpeg, etc) or implement their own code based on algorithms in the literature. The goal would be to produce a decoders using either the best known algorithm or best known open source code for each step in the decoding process. The resulting improvements to Rockbox would reduce power consumption and provide the open source community with substantially more efficient embedded MPEG codecs.
Note: this project involves comparing highly optimized libraries and identifying small improvements. Several of the proposals below involve much less well optimized libraries that will be substantially easier to optimize, are likely to be better suited to less experienced students.
General ARM Optimization
Rockbox has a large amount of ARM assembly code written primarily for ARM7TDMI?
cores. Newer ARM cores based on ARMv5E?
, ARMv6 or NEON offer a range of new features that could be used to improve rockbox on high end devices or Android based cell phones. In this project a student would propose to improve existing assembly code (or write new assembly from scratch) for newer ARM processors.
Codec Library and Optimization
Create a stand alone command line version of the rockbox codec api functions so that rockbox codecs can be compiled and tested outside of rockbox, much as ffmpeg codecs can be tested from the command line. Then optimize codecs in order to fit into certain memory or CPU usage goals. Introduce standard, optimized library functions for common tasks to complement the existing IMDCT library (such as bitstream parsing, huffman decoding, etc). The goal of this project would be to improve the performance and memory usage of rockbox codecs, while making them accessible to other embedded projects.
Completing the WMA Voice port
During last year's GSoC?
, a port of the WMA Voice codec was started but it was never finished due to time constraints. Currently, the decoder works in the simulator only, and it's still in floating point. The project would aim mainly at completing the decoder port, and - according to progress - the encoder too. Work is basically divided into fixed-point conversion and optimisation for the different CPUs.
- assembly programming
- digital signal processing
- processor optimization
- fixed-point arithmetic
- audio codec theory
Due to the open scope of this project idea we would rely on the student to provide project goals.
Port buflib from the pluginlib over to the core and use it to allocate big buffers in a more dynamic way.
Rockbox has no malloc() for various reasons (WhyNoMalloc
). However, time has shown that fixed size static buffers limit us a lot: Either they're too big and waste precious RAM which often directly translates into a loss of battery life or they are too small and limit our users when it comes to customizability. As Rockbox runs on a wide range of targets, some with large hard disks and some with small flash based memory, some with small greyscale screens and others with large color screens, choosing appropriate buffer sizes gets harder and harder. The pluginlib has a powerful buflib library which is handle-based able to move/resize/compact allocated and unused memory.
This project would involve porting it over to the core and adapt some parts of Rockbox to use it so that we can get rid of many fixed size buffers. Most work would be spend on making the code base aware of the fact that memory may move and to make the audio buffering engine handle an audio buffer that changes its size and location at runtime.
- Refactoring existing code
- Understanding complex code (the rockbox buffering code is not trivial)
The student would be expected to port the buflib, and adapt a simple part of rockbox (e.g : a codec) to use it, as a proof-of-concept. Then work would continue by adapting more parts of rockbox as time allows, starting with the playback code.
Standalone playback core/library
Rockbox' core function is audio playback. Making it more robust and easier for developers to work in this area is desirable.
Currently the playback core has some flaws and is quite enrooted into Rockbox. A project could extract the playback engine into a standalone library that can e.g. be built into an application to run on a PC so that it can be debugged more easily, enables us to run test suites on it, and that generally modularizes it so that it can evolve independently of Rockbox. A further goal could be to make it more Rockbox-agnostic in that it doesn't need Rockbox-specific function calls and data structures (e.g. functional with host kernel primitives or preemptive threads). Ideally, other parts of the Rockbox codebase (such as the metadata parser) would also be split out to libraries.
- GNU Make (for the Rockbox build system)
- Understanding for multi-tasking
- Code refactoring
- A library with a well-defined API
- A CLI-based playback application that takes audio files and plays them and that can be deployed to at least 1 major operating system
- Rockbox building and working using this library
Improved video playback (multiple possible projects listed)
Rockbox currently has limited video playback via the mpegplayer plugin
. This can play MPEG program streams containing MPEG-1 or MPEG-2 video and MPEG audio.
There are many areas where Rockbox's video playing capabilities can be improved, including support for more video/audio codecs, support for different container formats, making use of hardware video acceleration or integrating video playback into Rockbox's core audio playback engine (allowing mixed audio/video playlists).
An initial step that any project to enhance video playback in Rockbox would be to refactor the existing mpegplayer
plugin to implement an infrastructure for multiple video/audio codec or container format support.
Some specific proposals:
- MPEG4 (A)SP Video - many rockbox targets are probably capable of decoding MPEG4 SP video. This format is more commonly used for low resolution video than mpeg1/2, and so is a logical choice to include in rockbox.
- VP3/Theora Video - Recently there has been interest in using Theora as a general purpose free video codec. In this project the codec would be optimized for embedded use on ARM and DSP cores providing the community with a fast embedded VP3 decoder suitable for integration into embedded systems as well as rockbox. The resulting decoder would serve as a proof of principle ARM optimized codec which could be used to evaluate Theora as an embedded codec.
- AC-3 audio (aka Dolby Digital) - AC-3 is already supported in Rockbox and almost a factor of two faster then mp3 audio on many targets. It is also very widely combined with mpeg1/2 video. Adding support for it would enable faster decoding on slower targets.
- AAC audio - Another audio format already supported in Rockbox and commonly used in video files.
- MP4 container - Rockbox already has an MP4 container parser (for audio playback) which could be used as the basis of mp4 video playback.
- Hardware Video Scaling - Some devices have hardware for resizing video. Adding an interface for hardware video scaling to rockbox would improve decoding on these targets.
A student undertaking this project could propose to implement a number of the smaller features proposed above, or a single large feature.
- Assembler (ARM/Coldfire/MIPs) for target-specific optimisations
- Fixed-point arithmetic
- Knowledge of video/audio codec theory
The precise skills depend on the tasks the student decides to undertake for this project.
The goals would depend on the precise enhancements the student proposes to implement.
However, we would expect a summer's work to involve implementing the infracture for multiple audio/video codec and container support and then adding a new video codec. In addition, existing Rockbox audio codecs (e.g. AC-3 and AAC) could be implemented as part of this project.
Rockbox uses a plugin architecture for some of its features, mainly codecs and what are actually called "Plugins" in the user interface. Currently, only one plugin of each type can be loaded at a time. There is a demand to be able to run multiple plugins in parallel. This is not possible currently, because plugins are compiled at a fixed address at the start of the plugin buffer. The project would mean to create a framework which allows plugins to be compiled and linked with relocation information, to be resolved at load time. It would probably also mean finding new file format for the plugins, such as coff or elf (or look at elf2flt
). Of course part of the job is to adapt the core plugin loader to handle more than a single plugin and a new file format too.
Reasons for this ability to run multiple plugins are:
- Some code could be removed from the core binary, and moved into external executables (USB drivers, maybe metadata parsers as well)
- Multiple normal plugins could run at the same time. The main case would be the ability to keep running battery_bench while still using plugins.
- Visualisation plugins in the WPS would be possible using this.
- Later on, this could make things like animated screen transitions (e.g. as described in http://bjorn.haxx.se/blog/2010/01/29/pluggable-rockbox-screen-transitions/) a lot easier to implement.
- If the buflib-in-core rework (see higher) is also done, this would allow reducing the rockbox memory usage significantly
This project requires a basic understanding of the compile-assemble-link chain and to get known to various alternative binary formats. It may even require changing an existing format to fit our needs.
- GNU Make (for the Rockbox build system)
- GNU ld
- possibly other tools such as elf2flt
The mid-term goal would be to have the new loader working and demonstrated, but not necessarily fully integrated yet.
By the end of the summer, we'd expect to have both plugins and codecs working with the new system, as well as working visualisation plugins for the WPS, and possibly USB plugins.
USB CD emulation
Rockbox has had support for USB mass storage for a while now, on devices that have software-driven USB controllers (as opposed to the hardware USB-ATA bridge chips that were usual in older players).
This project would add support for exporting a disk image file over USB instead of the usual raw disk, and would extend the SCSI handling to present a CDROM device instead of a hard disk. This would allow users to store iso images on a rockbox player, and use the player as a virtual CDROM drive to present those images to a PC, for e.g. recovery or installation purposes.
If time permits, implementing all this as a plugin (and therefore allowing USB drivers in rockbox to be implemented as plugins) would be a worthwhile addition.
The first step would probably be to provide hard disk image exporting, i.e. modifying the existing SCSI code to use a file as a backing store instead of a disk.
After that, the SCSI code should be modified and extended to present an MMC device such as a CDROM or DVD drive.
Of course the necessary settings and configuration code to control the feature must also be added.
Text To Speech
Rockbox currently supports speaking menus and filenames by premade voice clips. While this feature is especially for visually impaired people it has the major drawback that it doesn't work with texts that can't get prerendered easily. Examples for such texts are the database view (metadata from the files' tags) and filenames the user changed on the player (until a new voice clip is generated).
Adding a lightweight Text To Speech (TTS) engine would allow Rockbox to overcome these problems. This will make more parts of Rockbox accessible to people that can't use the usual, graphical interface. An engine that might be suited is espeak
(the last version that is GPLv2+ is 1.26). There is proof-of-concept rockbox plugin utilizing eSpeak on the tracker which suffers licensing problems. Look at FS#7660
for futhter reference. Another possiblity could be flite
During SummerOfCode2010 there was efford taken to port flite to rb and it was proven non doable. The problem was massive small sized allocation which comes from the very nature of this type of TTS. Memory fragmentation issue seems to be nonsolvable in this case. Look at this ML thread for further reference.
- ability to understand and refactor existing code
- optimising code for constrained environments
- analyze the available Open Source TTS engines and identify the one to port
- port the TTS engine to a simple Rockbox plugin. Such a plugin could render a text from a selected text file.
- depending on the time left the TTS engine could be extended to be able of getting integrated into core Rockbox. This would also require adjusting Rockbox to allow usage of voice clips and the TTS system in parallel.
Rockbox Playback Test Driver
Rockbox has an extremely complicated playback engine that can be run on many different devices as well as a PC simulator. Unfortunately, the PC simulator simulates the entire rockbox GUI, making it extremely difficult to reproduce some playback bugs due to timing issues and preventing automated testing. At the same time, the enormous number of features in the playback engine means that most changes seem to break obscure use cases.
Adding a simple interface for scripting rockbox actions would allow easier reproduction of problems identified on target, and allow for automated testing of changes to the playback engine. In this project a student would add the ability to compile rockbox's playback engine on PC without a GUI. Instead commands would be implemented by a test driver, a simple script that sequentially issued actions to the playback engine and recorded the result. Finally, the student would introduce a number of example tests for the playback engine involving common tasks such as changing tracks, seeking through an audio file, and building a playlist.
- ability to understand and refactor existing code
- introduce a test case that replicates at least one well known but currently difficult to reproduce rockbox playback bug
- integrate the test driver into the rockbox build system, so that each change to the rockbox source automatically tests playback for potential regressions
Clean up the radio code
The current radio code is mostly in apps/recorder/radio.c and is a big mess of tuning/ presets handling/ the actual radio screen/ etc. The ideal outcome of this project would be to split that one file into separate files handling radio presets, the driver layer, and a GUI layer.
might be a good starting point.
- ability to understand and refactor existing code
The student would be expected to extract the different parts of the existing code into separate modules and come up with a clean radio interface (building on the existing tuner_get/set() system). Another major goal would be to update the GUI code (radio_screen() ) to update it to fully use the action system and get out of the #ifdef hell which is still there. Lastly the presets should be moved out and made cleaner.
Make multi-volume targets look like a single volume (like unionfs on linux)
Many targets feature both internal storage and a slot for external storage to be inserted (SD card slot, etc). Currently Rockbox shows the SD/MMC/... card as a separate volume (on one currently in development device, it even shows an external card as the main file system and the internal one as a separate storage, because it's can't be written for now).
Ideally, Rockbox could (optionally) show both the internal storage and the external card(s) as a single filesystem. The volumes would of course need to have certain priorities (for filename collisions, writes, etc), however it should be presented to the user and behave as one filesystem. They are several reasons to use such a system, some of them are:
- People often store their music files in an author/album/files hierarchy. Such a system would allow a clean and elegant merge for such users, especially if they don't use the database
- get rid of the ugly hack currently in use (which has its uses but also its drawbacks)
- It could perhaps allow settings override, even booting from an external card. There are lots of potential uses here...
This is not a trivial task, particularly because it probably means fiddling with different code layers like the storage API, directory and tag cache.
- ability to understand complex code (the storage API is not trivial, the directory cache one is tricky in several places and the tag cache is really complex, the interaction between them is important and there are even a few bugs remaining)
- ability to understand one already submitted solution (it's a patch on the bug tracker), take the remarks into account and even reuse parts of it if possible
A mid term goal could be to implement the union file system for the storage API part, not taking into account caching and not investigating too much which parts of the rockbox code have to be updated. The focus would be on functionality, user settings can be implemented later. Special care will be taken about the fact that this is dynamic: the user can eject an external card and the code has to handle that !
The remaining part of the summer could be spent on fixing the directory cache if needed and updating the rest of the code to take the unionfs into account (or not !). Updating the tag cache can also be needed (this part is really tricky, there are decisions to take).
Since virtually all new DAPs coming to market contain an ARM core, a well working ARM emulator would be extremely useful for many aspects of Rockbox development.
An emulator could be used to help reverse hash/encryption algorithms used in many retail firmwares (such as Apple, Sandisk, Creative players), to help determine addresses of memory mapped hardware, and to optimize codecs by allowing more detailed analysis of memory/IRAM/etc.
A simple but only semi-functional Windows emulator exists for the Sansa E200 series which emulates much of the PortalPlayer
hardware. It currently can boot some builds of rockbox, but is not stable enough to be very useful.
This project could resume work on that emulator (or pick another to use), first getting it to run rockbox or a retail (Sandisk, Apple, etc) firmware without instability. This would involve a process a lot like porting rockbox, but in reverse. Starting with the drivers in Rockbox, one would need to implement the hardware devices they interact with until rockbox (and hopefully the OF) could run as if on real hardware. These would include LCD controller, various internal memories, buttons, and audio hardware.
Additional goals could include emulating the pipeline latencies of various ARM cores, emulating cache to allow memory profiling and introducing a general framework that would allow for easy adaptation to the differing memory maps of various ARM cores.
Another approach would be to have a look at SkyEye to see if we can build upon that. It is designed to emulate various ARM SOCs and could likely be improved to support a SOC used by Rockbox. As an added bonus, it can already run Linux for ARM. Given the advanced state of SkyEye, this may be a better place to start.
An mid-term goal would be for an emulator capable of booting and running one Rockbox target build. By the end of the summer, multiple Rockbox devices would be emulated, proving the multi-SoC capabilities of the emulator.
Apple/Sandisk/etc Various Docks, Remotes, Accessories
Sandisk and Apple have a number of accessories that allow control over devices remotely. In the case of Sandisk, these include the Sandisk Sansa Docking Station, Timex Clock Radio for Sansa, and Altec-Lansing inMotion im413. For Apple, this includes a very large number of devices and several different protocols. The simplest and earliest protocol communicates over RS232 and was reverse engineered many years ago. It is now fairly well supported. Newer devices use more advanced communication protocols, or even USB based communications.
The goal of this project would be to expand the range of devices rockbox works with by some combination of:
- Adding support for newer iPod protocols
- Adding support for Sandisk accessories
- Adding support for USB based iPod accessories (perhaps on non-ipod devices)
- Adding an ipod accessory driver to one of the newer (non-PP) Ipods such as the Nano2G? or Classic6G?.
- Improving the current accessory driver into a more general framework for remote control of devices.
This project is necessarily open ended since it will depend on which hardware a student has access to, their interest/knowledge of USB, and how readily adaptable the various protocols are to Rockbox.
By mid-term, it would be good to understand at least a basic communication protocol.
At the end of the summer, rockbox should be controllable using some new device over a new protocol.
Rockbox web/online services
There are already a number of online services on the rockbox webpage to help the community. For example there is the Themepage to host and automatically check all those user generated themes for rockbox various devices. And there is a page to allow people to easily translate rockbox into their own language.
Improving and or adding additional services could greatly help the community. Possible tasks are:
- Add a service to manage and handle user submitted fmpresets or generate fmpresets from a global radiofrequency database
- Add a service to generate voicefiles using free tts systems.
- Improving the themepage.
- Improving the translation page, and extending it to rbutil.
- Integrating those new services into rbutil.
Of course students can also suggest other usefull services.
Current rockbox webservices are written with php, but other languages are also possible for new services.
- ability to understand and refactor existing code
A possible midterm goal could be to create one service new from scratch.
The remaining part of the summer could be spent developing a second service, or makeing big improvements on existing services.
Candidate Backup mentors
Copyright © by the contributing authors.