GNOME Bugzilla – Bug 435435
[alaw] use tables for ALAW (G.711) encoding and decoding
Last modified: 2007-09-25 16:07:11 UTC
Hi, here is a patch to encode/decode ALAW using pre-calculated tables and not functions, this method is less CPU intensive, it uses more memory ( 2ko max for encoding) but this cost seems to be interesting even for embedded systems. Regards.
Created attachment 87436 [details] add static table encoding/decoding for alaw
Tables/additionnal code are from libsndfile, this code is originally LGPL.
laurent, is such a table also available for mulaw?
Yes and 'Yes But', Yes for decoding, it's an array with 128 entries , But for encoding the algorithm is not exactly the same, the table is larger (~8192 entries). It's possible to use a table for ulaw but with an overhead of 8kB of memory... All code is in file 'ulaw.c' of the libsndfile project (http://www.mega-nerd.com/libsndfile/). Regards.
Committed, thanks: 2007-09-25 Tim-Philipp Müller <tim at centricular dot net> Based on patch by: Laurent Glayal <spglegle yahoo fr> * gst/law/alaw-decode.c: * gst/law/alaw-encode.c: Use static tables for A-Law decoding and encoding; this makes A-Law decoding and encoding less CPU-intensive, but increases the binary size a bit. Leaving old code around for now, selectable by a define in the code. Fixes #435435. Please create a clone of this bug for the mulaw stuff if you think tables are desirable to have there too.