Rockbox

Tasklist

FS#10400 - Consolidate all fixed point math routines in one library

Attached to Project: Rockbox
Opened by Jeffrey Goode (Blue_Dude) - Monday, 29 June 2009, 23:40 GMT
Last edited by Maurus Cuelenaere (mcuelenaere) - Sunday, 05 July 2009, 18:06 GMT
Task Type Patches
Category Build environment
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Version 3.3
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

This consolidates several duplicate routines from different places. Some new header files are created to make the new library available to plugins and codecs. This ought to cut down on compile size, reduce errors, and keep from reinventing the wheel.

I still need to add to the library from replaygain, but this is most of it.
This task depends upon

Closed by  Maurus Cuelenaere (mcuelenaere)
Sunday, 05 July 2009, 18:06 GMT
Reason for closing:  Accepted
Additional comments about closing:  In r21664.
Comment by Thomas Martitz (kugel.) - Tuesday, 30 June 2009, 00:45 GMT
Do I see this correctly, we're having so much duplication (like 3 times the same arctan table)? I'm surprised!

2 things: You need to bump the codec and plugin API (both the normal and min version for each) because the addresses of the api function changed (they're just function pointer). And I think the change to eq.h slipped in accidentally?
Comment by Jonas Häggqvist (rasher) - Tuesday, 30 June 2009, 00:52 GMT
When bumping the plugin (and codec?) API, the functions should be sorted afaik. Just a heads up.
Comment by Jeffrey Goode (Blue_Dude) - Tuesday, 30 June 2009, 04:12 GMT
There really is a lot of duplication. I haven't even pulled in the replaygain material yet.

I'm not really trying to integrate with the API. What I am doing is making the correct header files available to plugins and codecs (total of three versions) so that they can use the main library in apps. With the appropriate changes to the SOURCES files, they get their own compiled versions, just as though they had their own copy of the library itself, so they're not using the version compiled in the main app. I suppose that there's a way to expose the main app's functions to the codecs and plugins, which would make them smaller after linking, but it would involve rewriting code for each codec or plugin that needed it. I was trying to consolidate the math functions where I could use them, not necessarily overhaul bits and pieces of scattered code. This way, nothing has to be rewritten, since the compiler does all the work in relocating the code. The compiled code itself should be exactly the same.

The change to eq.h had to be there, since for some reason it didn't recognize the bool type anymore at compile time without it. I think somehow it was riding on dsp.h's coattails before and slipped through. I'll try it without the change now, maybe it'll work.
Comment by Jeffrey Goode (Blue_Dude) - Tuesday, 30 June 2009, 04:27 GMT
Nope, still won't compile without it. It definitely was relying on the #include <stdbool.h> in dsp.h. This puts it back where it belongs.
Comment by Jeffrey Goode (Blue_Dude) - Thursday, 02 July 2009, 04:09 GMT
This is a complete patch including the replaygain material and a couple extras I put in.
Comment by Thomas Martitz (kugel.) - Saturday, 04 July 2009, 13:27 GMT
Take a look at resize/jpeg code. The pluginlib actually #includes the the core .c file, which has a few #ifdef PLUGIN. It only compiles for pictureflow and not for the core on some targets.
Comment by Jeffrey Goode (Blue_Dude) - Sunday, 05 July 2009, 03:12 GMT
This patch behaves correctly. It should compile correctly for all targets. The main library, fixedpoint.c in apps, has conditional compilation depending on which library (plugin or codec) is trying to include it. This eliminates bloat. I also pared down the header files to include only those functions that are required for each library. Editing the appropriate header file and the conditions in the main library make it possible to add functions to the libraries as needed, but the actual code remains in one place.

This patch also splits off the FRACMUL macros into their own header file. They were only tangentially related to other math. They are easy to include as needed as it's just a header file.

I also did some small editing to change some function names to make them more easily identifiable as belonging to this library. These are cosmetic changes only, for readability.

Loading...