[vorbis-dev] vorbisfile ov_pack_pcm patch

John Morton
Mon, 12 May 2003 20:30:43 -0000

Here's a patch to vorbisfile.c in libvorbis that splits the float to integer
pcm packing out of ov_read into it's own function.

The good stuff:

  - ov_pack_pcm can be used by folks who decode to float pcm with
  ov_read_float to do various  sound manipulations (eg, preamp, fades,
   replaygain). No more need to roll your own, which will really begin to
  pay off when 24 bit output gets implimented.

  - ov_read is now implimented in terms of ov_read_float and ov_pack_pcm to
  reduce code duplication.

  - I've included patches against libvorbis-1.0 and the latest main branch
CVS

  - The api change is minimal enough that anything that uses libvorbisfile
  will keep on working without need of a rebuild, after rebuilding libvorbis.

The not so good stuff:

  - ov_read takes a minor performance hit from not doing the work inline. It
  also ends up calculating bytespersample twice, in order to keep the
  ov_pack_pcm call nice and consistant. Not that this will really matter, I
  think.

  - The patch has been tested against libvorbis-1.0, and certainly applies to
  main branch CVS, but I haven't thoroughly tested that yet. If it
doesn't
  work, it's probably something cheesy.

   - My C-fu is weak. I'm probably doing something dumb with float **pcm,
  but I don't have a copy of K&R handy to bail me out. Do enlighten me
if I'm
  doing something silly :-)

John
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvorbis-1.0-ov_pack_pcm.patch
Type: text/x-diff
Size: 6809 bytes
Desc: libvorbis-1.0-ov_pack_pcm.patch
Url :
http://lists.xiph.org/pipermail/vorbis-dev/attachments/20030513/ca83b361/libvorbis-1.0-ov_pack_pcm-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvorbis-cvs-ov_pack_pcm.patch
Type: text/x-diff
Size: 6769 bytes
Desc: libvorbis-cvs-ov_pack_pcm.patch