Commit Graph

151 Commits

Author SHA1 Message Date
Justin Ruggles a3735bb92a lavr: cosmetics: reindent 2013-02-12 13:41:13 -05:00
Justin Ruggles 1647da89dd lavr: make sure that the mix function is reset even if no mixing will be done
If the matrix reduction ends up with no mixing matrix needed, we need to still
reset the mix function accordingly and log the info to the user.
2013-02-12 13:41:09 -05:00
Justin Ruggles 646831e697 lavr: print out the mix matrix in ff_audio_mix_set_matrix()
This will print the new matrix if it is set after initialization.
2013-02-12 13:35:04 -05:00
Justin Ruggles b90632d596 lavr: always reset mix function names and pointers in mix_function_init()
CC: libav-stable@libav.org
2013-01-17 19:27:01 -05:00
Justin Ruggles f07ef2d9c9 lavr: call mix_function_init() in ff_audio_mix_set_matrix()
This is needed if a custom matrix is set by the user after opening the
AVAudioResampleContext because the matrix channel count can change if
different mixing coefficients are used.

CC:libav-stable@libav.org
2013-01-17 19:27:01 -05:00
Justin Ruggles a6a3164b13 x86: lavr: add SSE2/AVX dither_int_to_float() 2013-01-08 14:52:43 -05:00
Justin Ruggles 1fb8f6a44f x86: lavr: add SSE2 quantize() for dithering 2013-01-08 14:52:43 -05:00
Justin Ruggles 7ff3fd7ae4 lavr: log channel conversion description for any-to-any functions 2013-01-07 21:49:07 -05:00
Justin Ruggles 4164b0e8d3 lavr: mix: reduce the mixing matrix when possible
If the matrix results in an output channel not getting a contribution
from any input channel and the corresponding input channel does not
contribute to any outputs, we can skip the channel during mixing and
silence it after mixing.

If the matrix results in an input channel not contributing to any output
channels and it is not in the output mix, or if the input channel only
contributes fully to the same output channel, we can skip the channel
during mixing.

If the matrix results in an output channel only getting full
contribution from the corresponding input channel and that input channel
does not contribute to any other output channels, we can skip the
channel during mixing.
2013-01-07 21:49:06 -05:00
Justin Ruggles 1ccf82cfd8 lavr: cosmetics: reindent 2013-01-07 21:49:06 -05:00
Justin Ruggles 074a00d192 lavr: add a public function for setting a custom channel map
This allows reordering, duplication, and silencing of input channels.
2013-01-07 21:49:06 -05:00
Justin Ruggles 4d68269d58 lavr: typedef internal structs in internal.h
Simplifies header dependencies by not including all other internal headers
in internal.h.
2013-01-07 21:49:05 -05:00
Justin Ruggles 95d01c3f1c x86: lavr: use the x86inc.asm automatic stack alignment in mixing functions
CC:libav-stable@libav.org
2013-01-05 16:14:35 -05:00
Peter Meerwald be6cde3ce8 lavr: fix missing " in header documentation
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-04 10:29:55 +02:00
Diego Biurrun 511cf612ac miscellaneous typo fixes 2012-12-21 00:18:34 +01:00
Justin Ruggles b2fe6756e3 lavr: add option for dithering during sample format conversion to s16 2012-12-19 18:52:54 -05:00
Hendrik Leppkes 0cf3505930 avresample: use valid log context in mixing functions
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-12-16 19:59:58 -05:00
Justin Ruggles f1c2915ce1 lavr: remove automatic context close/open for resampling compensation
It adds unnecessary complication for insignificant usability improvement.
The user really should know if they'll need resampling compensation before
opening the context.

Note that only the documentation has changed. The current functionality will
still work until the next major bump.
2012-12-16 19:26:17 -05:00
Justin Ruggles f322b20735 lavr: only save/restore the mixing matrix if mixing is being done 2012-12-16 19:26:17 -05:00
Justin Ruggles 230acdde26 lavr: move AudioMix struct definition to audio_mix.c 2012-12-15 12:26:15 -05:00
Justin Ruggles 42b5688d5e lavr: fix segfault due to overlooked change needed in 14758e3
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-12-12 09:09:00 +01:00
Justin Ruggles 14758e3211 lavr: temporarily store custom matrix in AVAudioResampleContext
This allows AudioMix to be treated the same way as other conversion contexts
and removes the requirement to allocate it at the same time as the
AVAudioResampleContext.

The current matrix get/set functions are split between the public interface
and AudioMix private functions.
2012-12-11 14:00:32 -05:00
Justin Ruggles 887d4c05c9 lavr: clarify documentation for avresample_get/set_matrix() 2012-12-11 14:00:32 -05:00
Justin Ruggles 1d86aa8b0f lavr: do not pass consumed samples as a parameter to ff_audio_resample()
Since the resampler handles buffering of unconsumed samples internally, the
caller does not need this information.
2012-11-27 16:49:19 -05:00
Justin Ruggles d2f9f8e094 lavr: correct the documentation for the ff_audio_resample() return value 2012-11-27 16:49:18 -05:00
Justin Ruggles 7f534d11ed lavr: do not pass sample count as a parameter to ff_audio_convert()
It will always be the number of samples in the input buffer, so just use that
directly instead of passing it as a separate parameter.
2012-11-27 16:49:18 -05:00
Ronald S. Bultje 7a9e65acee x86: lavr: fix stack allocation for 7 and 8 channel downmixing on x86-32
Fixes crashes on Win32 and stack overruns on x86-32 in general.
2012-11-17 20:16:04 -05:00
Justin Ruggles 02738792c5 lavr: fix the decision for writing directly to the output buffer
If there are any samples remaining in the output fifo from previous conversion
calls, we have to output those samples first instead of doing direct output
of the current samples.
2012-11-17 20:09:40 -05:00
Diego Biurrun 2b479bcab0 build: Drop AVX assembly ifdefs
An assembler able to cope with AVX instructions is now required.
2012-11-11 20:43:28 +01:00
Justin Ruggles a903f8f087 Include libavutil/channel_layout.h instead of libavutil/audioconvert.h
Also reorder some other #include when applicable.
2012-11-11 13:35:12 -05:00
Diego Biurrun 4b60fac419 x86: PALIGNR: port to cpuflags 2012-11-09 21:31:31 +01:00
Diego Biurrun 352e18b766 x86: avresample: Add missing colons to assembly labels
YASM accepts labels without colons, but NASM issues warnings.
2012-11-06 12:07:35 +01:00
Diego Biurrun 04581c8c77 x86: yasm: Use complete source path for macro helper %includes
This is more consistent with the way we handle C #includes and
it simplifies the build system.
2012-10-31 00:37:42 +01:00
Diego Biurrun 6860b4081d x86: include x86inc.asm in x86util.asm
This is necessary to allow refactoring some x86util macros with cpuflags.
2012-10-31 00:37:42 +01:00
Anton Khirnov dc5793062e lavr: document upper bound on number of output samples.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-29 20:05:47 +01:00
Anton Khirnov 01b760190d lavr: add general API usage doxy
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-29 20:05:41 +01:00
Justin Ruggles 10e645e9cb lavr: handle clipping in the float to s32 conversion
We cannot clip to INT_MAX because that value cannot be exactly
represented by a float value and ends up overflowing during conversion
anyway. We need to use a slightly smaller float value, which ends up
with slightly inaccurate results for samples which clip or nearly clip,
but it is close enough. Using doubles as intermediates in the conversion
would be more accurate, but it takes about twice as much time.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-10-13 12:34:34 +02:00
Anton Khirnov 006afc7a0b lavr: bump major to 1 and declare it stable. 2012-10-05 13:50:13 +02:00
Anton Khirnov e7ba5b1de0 lavr: change the type of the data buffers to uint8_t**.
This is more consistent with what the rest of Libav does.

This breaks API.
2012-10-05 13:49:44 +02:00
Mans Rullgard 8ff7857861 ARM: libavresample: NEON optimised generic fltp to s16 conversion
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-09-13 19:15:43 +01:00
Mans Rullgard d26de339af ARM: libavresample: NEON optimised stereo fltp to s16 conversion
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-09-13 19:15:43 +01:00
Mans Rullgard 643b5b794f ARM: libavresample: NEON optimised flat float to s16 conversion
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-09-13 19:15:42 +01:00
Tim Walker b901c30da6 lavr/audio_mix_matrix: acknowledge the existence of LFE2.
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-09-12 18:26:53 -04:00
Diego Biurrun e0c6cce447 x86: Replace checks for CPU extensions and flags by convenience macros
This separates code relying on inline from that relying on external
assembly and fixes instances where the coalesced check was incorrect.
2012-09-08 18:18:34 +02:00
Martin Storsjö c7b610aa0b avopt: Explicitly store float/double option defaults in .dbl
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:51 +03:00
Martin Storsjö e6153f173a avopt: Store defaults for AV_OPT_TYPE_INT in the i64 union member
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:44 +03:00
Martin Storsjö 124134e424 avopt: Store defaults for AV_OPT_TYPE_CONST in the i64 union member
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:32 +03:00
Diego Biurrun 17337f54c0 x86: Split inline and external assembly #ifdefs 2012-08-31 01:53:25 +02:00
Diego Biurrun a886b279a0 x86: cosmetics: Comment some #endifs for better readability 2012-08-30 18:50:33 +02:00
Anton Khirnov 4d7adec8bd AVOptions: store defaults for INT64 options in int64 union member.
Double does not have enough precision to represent all int64 numbers
exactly.
2012-08-24 11:25:06 +02:00
Justin Ruggles 06e751a40f lavr: x86: optimized 6-channel flt to fltp conversion 2012-08-23 20:10:57 -04:00
Justin Ruggles e07c9705c8 lavr: x86: optimized 2-channel flt to fltp conversion 2012-08-23 20:10:57 -04:00
Justin Ruggles 5245c9f3ad lavr: x86: optimized 6-channel flt to s16p conversion 2012-08-23 20:10:57 -04:00
Justin Ruggles 31d0d7181d lavr: x86: optimized 2-channel flt to s16p conversion 2012-08-23 20:10:57 -04:00
Justin Ruggles 6092dafb5a lavr: x86: optimized 6-channel s16 to fltp conversion 2012-08-23 20:10:57 -04:00
Justin Ruggles 91851a7b37 lavr: x86: optimized 2-channel s16 to fltp conversion 2012-08-23 20:10:57 -04:00
Justin Ruggles 205ace8843 lavr: x86: optimized 6-channel s16 to s16p conversion 2012-08-23 20:10:57 -04:00
Justin Ruggles 8eeffa8ada lavr: x86: optimized 2-channel s16 to s16p conversion 2012-08-23 20:10:57 -04:00
Justin Ruggles b66e20d2aa lavr: x86: optimized 2-channel fltp to flt conversion 2012-08-23 20:10:56 -04:00
Justin Ruggles d5b4e50c47 lavr: x86: optimized 6-channel fltp to s16 conversion 2012-08-23 20:10:56 -04:00
Justin Ruggles a58a013980 lavr: x86: optimized 2-channel fltp to s16 conversion 2012-08-23 20:10:56 -04:00
Justin Ruggles 90cc27f813 lavr: x86: optimized 6-channel s16p to flt conversion 2012-08-23 20:10:56 -04:00
Justin Ruggles 46f929adad lavr: x86: optimized 2-channel s16p to flt conversion 2012-08-23 20:10:56 -04:00
Justin Ruggles 13df7d2d40 lavr: x86: optimized 6-channel s16p to s16 conversion 2012-08-23 20:10:56 -04:00
Justin Ruggles c0e12535aa lavr: x86: optimized 2-channel s16p to s16 conversion 2012-08-23 20:10:56 -04:00
Martin Storsjö 1d9c2dc89a Don't include common.h from avutil.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-15 22:32:06 +03:00
John Stebbins 4cf4028331 libavresample: add mix level normalization option
Provides an option to disable mix level normalization

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2012-08-14 23:36:56 +02:00
Diego Biurrun 3aa696e883 avresample: De-doxygenize some comments where Doxygen is not appropriate 2012-08-11 20:22:01 +02:00
Diego Biurrun 804d7a1aa6 doxygen: Fix function parameter names to match the code 2012-08-09 20:05:55 +02:00
Mans Rullgard a3df4781f4 x86: add colons after labels
nasm prints a warning if the colon is missing.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-07 15:20:56 +01:00
Justin Ruggles 8821ae649e lavr: fix handling of custom mix matrices
Adds some validation for changing parameters after setting the matrix and
fixes a bug in the conversion path setup.
2012-08-04 10:28:22 -04:00
Justin Ruggles e9da9a3111 lavr: x86: improve non-SSE4 version of S16_TO_S32_SX macro
Removes a false dependency on existing contents of the 2nd dst register,
giving better performance for OOE.
2012-07-27 14:21:32 -04:00
Justin Ruggles 2f096bb10e lavr: add x86-optimized mixing functions
Adds optimized functions for mixing 3 through 8 input channels to 1 and 2
output channels in fltp or s16p format with flt coeffs.
2012-07-27 11:25:48 -04:00
Ronald S. Bultje 30b45d9c38 x86inc: automatically insert vzeroupper for YMM functions. 2012-07-26 13:43:16 -07:00
Justin Ruggles 0dadf9d1e9 lavr: x86: add missing vzeroupper in ff_mix_1_to_2_fltp_flt() 2012-07-25 15:41:25 -04:00
Justin Ruggles 6410397600 lavr: resampling: add support for s32p, fltp, and dblp internal sample formats
Based partially on implementation by Michael Niedermayer <michaelni@gmx.at> in
libswresample in FFmpeg. See commits:
7f1ae79d38
24ab1abfb6
2012-07-08 15:22:11 -04:00
Justin Ruggles 372647aed0 lavr: resampling: add filter type and Kaiser window beta to AVOptions 2012-07-08 15:22:11 -04:00
Justin Ruggles 8ca08066fc lavr: Use AV_SAMPLE_FMT_NONE to auto-select the internal sample format
Also make this the default value.
2012-07-08 15:22:11 -04:00
Justin Ruggles db0e7bd0bd lavr: mix: validate internal sample format in ff_audio_mix_init() 2012-07-08 15:22:11 -04:00
Diego Biurrun 2047e40e6e Clarify Doxygen comment for FF_API_* #defines. 2012-07-04 15:10:10 +02:00
Justin Ruggles acd9948e74 lavr: x86: fix ff_conv_fltp_to_flt_6ch function prototypes
Changed to match the number of parameters in conv_func_interleave(), which is
how they are called. The change isn't strictly necessary because the 4th
parameter is not used, but the code is clearer if they match.
2012-06-26 12:29:35 -04:00
Justin Ruggles 14a34d90ad lavr: x86: merge some branches 2012-06-25 13:49:18 -04:00
Justin Ruggles 4e4dd71730 lavr: Add x86-optimized function for flt to s32 conversion 2012-06-18 16:16:59 -04:00
Justin Ruggles 6c63cbfe7a lavr: Add x86-optimized function for flt to s16 conversion 2012-06-18 16:16:59 -04:00
Justin Ruggles 97ce1ba867 lavr: Add x86-optimized functions for s32 to flt conversion 2012-06-18 16:16:59 -04:00
Justin Ruggles 5904f25b9f lavr: Add x86-optimized functions for s32 to s16 conversion 2012-06-18 16:16:59 -04:00
Justin Ruggles d721f67d0a lavr: Add x86-optimized functions for s16 to flt conversion 2012-06-18 16:16:59 -04:00
Justin Ruggles 1168e29df1 lavr: Add x86-optimized function for s16 to s32 conversion 2012-06-18 16:16:59 -04:00
Justin Ruggles f61ce90caa lavr: add x86-optimized functions for mixing 1-to-2 s16p with flt coeffs 2012-06-18 11:24:10 -04:00
Justin Ruggles 29f7490c46 lavr: add x86-optimized functions for mixing 1-to-2 fltp with flt coeffs 2012-06-18 11:24:10 -04:00
John Stebbins 3971be0eb5 Add Dolby/DPLII downmix support to libavresample
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-06-18 10:55:00 -04:00
Justin Ruggles b75726cb79 lavr: add x86-optimized function for mixing 2 to 1 s16p with q8 coeffs 2012-05-29 15:33:25 -04:00
Justin Ruggles c140fb2cbc lavr: add x86-optimized functions for mixing 2 to 1 s16p with float coeffs 2012-05-29 15:33:18 -04:00
Justin Ruggles 8dfc122719 lavr: add C functions for mixing 2 to 1 channels with s16p format 2012-05-29 15:16:20 -04:00
Justin Ruggles 5cc6d5244d lavr: replace the SSE version of ff_conv_fltp_to_flt_6ch() with SSE4 and AVX
The current SSE version is slower than the MMX version on Athlon64 and Sandy
Bridge, but the SSE4 and AVX versions are faster on Sandy Bridge.
2012-05-09 16:17:59 -04:00
Anton Khirnov 9684341346 lavr: do not try to copy to uninitialized output audio data.
This would happen at least when lavr is used as a fifo with no
conversion.
2012-05-09 17:38:23 +02:00
Anton Khirnov 0982b0a431 lavr: make avresample_read() with NULL output discard samples. 2012-05-09 17:37:47 +02:00
Diego Biurrun dbe6ba55a3 build: cosmetics: Add missing end-of-line backslashes to item lists. 2012-05-07 14:17:40 +02:00
Justin Ruggles 4010d724e1 lavr: use 8.8 instead of 10.6 as the 16-bit fixed-point mixing coeff type 2012-05-01 13:52:59 -04:00
Reimar Döffinger e5b7d7773a Fix compilation with YASM/NASM without AVX support.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-05-01 13:37:25 -04:00