• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Infrastructure → Build environment
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Version 3.3
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Blue_Dude - 2009-06-29
Last edited by mcuelenaere - 2009-07-05

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

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.

Closed by  mcuelenaere
2009-07-05 18:06
Reason for closing:  Accepted
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

In r21664.

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?

When bumping the plugin (and codec?) API, the functions should be sorted afaik. Just a heads up.

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.

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.

This is a complete patch including the replaygain material and a couple extras I put in.

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.

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.


Available keyboard shortcuts


Task Details

Task Editing