[Speex-dev] Re: os_support.h, libc overrides

Jim Crichton jim.crichton at comcast.net
Fri Dec 7 06:27:09 PST 2007


Jean-Marc,

Attached is a patch (to build 14264) to fix the TI DSP builds with the 
recent restructuring of libspeex.  The change adds a hook in os_support.h to 
allow the user to override some memory allocation and I/O functions.  A 
similar hook was present in misc.c, but was lost when that file was removed. 
Also, the size of the private memory allocation area has been reduced, to 
match improvements in Speex memory utilization.

In this patch, the memory override functions are implemented as inline 
functions, which increases the code size by about 0.5kB in the test builds. 
This could be reduced by moving the guts of the routines to a separate C 
file, and reducing the inline functions to just call those routines.  I have 
not had time to test that approach, but the present patch is sufficient to 
get the build working again.

Also, ti/user_misc.h should be replaced by the similar 
ti/os_support_custom.h file, which is also attached.

I remember your having some trouble reading my patches (from Tortoise SVN) 
before, so let me know if I need to format this differently for you to use 
it.  Sorry if this was holding you up.

- Jim


----- Original Message ----- 
From: "Jim Crichton" <jim.crichton at comcast.net>
To: "Jean-Marc Valin" <jean-marc.valin at usherbrooke.ca>
Cc: <speex-dev at xiph.org>
Sent: Tuesday, November 06, 2007 1:35 PM
Subject: os_support.h, libc overrides


> Jean-Marc,
>
>> That reminds me that I've just moved lots of stuff around with the
>> allocation functions. Can you check that the TI stuff still works with
>> that? In the end, it'll probably make things easier for you now. For
>> example, if you link statically, wideband should be automatically left
>> out if unused. Also, all the libc stuff is now in os_support.h, which is
>> less messy than misc.h/misc.c were.
>
> The TI C64x build produces bit-exact results with build 12825 (April 2007, 
> a bit before 1.2beta2).  The C54x and C55x builds did not work because the 
> manual allocation scheme was broken when misc.c was removed.
>
> The old override mechanism was:
>
> 1.  Define USER_MISC in config.h
> 2.  In, misc.c, include user_misc.h if USER_MISC is defined
> 3.  Put the allocation override code in user_misc.h.
>
> The result is that the override code is included in one source file 
> (misc.c), so there are no duplicate definitions.  How would you like to 
> see this implemented under the current structure?  Including the override 
> functions in os_support.h does not work unless the overrides are also 
> static inlines (otherwise duplicate definitions occur).  For code size 
> efficiency, it would be nice if these functions were not required to be 
> static inline.
>
> The function prototypes were removed from misc.h, so now they are defined 
> nowhere when overrides are defined.  There is no way around that without 
> some change to the source.
>
> What do you think?
>
> - Jim 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: os_support_custom.zip
Type: application/x-zip-compressed
Size: 1953 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20071207/7db08eb1/os_support_custom.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: speex_14274_ti.patch
Type: application/octet-stream
Size: 6469 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20071207/7db08eb1/speex_14274_ti.obj


More information about the Speex-dev mailing list