[Ffmpeg-devel] Fixed point arithmetic RealAudio G2 (cook) decoder

Michael Niedermayer michaelni
Tue Mar 13 19:08:33 CET 2007


Hi

On Mon, Mar 12, 2007 at 10:14:17PM -0500, Rich Felker wrote:
> On Thu, Mar 08, 2007 at 10:28:18PM +0100, Michael Niedermayer wrote:
> > [...]
> > > +static const FIXPU sincos_lookup[2050] = {
> > > +    /* x_i = 2^16 sin(i 2pi/8192), 2^16 cos(i 2pi/8192); i=0..1024 */
> > 
> > i think such large tables should be generated instead of hardcoded
> 
> on the other hand, i'd kinda like it if _all_ the tables in lavc were
> hardcoded instead of generated. this would allow them to be in shared
> memory and would eliminate all the issues with global initialization,
> dynamic loading, and memory leaks vs crashes.

as long as the object file size doesnt increase by much iam in favor of
this but if we double libavcodec.a/.so file size by doing this then iam no
longer in favor of this for obvious reasons ...
though of course one could argue that its the loaders/fileformats job
to (de)compress tables if possble ...


> 
> another possible idea is to put table arrays in bss so that they don't
> take space on disk (or in memory until they're initialized). this
> cleans up the dynamic .so loading issue but doesn't allow memory to be
> shared.

well actually, the kernel could share them too, it only has to find duplicate
pages and mark them as copy on write and shared

finding such pages is not so hard, it can be done in O(n) time, one way to do
it is
* on every timer interupt go over a few pages and set them read only, calculate
  a checksum for each and put the checksum into a list
* if any write happens to such page (pagefault) set it to r/w again and remove
  it from the list
* when you are done with going over all pages sort the checksums using radix
  sort identical pages will have their checksums and pointers to them appear
  next to each other and can now trivially be merged and marked as copy on
  write

now back to the topic
patch welcome for changing generated tables to hardcoded ones where it doesnt
increase the object size by more then a negligible amount
also a patch for changing malloc() to bss style where appropriate is welcome

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070313/e35c0c0a/attachment.pgp>



More information about the ffmpeg-devel mailing list