Commit Graph

58 Commits

Author SHA1 Message Date
Reimar Döffinger
2c5c37ade1 libswresample: move condition to start of loop.
This avoids several issue like calculating sum/maxcoef
incorrectly due to adding up matrix entries that will
be overwritten, as well as out-of-range writes to
s->matrix if the maximum allowed number of channels is used.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2014-09-07 11:31:34 +02:00
Reimar Döffinger
284123d7fd Remove pointless if.
A branch to avoid some calculation seems unlikely to have any benefits.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2014-09-07 11:31:33 +02:00
Reimar Döffinger
2231d5b671 libswresample: Avoid needlessly large on-stack array.
We only actually need to use a tiny part of it.
Unfortunately we seem to have no real test coverage on
the code, so this is a bit risky.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2014-09-07 11:31:33 +02:00
Michael Niedermayer
291d464161 swresample: fix AV_CH_LAYOUT_STEREO_DOWNMIX input
Fixes Ticket 3542

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-24 01:25:46 +02:00
Nicolas George
4a640a6ac8 lswr: fix assert failure on unknown layouts. 2013-11-03 10:30:37 +01:00
Michael Niedermayer
c56d4dab03 swr/rematrix: Fix handling of AV_CH_LAYOUT_STEREO_DOWNMIX output
Fixes Ticket2859

Note, testcases related to the downmix channels are welcome.
(id like to make sure this is working correctly now, as obviously it didnt
 work before ...)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-20 16:56:51 +02:00
Michael Niedermayer
6dfffe9200 swr: clean layouts before checking sanity
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-20 16:49:31 +02:00
Michael Niedermayer
7ac12599fe swresample: fix negative rematrix volumns
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-22 03:24:22 +02:00
Michael Niedermayer
e2b718464e swresample: Make rematrix maxvalue user settable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-22 03:23:54 +02:00
Michael Niedermayer
4cfc92081d swr: add native_simd_one
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-04 23:50:45 +02:00
Michael Niedermayer
b84de51f54 swresample/rematrix: add S32 mixing code
Needed for dithering S32

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-04 15:12:11 +02:00
Michael Niedermayer
6e29f39252 swr/rematrix: use av_calloc()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-15 20:31:06 +02:00
Clément Bœsch
5e68bf9b92 swr/rematrix: move templating parameters to template itself. 2012-11-15 21:24:49 +01:00
Paul B Mahol
1acd2f6ba7 Replace rest of libavutil/audioconvert.h with libavutil/channel_layout.h
Also remove it in once case when it is not needed.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2012-11-13 13:21:21 +00:00
Michael Niedermayer
555f352f99 swr/rematrix: fix C99 left shift overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-14 03:48:05 +02:00
Michael Niedermayer
31a797eb28 swr: add av_cold to init/free functions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-09 02:26:20 +02:00
Michael Niedermayer
0e78e575ed swr/auto_matrix: treat a single channel as mono instead of failing
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-08 21:32:24 +02:00
Michael Niedermayer
f8d74cbdc3 swr/auto_matrix: treat stereo downmix like stereo.
Based on code by John Stebbins
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-08 21:12:40 +02:00
Michael Niedermayer
c8ffab06f4 swr/auto_matrix: add clean layout function
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-08 21:10:19 +02:00
Michael Niedermayer
ebc854e4e9 swr/auto_matrix: move layouts to local variables
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-08 20:58:57 +02:00
Michael Niedermayer
c5278cb84f Add Dolby/DPLII downmix support to libswresample
Based on code by John Stebbins <jstebbins.hb@gmail.com>

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-07 00:41:49 +02:00
Michael Niedermayer
2dd2e42951 swr: update rematrix coeffs to match AC-3
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-07 00:29:06 +02:00
Michael Niedermayer
7309451d73 swr: fix warning: passing argument 2 of s->mix_any_f from incompatible pointer type
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-02 17:33:27 +02:00
Michael Niedermayer
04b5eb47a6 swr: fix mix* related function pointer warnings
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-02 17:23:22 +02:00
Stefano Sabatini
065851ffac lswr/rematrix: specify explicitly the name of the unsupported channel layouts
Help debugging.
2012-06-21 12:47:47 +02:00
Michael Niedermayer
728f86edfc swr: mix_2_1_int16_mmx/sse
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-12 17:49:12 +02:00
Michael Niedermayer
cbeeaf2593 swr: mix_1_1 int16 MMX
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-12 16:35:13 +02:00
Michael Niedermayer
beb0cd6acf swr: SIMD rematrixing and SSE/AVX mix_1_1 float
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-12 16:35:07 +02:00
Michael Niedermayer
48a45f819f swr: add native matrix for SIMD
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-12 16:16:15 +02:00
Michael Niedermayer
a5c6349358 swr: skip memset(0) in rematrix when the array is known to be already 0
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 02:43:10 +02:00
Michael Niedermayer
b0348158a0 swr: 5.1->stereo double, float and s16
2.5 times faster than the generic code

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-08 22:02:14 +02:00
Michael Niedermayer
ca30ae12c5 swr: add all in one rematrixing function ptr
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-08 21:55:33 +02:00
Michael Niedermayer
dfde3d497e swr: add inrermediate sample type for rematrixing
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-08 21:54:54 +02:00
Michael Niedermayer
f2e799a3d0 swr: add double precision support to the rematrix code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-02 01:12:16 +02:00
Justin Ruggles
6d5bf67f04 swr: add lfe_mix_level
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-02 01:12:10 +02:00
Justin Ruggles
9b42653b22 swr: update side to back mixing.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-02 01:11:55 +02:00
Michael Niedermayer
aab5a4521c swr: add and use function pointers for rematrix
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-01 20:20:21 +02:00
Michael Niedermayer
00fea26faf swr: add native matrix for rematrixing
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-01 20:19:28 +02:00
Michael Niedermayer
edbde52226 swr: change sample format representation so as to maintain the planer/packed distinction.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-28 13:02:58 +02:00
Michael Niedermayer
f9a2c5bc07 swr: simplify code by using av_get_bytes_per_sample()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-11 10:02:00 +02:00
Michael Niedermayer
7c673d73ec swr: use assert in swri_sum2 to check that only supported formats are used.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-10 19:54:42 +02:00
Michael Niedermayer
db2eadb2f5 swr: add dither support.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-10 19:54:41 +02:00
Michael Niedermayer
5c1f312888 swr: update copyright year for rematrix
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-10 19:54:41 +02:00
Nicolas George
a8cdb7b95a swr: special case for empty channels in rematrix.
Speed += 10% overall for pan=stereo:FL=FL+FR from wav to null.
2012-03-07 23:56:00 +01:00
Nicolas George
560b224f53 libswr: allow to set custom matrices. 2012-02-20 20:46:35 +01:00
Clément Bœsch
c4deb90cfa swr: use "swri_" prefix instead of "swr_" for the private API. 2011-11-17 10:16:07 +01:00
Michael Niedermayer
2f86566a31 rematrix: add parameter to tune volume
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-26 00:46:46 +02:00
Michael Niedermayer
b1470d7a60 rematrix: change type of integers from 16 to 32bit to allow increasing volume with it.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-26 00:46:46 +02:00
Michael Niedermayer
1e40b2c22b rematrix: add type for coefficients
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-26 00:46:46 +02:00
Michael Niedermayer
76dbb0905a rematrix: Fix several passing argument from incompatible pointer type warnings.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-21 00:28:03 +02:00