Commit Graph

37 Commits

Author SHA1 Message Date
Michael Niedermayer 5027f39712 swresample/resample: use av_malloc_array() where appropriate
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-08 00:29:26 +02:00
Michael Niedermayer f9158b01d0 swresample/resample: Limit filter length
Related to CID1197063

The limit choosen is arbitrary and much larger than what makes sense.
It avoids the need for checking arithmetic operations with the length for overflow

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-08 00:25:49 +02:00
James Almer 32291ba6ea swresample: add swri_resample_float_sse
At least two times faster than the C version.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-20 06:01:06 +01:00
James Almer 7c8bf09edd swresample: change COMMON_CORE_INT16 asm from SSSE3 to SSE2
pshuf+paddd is slightly faster than phaddd.
The real gain is in pre-ssse3 processors like AMD K8 and K10, which get
a big boost in performance compared to the mmxext version

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-18 15:00:50 +01:00
Michael Niedermayer 9078b40d35 swresample: replace 2 av_free() by av_freep()
avoids leaving stale pointers in memory

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-16 22:44:15 +02:00
Michael Niedermayer 91debec976 swr/resample: fix filter rounding and cliping for s32
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-04 04:05:59 +01:00
Michael Niedermayer f9abeecd94 swr/ build_filter: use av_calloc() fix buffer overflow
Fixes integer & buffer overflow

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-27 05:58:47 +01:00
Alexander Strasser ac25b31ede lswr: Improve default resampler's default parameters
After making some blind tests on a small collection of music
samples for home usage. It turned out that the default cutoff
was too low.

The impact of filter_size was not clearly distinguishable (the
results were on the edge) with the music samples but turned out
to be clearly audible in some synthetic samples.

Thanks to Daniel for helping out with the listening tests.

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
2013-01-04 16:47:57 +01:00
Rob Sykes 801b315729 swr: Add SOX resampler support
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-11 22:04:00 +01:00
Rob Sykes 41049d07f2 swr: add a lowpass default so that each Resampler can have its own default.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-11 22:04:00 +01:00
Michael Niedermayer ae5a55e77a swr: move flush into Resampler
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-11 22:04:00 +01:00
Rob Sykes 5a5d70748c swr: Add API to make resample engine selectable.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-11 22:04:00 +01:00
Clément Bœsch 8f42b09604 swr/resample: fix SSSE3 included unconditionally.
10l Regression since 8ea88339.
2012-11-15 23:52:44 +01:00
Clément Bœsch 8ea8833979 swr/resample: move templating parameters to template itself.
It has various benefits such as allowing some refactoring, clarifying
the code in the inclusion part, and making the template understandable
in standalone.

This commit is based on the templating method used by Justin Ruggles for
libavresample.
2012-11-15 21:24:49 +01:00
Michael Niedermayer 7df9f595c9 swri_resample_init: unsupported sample formats are an internal error.
This condition cannot happen.

Fixes CID733802
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-11 04:36:23 +02:00
Michael Niedermayer 9d89d1d484 swr/resample: mark mm_flags as potentially unused
They are unused when asm is disabled

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-13 19:31:02 +02:00
Michael Niedermayer 070b0e1c77 libswr: remove redundant ARCH_X86, MMX* implicates X86
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-07 22:31:37 +02:00
Derek Buitenhuis 5f256f9df2 swsresample: Fix unprotected inline asm
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-07 22:29:02 +02:00
Michael Niedermayer 4814326533 swr/resample: update SSSE3 flag to new name
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-01 01:29:36 +02:00
Michael Niedermayer 4ec03d1386 bessel: check that the function terminates as expected by av_assert2().
A clear abort is better than wrong output and a possible crash.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-09 01:44:15 +02:00
Justin Ruggles 7e15df7551 swr: resampling: add filter type and Kaiser window beta to AVOptions 2012-07-23 19:23:39 +02:00
Michael Niedermayer 51d2578348 swr: fix MMX resample code, add emms
Fixes Ticket1495

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-30 21:27:39 +02:00
Michael Niedermayer 782763ed2b swr: fix compilation with ancient toolchain that doesnt support SSSE3
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-28 11:13:19 +02:00
Michael Niedermayer 4ccf6e3971 swr: MMX2 & SSSE3 int16 resample core
about 4 times faster

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-28 00:36:27 +02:00
Michael Niedermayer 0c142e4cda swr: introduce filter_alloc in preparation of SIMD resample optimisations
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-19 03:09:24 +02:00
Michael Niedermayer 4def5d2b64 swr: add swr_get_delay() to find the exact delay the swresampler introduces.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-18 23:02:10 +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 24ab1abfb6 resample: support double precission resampling
This commit is dedicated to the audiophiles who can hear it when a
needle is dropped on the moon.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-10 13:48:55 +02:00
Michael Niedermayer 7f1ae79d38 swr: support float & int32 in the resampler
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-10 13:18:49 +02:00
Michael Niedermayer 2f0801527d resample: update copyright years, they where incorrect.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-10 12:35:37 +02:00
Michael Niedermayer 7e592379d9 resample: Fix boundary handling with fragments.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-25 10:34:06 +02:00
Marton Balint 741aca7936 libswresample: introduce int swr_set_compensation() instead of void swr_compensate()
The new version returns AVERROR(EINVAL) is the specified paramters are invalid,
and also creates the resampler if none was used so far.

Signed-off-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-09 04:16:06 +01:00
Clément Bœsch af1eb298c1 swr: use int16_t instead of short for resampling. 2011-11-17 10:16:07 +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
Clément Bœsch 64db5a1a57 swr: drop 'AV' prefix from ResampleContext.
This type/struct is not part of the public API.
2011-11-17 10:16:07 +01:00
Clément Bœsch 7e516a11ca swr: rename resample2 to resample. 2011-11-16 07:27:20 +01:00