Commit Graph

342 Commits

Author SHA1 Message Date
Michael Niedermayer 55d0528669 swr/dither: fix division by 0
Found-by: Daemon404
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-14 02:57:00 +01:00
Michael Niedermayer d676598f87 swr: fix handling of timestamps that cause multiple drops or silence injections
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-13 18:39:06 +01:00
Michael Niedermayer a34aee4646 swr: limit buffer size for silence injection
This reduces memory usage for unreasonable large silence injections

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-13 16:04:41 +01:00
Michael Niedermayer b481d09bd9 swr: limit buffer size for discarding.
This prevents insane memory usage in case of insane input values.
Untested due to lack of a testcase that causes such insane allocation

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-13 16:04:41 +01:00
Michael Niedermayer db4e0ecaf0 swr: move silence buffer to context to avoid per use malloc/free
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-13 15:28:00 +01:00
Michael Niedermayer dc6588421e swr: move buffer used to discard sample to context
This avoids the need to allocate & free to repeatly

Fixes Ticket2122

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-13 15:28:00 +01:00
Michael Niedermayer c8737d348b swr: work with 4 noise shaping coeffs at a time
63->38 kcycles

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-12 19:17:08 +01:00
Michael Niedermayer 93bc0f0180 swr/noise_shaping_data: pad coeffs to multiple of 4 when they are 1 below
This allows using code working with 4 at a time

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-12 19:09:54 +01:00
Michael Niedermayer ef7fdc8cff swr: use a local variable for ns_coeffs
maybe a very tiny bit faster

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-12 17:43:29 +01:00
Michael Niedermayer 68ff7d265f swr: use local variable for ns_errors
71 -> 63 kcycles

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-12 17:43:29 +01:00
Michael Niedermayer b5d9e5d06c swr: minor simplification for the noise shaping pos update
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-12 17:43:29 +01:00
Michael Niedermayer a74548521b swr: check that allocation of in/out_convert succeeded
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-10 20:27:07 +01:00
Michael Niedermayer e5a736261b swr: Use a temporary buffer for dither/Noise shaping when the input is read only
This avoids copying the input

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-10 18:51:30 +01:00
Michael Niedermayer 2eec98125e swr: mark noise data for noise shaping as const
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-10 18:07:32 +01:00
Michael Niedermayer 558aa6cab7 swr: add seperate in/out pointers to the noise shaping code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-10 18:06:19 +01:00
Michael Niedermayer fca51256d4 swr: rename dither_pos to noise_pos
THis more closely matches what the field represents

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-10 18:01:26 +01:00
Michael Niedermayer 2672b2c1d2 swr: scale data down in noise shaping to avoid cliping
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-10 01:44:15 +01:00
Michael Niedermayer 0b60fc94aa swr: reorder the operations in the noise shaping code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-10 00:27:04 +01:00
Michael Niedermayer ead3a2a37e swr: add noise_scale field to seperate it from the noise shaping scales
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-10 00:25:09 +01:00
Michael Niedermayer 6908ded20e swr: fix the noise sample type for noise shaping
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-09 23:28:09 +01:00
Michael Niedermayer 3ef06f3415 swr: split swri_dither_init() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-09 23:28:08 +01:00
Michael Niedermayer 8514d5bcf7 swr: remove unused variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-09 18:41:40 +01:00
Michael Niedermayer 3ab1970612 swr: move dither related fields to their own context
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-09 18:41:12 +01:00
Michael Niedermayer ba1314c2ef swr: update copyright years of a few files iam working on
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-09 18:30:01 +01:00
Michael Niedermayer 82742294b7 swr: Implement Noise shaping dither
The following variants are implemented:
lipshitz noise shaping dither
shibata noise shaping dither
low shibata noise shaping dither
high shibata noise shaping dither
f-weighted noise shaping dither
modified-e-weighted noise shaping dither
improved-e-weighted noise shaping dither

Data tables taken from SOX

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-09 18:25:06 +01:00
Michael Niedermayer f3c9d8d41b swr: use SIMD for dithering
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-09 02:05:35 +01:00
Michael Niedermayer 9aec63af9b swr: fix assertion failure if dither is used without the preout buffer differing from in
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-08 20:07:16 +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
Nicolas George 5f12d5ad78 lswr: improve rematrixing error message.
Report channel layout/count for insufficiently determined
rematrixing.
2012-12-31 18:43:04 +01:00
Rob Sykes 8d9a503313 docs: add soxr documentation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-27 12:13:17 +01:00
Rob Sykes 03d38ee207 soxr_resample: soxr API parameter rename
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-27 11:59:55 +01:00
Rob Sykes f2957adb23 soxr_resample: Correct email address
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-27 11:58:16 +01:00
Michael Niedermayer f9e55c0fed swr: support -async X as a simple way to do what ffmpeg -async X did
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-25 17:21:09 +01:00
Clément Bœsch 0212c1c43d swr/doxy: fix missing quote in code example. 2012-12-16 21:04:54 +01:00
Michael Niedermayer d18706244f audioconvert/arm: require alignment of 16
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-14 04:49:09 +01:00
Michael Niedermayer ceb9f8d927 audioconvert: support simd code with specific alignment requirements.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-14 04:47:17 +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
Michael Niedermayer 431dcc49d2 swr: make realloc_audio() available outside swresample.c
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
Michael Niedermayer 5595e7a102 doxy: fix swr group name
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-11 01:53:18 +01:00
Michael Niedermayer b6a7f66f93 resample: remove disabled debug code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-06 02:51:26 +01:00
Clément Bœsch 2273b3aaf9 swr: remove unused ONE define. 2012-12-05 23:04:01 +01:00
Stefano Sabatini 8bee8f778a lswr/swresample: use AV_OPT_TYPE_SAMPLE_FMT for sample format options
Improve usability and robustness.
2012-12-03 13:49:56 +01:00
Clément Bœsch 52b7823b73 swr: include stdint.h instead of inttypes.h.
stdint.h is for the [u]int*_t types, which is the only thing we need for
the prototypes. inttypes.h includes stdint.h and defines more thing we
don't need here.

Bump micro in case a user app was relying on this include for its own
code.
2012-11-20 21:53:06 +01:00
Clément Bœsch 186942a5e3 swr: fix a few typo in the public header. 2012-11-20 20:29:05 +01:00
Michael Niedermayer 156a75a459 swr-doxy: elaborate on swr_get_delay() and the timebase
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-20 20:05:08 +01:00
Michael Niedermayer 7cca237ddd swr: general doxy text about swr and example code.
Based on doxy from avr
Reviewed-by: Clément Bœsch
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-20 19:46:08 +01:00
Clément Bœsch c02ae48271 swr: set default channel count options to 0.
If not set, they will be defined using the channel layout setting, which
is much more convenient when using swr_alloc() instead of
swr_alloc_set_opts().
2012-11-19 18:49:14 +01:00