summaryrefslogtreecommitdiff
path: root/src/pulsecore/sample-util.c
Commit message (Collapse)AuthorAgeFilesLines
* update FSF addresses to FSF web pageOndrej Holecek2015-01-141-3/+1
| | | | | | | | | FSF addresses used in PA sources are no longer valid and rpmlint generates numerous warnings during packaging because of this. This patch changes all FSF addresses to FSF web page according to the GPL how-to: https://www.gnu.org/licenses/gpl-howto.en.html Done automatically by sed-ing through sources.
* endianmacros: Replace borked PA_FLOAT32_SWAP() with PA_READ_FLOAT32RE() / ↵Peter Meerwald2014-09-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PA_WRITE_FLOAT32RE() building PA with -O0 leads to test failure in mix-test on i386 issue reported by Felipe, see http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-August/021406.html the problem is the value 0xbeffbd7f: when byte-swapped it becomes 0x7fbdffbe and according to IEEE-754 represents a signalling NaN (starting with s111 1111 10, see http://en.wikipedia.org/wiki/NaN) when this value is assigned to a floating point register, it becomes 0x7ffdffbe, representing a quiet NaN (starting with s111 1111 11) -- a signalling NaN is turned into a quiet NaN! so PA_FLOAT32_SWAP(PA_FLOAT32_SWAP(x)) != x for certain values, uhuh! the following test code can be used; due to volatile, it will always demonstrate the issue; without volatile, it depends on the optimization level (i386, 32-bit, gcc 4.9): // snip static inline float PA_FLOAT32_SWAP(float x) { union { float f; uint32_t u; } t; t.f = x; t.u = bswap_32(t.u); return t.f; } int main() { unsigned x = 0xbeffbd7f; volatile float f = PA_FLOAT32_SWAP(*(float *)&x); printf("%08x %08x %08x %f\n", 0xbeffbd7f, *(unsigned *)&f, bswap_32(*(unsigned *)&f), f); } // snip the problem goes away with optimization when no temporary floating point registers are used the proposed solution is to avoid passing swapped floating point data in a float; this is done with new functions PA_READ_FLOAT32RE() and PA_WRITE_FLOAT32RE() which use uint32_t to dereference a pointer and byte-swap the data, hence no temporary float variable is used also delete PA_FLOAT32_TO_LE()/_BE(), not used Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Reported-by: Felipe Sateler <fsateler@debian.org>
* Remove pa_bool_t and replace it with bool.poljar (Damir Jelić)2013-07-041-2/+2
| | | | | | | | | | | | | | | | | commands used for this (executed from the pulseaudio/src directory): find . -regex '\(.*\.[hc]\|.*\.cc\|.*\.m4\)' -not -name 'macro.h' \ -a -not -name 'reserve.[ch]' -a -not -name 'reserve-monitor.[ch]' \ -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \ -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \ -a -not -name 'poll-win32.c' -a -not -name 'thread-win32.c' \ -a -not -name 'dllmain.c' -a -not -name 'gconf-helper.c' \ -exec sed -i -e 's/\bpa_bool_t\b/bool/g' \ -e 's/\bTRUE\b/true/g' -e 's/\bFALSE\b/false/g' {} \; and: sed -i -e '181,194!s/\bpa_bool_t\b/bool/' \ -e '181,194!s/\bTRUE\b/true/' -e \ '181,194!s/\bFALSE\b/false/' pulsecore/macro.h
* sample-util: Remove duplicate stdio.h #includePeter Meerwald2013-02-151-1/+0
| | | | Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
* core: Move pa_mix() into new file mix.cPeter Meerwald2013-02-151-644/+0
| | | | | | | | | idea is to allow optimized code path (similar to volume code) and rework/specialize mixing cases to enable runtime performance improvements no functionality changes in this patch Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
* memblock: Add pa_memblock_acquire_chunk().Tanu Kaskinen2012-08-221-2/+2
| | | | | | Besides making the code a bit cleaner, this also gets rid of a few "cast increases required alignment of target type" warnings.
* sample-util: Remove redundant check from pa_volume_memchunk.Tanu Kaskinen2012-03-281-5/+1
| | | | | | | | Add also an assertion for the sample spec validity. The existing code already does crash in case of an invalid sample spec, but the error would not be as obvious: the crash would happen due to a divide-by-zero operation in pa_frame_aligned().
* sample-util: Fix "Darth Vader" panning bugDavid Henningsson2012-02-101-91/+78
| | | | | | | | | | | | | For muted channels, we forgot to increment a pointer, so if one channel was muted but not the other, sound became distorted in a Darth Vader like way. To test the difference, start two input streams and pan one of them hard left (or right). And hey, if you didn't think it sounded like Darth Vader, it's your imagination that's broken, not mine! ;-) BugLink: https://bugs.launchpad.net/bugs/928757 Signed-off-by: David Henningsson <david.henningsson@canonical.com>
* More spelling fixesMaarten Bosmans2011-08-251-1/+1
|
* sample-util: Fix off-by-one in error checkArun Raghavan2011-08-181-2/+2
| | | | Patch by jk.illwinter on http://www.pulseaudio.org/ticket/951
* sample-util: use built-in functionLu Guanqun2011-08-111-1/+1
| | | | | | use built-in function pa_frame_aligned(). Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
* Remove unnecessary #includesMaarten Bosmans2011-06-221-0/+1
|
* Fixup #include directives according to Coding StyleMaarten Bosmans2011-03-111-1/+1
| | | | | Use #include "header.h" if functionality of header.h is implemented and #include <header.h> if functionality of header.h is used.
* Fix up according to Coding StyleMaarten Bosmans2011-03-111-1/+1
| | | | Only whitespace changes in here
* use pa_fopen_cloexec() where applicableLennart Poettering2009-10-301-1/+1
|
* sample-util: add pa_convert_size() call for converting sizes between two ↵Lennart Poettering2009-09-091-0/+10
| | | | sample specs
* sample-util: avoid stack overrunWim Taymans2009-08-271-2/+2
| | | | | The linear volume array needs enough padding when preparing the volumes for mixing.
* whitespace fixesWim Taymans2009-08-201-5/+6
|
* samples-util: add padding to volume arrayWim Taymans2009-08-201-5/+17
| | | | | Pad the volume array with a copy of the start. We'll need this later to be able to write optimized functions.
* sample-util: move volume code to separate fileWim Taymans2009-08-201-311/+5
| | | | | Move the volume code into a separate file with the reference C implementations. Add a function to retrieve the volume function and one to install a new one.
* sample-util: move some functions aroundWim Taymans2009-08-201-22/+22
| | | | Move some stuff around before splitting it into a separate file.
* sample-utils: coding style cleanupWim Taymans2009-08-201-53/+46
| | | | | | Make the coding style match the rest of pulseaudio more. Remove some liboil functions, they seem unoptimized and likely slower than our handrolled versions here.
* sample-utils: split out functions from caseWim Taymans2009-08-201-283/+303
| | | | | Move the volume functions out of the switch case and use a table indexed by the sample format to find the volume function.
* sample: fix build on BE archsLennart Poettering2009-06-081-1/+1
|
* sample-util: fix iteration loop when adjusting volume of s24 samplesLennart Poettering2009-05-011-4/+4
|
* sample-util: properly allocate silence block for s24-32 formatsLennart Poettering2009-05-011-0/+4
|
* Use LGPL 2.1 on all files previously using LGPL 2Colin Guthrie2009-03-031-1/+1
|
* don't overflow when we do digital amplification of 16 bit samplesLennart Poettering2009-01-231-31/+71
|
* Add support for 24bit samples encoded in the LSB of 32 bit wordsLennart Poettering2009-01-161-0/+120
|
* add support for 24bit packed samplesLennart Poettering2009-01-161-0/+123
|
* add new API function pa_memchunk_sine()Lennart Poettering2009-01-121-0/+34
| | | | | Ease generation of sine signals. Try to make the repeatable sine memblock fit into a single mempool slot.
* make things compile againLennart Poettering2009-01-081-1/+2
|
* Add new debuuging API pa_memchunk_dump_to_file()Lennart Poettering2009-01-081-0/+27
|
* fix return value of pa_frame_aligned()Lennart Poettering2008-10-211-1/+1
|
* make a few casts explicit to remove compiler warningsLennart Poettering2008-10-031-2/+2
|
* user lrint() and friends in inner loops instead of normal C casts to speed ↵Lennart Poettering2008-10-031-2/+2
| | | | up a few things
* optimize mixing routines a bit by pulling the multiplication with the global ↵Lennart Poettering2008-10-031-112/+85
| | | | volume out of the inner loop by applying it first to the per-stream volumes
* when we mix into a 16bit accumulator make sure we clamp before we scale with ↵Lennart Poettering2008-10-021-4/+4
| | | | a volume to avoid range faults when multiplying
* add byte-to-usec and usec-to-byte converters that round up, not downLennart Poettering2008-08-281-0/+33
|
* add a few more gcc warning flags and fix quite a few problems found by doing soLennart Poettering2008-08-191-14/+13
|
* otpimize mixing code a bit by moving a few checks out of the inner loopsLennart Poettering2008-08-111-83/+39
|
* optimize volume changing a bit by only using a single counter for the inner ↵Lennart Poettering2008-08-111-31/+36
| | | | loops instead of two
* adhere to struct gcc aliasing rulesLennart Poettering2008-08-111-7/+3
|
* get rid of svn $ keywordsLennart Poettering2008-06-181-2/+0
|
* merge glitch-free branch back into trunkLennart Poettering2008-05-151-42/+138
| | | | git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2445 fefdeb5f-60dc-0310-8127-8f9354f1896f
* optimize mixing code a bit. Add mixers for S32LE, S32BE, ULAW, ALAW and ↵Lennart Poettering2007-11-091-110/+450
| | | | | | FLOAT32BE. Add volume adjusters for FLOAT32BE, ALAW, ULAW. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2041 fefdeb5f-60dc-0310-8127-8f9354f1896f
* replace a few CLAMPs by PA_CLAMP_UNLIKELYLennart Poettering2007-11-091-3/+3
| | | | git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2040 fefdeb5f-60dc-0310-8127-8f9354f1896f
* add support for 32bit integer samplesLennart Poettering2007-11-091-6/+55
| | | | git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2037 fefdeb5f-60dc-0310-8127-8f9354f1896f
* merge 'lennart' branch back into trunk.Lennart Poettering2007-10-281-83/+205
| | | | git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1971 fefdeb5f-60dc-0310-8127-8f9354f1896f
* Kill spaces on EOLLennart Poettering2007-05-291-1/+1
| | | | git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1465 fefdeb5f-60dc-0310-8127-8f9354f1896f