Commit graph

358 commits

Author SHA1 Message Date
Wim Taymans
801f7ca464 audio-format: add TRUNCATE_RANGE flag
Add a TRUNCATE_RANGE flag for unpack functions to fill the least
significate bits with 0 (as did the old code). Also add functions
that don't truncate. Use the TRUNC flag in audioconvert for
backwards compatibility for now.
2015-11-03 12:12:08 +01:00
Wim Taymans
9e15c89564 audioconvert: change multiplier for int<->float conversion
Use (1 << 31) as the multiplier for int<->float conversions. This makes
sure that int->float conversions always end up with floats between
[-1.0, 1.0].
For the conversion from float to int, this multiplier will give the complete
int range after we perform clipping.
Change the unit test to take this into consideration.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=755301
2015-11-03 12:12:08 +01:00
Sebastian Dröge
000c424835 audioconvert: Clip input buffers to the segment before handling them
https://bugzilla.gnome.org/show_bug.cgi?id=757068
2015-11-02 10:20:37 +02:00
Tim-Philipp Müller
3dd26bb9e8 audioconvert: update orc backup code to fix build without orc 2015-11-01 23:06:11 +00:00
Wim Taymans
5cf367ae57 audioconvert: rework audioconvert
Rewrite audioconvert to try to make it more clear what steps are
executed during conversion.
Add passthrough step that just does a memcpy when possible.
Add ORC optimized dither and quantization functions.
Implement noise-shaping on S32 samples only and allow for arbitrary
noise shaping coefficients if we want this later.
2015-10-30 17:51:47 +01:00
Wim Taymans
e1569ce76a channelmix: fix up API a little
don't use gpointer * for something that should be gpointer.
2015-10-30 17:51:47 +01:00
Wim Taymans
26d469a04b audioquantize: make helper for add with saturation 2015-10-30 17:51:47 +01:00
Wim Taymans
cd6c29e071 audioconvert: make the quantizer a reusable object
Turn the quantizer into a reusable object.
2015-10-28 11:36:18 +01:00
Wim Taymans
8fc2569328 audioconvert: make the channel mixer a separate reusable object
A first attempt at making the channel mixer a separate object.
2015-10-28 11:36:18 +01:00
Wim Taymans
8d4cd51e59 audioquantize: fix 8-pole noise shaping
Fix the 8-pole noise shaping error update. We were mixing errors from
different channels.
2015-10-28 11:36:18 +01:00
Sebastian Dröge
b4afaee8c0 audioconvert: Update disted orc files 2015-10-23 19:13:05 +03:00
Wim Taymans
2b626a5adf audioconvert: use pack/unpack functions
Rework the converter to use the pack/unpack functions
Because the unpack functions can only unpack to 1 format, add a separate
conversion step for doubles when the unpack function produces int.
Do conversion to S32 in the quantize function directly.
Tweak the conversion factor for doing float->int conversion slightly to
get the full range of negative samples, use clamp to make sure we don't
exceed our int range on the positive axis (see also #755301)
2015-10-23 16:58:17 +02:00
Sebastian Dröge
010e35afa7 audioconvert: Also copy metas if their API has no tags attached to it
This is the default basetransform behaviour, being more strict than that
is not really useful.
2015-06-29 13:06:49 +02:00
Mathieu Duponchelle
88484399c5 audioconvert: copy metadata that only has the "audio" tag.
https://bugzilla.gnome.org/show_bug.cgi?id=750406
2015-06-04 19:16:40 +02:00
Tim-Philipp Müller
ec5c93f169 docs: update element example pipelines
- gst-launch -> gst-launch-1.0
- use autoaudiosink and audiovideosink more often
- review pipeline examples and descriptions
2015-05-10 11:38:19 +01:00
Luis de Bethencourt
69f66aff9e Rename property enums from ARG_ to PROP_
Property enum items should be named PROP_ for consistency and readability.
2015-04-27 11:27:00 +01:00
Tim-Philipp Müller
c680e324bc Remove obsolete Android build cruft
This is not needed any longer.
2015-04-26 18:42:34 +01:00
Bernhard Miller
1c01b50ada audioconvert: fix mixed usage of gint and gint32 in int matrix
This is a fixup for b2db18cda2
audioconvert: avoid float calculations when mixing integer-formatted channels

The int matrix was using gint and gint32 synonymously, which can theoretically
cause problems if gint and gint32 are actually different types.

https://bugzilla.gnome.org/show_bug.cgi?id=747005
2015-04-15 12:18:03 +02:00
Bernhard Miller
b2db18cda2 audioconvert: avoid float calculations when mixing integer-formatted channels
The patch calculates a second channel mixing matrix from the current one. The
matrix contains the original values * (2^10) as integers. This matrix is used
when integer-formatted channels are mixed.

On a ARM Cortex-A8, single core, 800MHz this improves performance in a
testcase from 29s to 9s for downmixing 6 channels to stereo.

https://bugzilla.gnome.org/show_bug.cgi?id=747005
2015-04-01 07:31:37 -07:00
Ilya Konstantinov
3dc3aa4e3b audioconvert: Eliminate unsigned quantizers
audio_convert_convert unpacks to default format (signed) before calling
quantize, and the unsigned variants were equivalent to signed anyway,
so we just get rid of them.
2015-03-24 16:52:07 +01:00
Ilya Konstantinov
7b398701cf audioconvert: Avoid int division in quantization
Since range size is always 2^n, we can simply use modulo (implemented
with a bitmask).

The previous implementation used 64-bit integer division, which is
done in software on ARMv7. Although the divisor was constant, the
division could not be transformed into "multiplication by magic number"
since the dividend was 64-bit.

The now-unused and not-so-fast gst_fast_random_(u)int32_range functions
were removed.

Also, implementing bug fixes:

1) ADD_DITHER_TPDF_HF_I no longer discards bias.

2) We change TPDF's noise range to be the same as RPDF's. Previously,
RPDF's noise ranged:
  { bias - dither, bias + dither }
while TPDF's noise ranged:
  { bias/2 - dither/2, bias/2 + dither/2 - 1 } +
  { bias/2 - dither/2, bias/2 + dither/2 - 1 } =
  { bias - dither, bias + dither - 2 }
Now, both range:
  { bias - dither, bias + dither - 1 }

https://bugzilla.gnome.org/show_bug.cgi?id=746661
2015-03-24 16:52:07 +01:00
Luis de Bethencourt
783204824d orc: update orc files 2015-01-27 13:39:14 +00:00
Sebastian Dröge
2bd4ea6e8e Constify some static arrays everywhere 2015-01-21 09:49:47 +01:00
Sebastian Dröge
68f5350c66 Release 1.3.1 2014-05-03 17:50:10 +02:00
Tim-Philipp Müller
bcb8068e27 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 23:28:57 +01:00
Tim-Philipp Müller
6c6619a669 audioconvert: never do mixing for 1->1 channel conversions
MONO and NONE position are the same, for example, but in
general there isn't much to do here for such a conversion.

Fixes problem in audioconvert, which would end up using
a mixmatrix when converting between different mono format
because it thinks MONO positioning is different from
unpositioned channels, which is not the case in this
special case. The mixmatrix would end up being 0.0 so
audioconvert would convert to silence samples.

https://bugzilla.gnome.org/show_bug.cgi?id=724509
2014-02-18 10:48:07 +00:00
Matej Knopp
12f85c325d audioconvert: Map buffer as READWRITE if the buffer and memory is writable
and only use the input buffer as temporary buffer in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=709408
2013-10-04 14:02:06 +02:00
Tim-Philipp Müller
0715e73725 audioconvert: improve fixate_format function readability even more
Do the flags comparisons only once and re-use the result.
2013-08-23 19:47:57 +01:00
Tim-Philipp Müller
f317061b9c audioconvert: simplify fixate_format function some more
If we have no output format yet, any format will do. The
!out_info condition existed in every path, so just split
it our for clarity. KISS.
2013-08-23 19:43:14 +01:00
Tim-Philipp Müller
7a481c13ae audioconvert: make fixate function more readable
Use some variables to replace accessor macros to make code
a little bit mor readable.
2013-08-23 19:11:17 +01:00
Tim-Philipp Müller
f448977dbd audioconvert: remove unnecessary deep nesting in fixate function
Makes it easier to read and removes two levels of indentation.
2013-08-23 18:53:48 +01:00
Sebastian Dröge
cebae4514a audioconvert: If we have to lose precision, try to lose as less precision as possible
https://bugzilla.gnome.org/show_bug.cgi?id=706624
2013-08-23 18:52:50 +02:00
Sebastian Dröge
ff5d3313d4 Release 1.1.1 2013-06-05 18:31:27 +02:00
Tim-Philipp Müller
f5c0d61be7 Update disted orc backup files
Generated with 0.4.17 now.
2013-04-22 13:58:33 +01:00
Sebastian Dröge
948a4a3632 gst: Add better support for static plugins 2013-04-15 15:52:58 +02:00
Tim-Philipp Müller
5f59b4f7ee Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 23:05:09 +00:00
Sebastian Dröge
9e6021fe4b audioconvert: Always prefer the input format if possible
Previously we could've chosen another format with the same
depth even if the input format was possible.

Also make sure to chose according to the order in the
caps.
2012-11-01 16:44:05 +01:00
Sebastian Dröge
bc4389806d audioconvert: Also ignore the SIGNED flag when matching an output format 2012-11-01 14:31:29 +01:00
Rasmus Rohde
c286f8ffa2 audioconvert: Prefer output formats with the same depth or at least a higher depth
Enhance current code to prefer an exact match on sample depth if
possible. Also ignore GST_AUDIO_FORMAT_FLAG_UNPACK when checking
equality on the flags.
2012-11-01 14:29:43 +01:00
Sebastian Dröge
3c1041d5eb Revert "gst: Add better support for static plugins"
This reverts commit d2d79e3bc2,
which was accidentially pushed.
2012-10-24 13:26:26 +02:00
Sebastian Dröge
d2d79e3bc2 gst: Add better support for static plugins 2012-10-24 12:10:44 +02:00
Mark Nauwelaerts
a66ff00908 audioconvert: enhance transforming caps
... so as to preserve input format precision,
and preferably not convert at all.
2012-10-19 16:02:44 +02:00
Tim-Philipp Müller
6842698f0d Purge all references to liboil
And remove unused ffmpegcolorspace tests in the process.

https://bugzilla.gnome.org/show_bug.cgi?id=673285
2012-09-29 11:47:52 +01:00
Tim-Philipp Müller
f7c6aa5abd Release 0.11.94 2012-09-14 02:47:54 +01:00
Mark Nauwelaerts
22d7149ba6 audioconvert: plug leak 2012-09-06 14:02:07 +02:00
Mark Nauwelaerts
88e73f8515 audioconvert: prefer channels of base caps when fixating
... which in turn prefers to preserve input channels when converting.
2012-07-25 15:58:19 +02:00
Wim Taymans
5d3b56e9c4 audioconvert: prefix orc functions with audio_convert_orc_ 2012-07-23 17:24:13 +02:00
Tim-Philipp Müller
3c6a3ad629 Use new gst_element_class_set_static_metadata() 2012-04-10 00:45:16 +01:00
Sebastian Dröge
ad42b16375 gst: Update for GST_PLUGIN_DEFINE() API change 2012-04-05 15:11:05 +02:00
Sebastian Dröge
65307dd132 gst: Update versioning 2012-04-04 14:55:15 +02:00
Wim Taymans
b52c035f13 audioconvert: remove useless transform_ip function 2012-04-02 11:21:26 +02:00
Mark Nauwelaerts
aaf84a941e audioconvert: plug caps leak 2012-03-30 16:56:40 +02:00
Wim Taymans
1982d1ce12 Release 0.11.3 2012-03-22 15:51:39 +01:00
Wim Taymans
25137962ad fix for caps API changes 2012-03-11 19:04:41 +01:00
Wim Taymans
ef980bc09b audioconvert: improve fixation 2012-02-27 12:52:07 +01:00
Wim Taymans
9212619549 update for new fixate_caps function 2012-02-22 12:32:44 +01:00
Wim Taymans
fcdc385aa1 port to new map API 2012-01-25 12:30:53 +01:00
Sebastian Dröge
241de164ee audioconvert: Fix channel-mask handling 2012-01-05 10:34:25 +01:00
Sebastian Dröge
5bdf6b3383 gst: Add new layout field to the raw audio caps 2012-01-05 10:34:25 +01:00
Sebastian Dröge
e0f9b4fffc audioconvert: Port to the new multichannel caps
audioconvert still needs support for mixing all the new
channel positions, see:
https://bugzilla.gnome.org/show_bug.cgi?id=666506
2012-01-05 10:34:19 +01:00
Wim Taymans
ff4efd075f audioconvert: handle unpositioned channels
Refuse to convert between unpositioned layouts.
2012-01-02 15:03:54 +01:00
Tim-Philipp Müller
177525f89f Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	gst-libs/gst/netbuffer/gstnetbuffer.c
	gst/ffmpegcolorspace/avcodec.h
	gst/ffmpegcolorspace/gstffmpegcodecmap.c
	gst/ffmpegcolorspace/imgconvert.c
	gst/ffmpegcolorspace/imgconvert_template.h
	gst/ffmpegcolorspace/mem.c
	gst/playback/README
	gst/playback/gstplaybasebin.c
	gst/playback/gstplaybasebin.h
	gst/playback/gstplaybin.c
	sys/v4l/v4lmjpegsrc_calls.c
	sys/v4l/videodev_mjpeg.h
	tests/check/elements/gnomevfssink.c
2011-12-02 11:10:17 +00:00
Piotr Fusik
14644457b0 various: typo fixes
Fix typos in code and docs. Fixes. #658984
2011-12-02 12:03:27 +01:00
Vincent Penquerc'h
96374054ac various: fix pad template leaks
https://bugzilla.gnome.org/show_bug.cgi?id=662664
2011-11-28 13:09:02 +00:00
René Stadler
5f3c8eb680 audioconvert, videoconvert: fix caps leak in transform_caps 2011-11-12 01:38:37 +01:00
René Stadler
7651fa27dc audioconvert: fix leak of channel matrix
gst_channel_mix_unset_matrix relies on the channel count to free the matrix
array, so run it before resetting it to zero with gst_audio_info_init.
2011-11-11 20:19:53 +01:00
Vincent Penquerc'h
7ca4b51b01 audioconvert: truncate caps in _fixate
Otherwise the resulting caps may not be fixed.
2011-11-10 14:38:09 +00:00
Wim Taymans
016d036137 Merge branch 'master' into 0.11
Conflicts:
	configure.ac
	gst-libs/gst/audio/gstbaseaudiosink.c
	gst/audioconvert/channelmixtest.c
	gst/playback/gstplaybasebin.c
	gst/playback/gstsubtitleoverlay.c
	tests/examples/Makefile.am
	tests/examples/audio/Makefile.am
2011-10-27 15:44:58 +02:00
René Stadler
0a5fcbb080 audioconvert: bury dead test program 2011-10-21 22:24:14 +02:00
Edward Hervey
1c10fbcd33 audioconvert: We can handle channels conversion 2011-10-17 12:28:58 +02:00
Tim-Philipp Müller
754b22d7ee libs: remove unused floatcast header-only library
There's no code whatsoever that uses these macros. If anyone
ever feels the need to resurrect them, we should add them to
gstutils.h in core or libgstaudio or so.
2011-09-23 21:18:47 +01:00
Wim Taymans
c0d31dd555 rename IS_LE/BE to _IS_LITTLE_ENDIAN/BIG_ENDIAN 2011-09-06 16:46:02 +02:00
Wim Taymans
0a1874461a audio: rename UNPOSITIONED to DEFAULT_POSITIONS
Rename the UNPOSITIONED flag to the DEFAULT_POSITIONS flag because that is
really what the resulting GstAudioInfo will contain as the chanel mappings.
2011-08-24 14:13:33 +02:00
Wim Taymans
0213407fbc audio: rename INT -> INTEGER
Spell INTEGER fully instead of using the int abreviation.
Remove some old functions.
2011-08-20 10:49:17 +02:00
Wim Taymans
8023f49d19 more audio caps porting 2011-08-19 17:41:22 +02:00
Wim Taymans
dae848818d audio: rework audio caps.
Rework the audio caps similar to the video caps. Remove
width/depth/endianness/signed fields and replace with a simple string
format and media type audio/x-raw.
Create a GstAudioInfo and some helper methods to parse caps.
Remove duplicate code from the ringbuffer and replace with audio info.
Use AudioInfo in the base audio filter class.
Port elements to new API.
2011-08-18 19:15:03 +02:00
Josep Torra
5629ed74b3 Fix debug statements
Fixes build on MacOSX

Signed-off-by: Edward Hervey <edward.hervey@collabora.co.uk>
2011-08-10 11:15:41 +02:00
Wim Taymans
43bee0022a audioconvert: update orc dist files 2011-07-07 10:28:08 +02:00
Wim Taymans
d051f3cb5b audioconvert: don't use .init function
Don't use the .init function but compile all functions when needed instead of
when the plugin is registered.
2011-07-07 10:24:55 +02:00
Sebastian Dröge
4fcd621101 audioconvert: Use new gst_caps_is_subset_structure() API
This prevents one copy of every structure and creating a new caps
instance.
2011-05-27 14:10:50 +02:00
Sebastian Dröge
d590bce5f7 audioconvert: Optimize transform_caps()
If the second and next caps structures are a subset of the already existing
transformed caps we can safely skip them because we would transform them to
the same caps again.

This makes gst_pad_get_caps() on an audiotestsrc ! audioconvert !
audioconvert ! audioconvert ! fakesink pipeline about 1.7 times faster.
2011-05-27 13:13:42 +02:00
Sebastian Dröge
d8e0af1fc1 gst: Update for the GstBaseTransform::transform_caps() changes 2011-05-27 12:13:14 +02:00
Sebastian Dröge
a9b134d1a9 Merge branch 'master' into 0.11
Conflicts:
	docs/plugins/gst-plugins-base-plugins.hierarchy
	docs/plugins/gst-plugins-base-plugins.interfaces
	docs/plugins/gst-plugins-base-plugins.prerequisites
2011-05-20 12:26:57 +02:00
Stefan Kost
f514be993c audioconvert: cleanup helper code
make_lossless_changes() returns the same structure that we're passing (probably
to enable chaining). Instead of reusing s and making it point to s2 as well,
keep using s2. Drop the assignment which in the 2nd case is a dead one anyway.
2011-05-19 23:41:08 +03:00
Sebastian Dröge
c020add91e audioconvert: Update for negotiation related API changes 2011-05-16 15:35:40 +02:00
Wim Taymans
ec57868488 -base: don't use buffer caps
Port to newest 0.11 core API, remove GST_PAD_CAPS and GST_BUFFER_CAPS.
2011-05-09 13:05:12 +02:00
Sebastian Dröge
f10a8f0986 gst: Use G_DEFINE_TYPE instead of GST_BOILERPLATE 2011-04-19 11:35:53 +02:00
Sebastian Dröge
0759ce8533 Merge branch 'master' into 0.11 2011-04-18 13:23:32 +02:00
Tim-Philipp Müller
82a791519c gst: update disted orc backup code 2011-04-16 15:59:45 +01:00
Wim Taymans
6e160bed3d Merge branch 'master' into 0.11
Conflicts:
	android/alsa.mk
	android/app.mk
	android/app_plugin.mk
	android/audio.mk
	android/audioconvert.mk
	android/decodebin.mk
	android/decodebin2.mk
	android/gdp.mk
	android/interfaces.mk
	android/netbuffer.mk
	android/pbutils.mk
	android/playbin.mk
	android/queue2.mk
	android/riff.mk
	android/rtp.mk
	android/rtsp.mk
	android/sdp.mk
	android/tag.mk
	android/tcp.mk
	android/typefindfunctions.mk
	android/video.mk
2011-04-11 11:37:51 +02:00
Alessandro Decina
030f639a8e android: make it ready for androgenizer
Remove the android/ top dir
Fixe the Makefile.am to be androgenized

To build gstreamer for android we are now using androgenizer which generates the
needed Android.mk files.
Androgenizer can be found here:
http://git.collabora.co.uk/?p=user/derek/androgenizer.git
2011-04-11 07:23:21 +02:00
Wim Taymans
3b03e23559 plugins: port some plugins to the new memory API 2011-03-27 16:35:28 +02:00
Sebastian Dröge
19b9460e60 audioconvert: Update generated orc files 2010-10-08 00:01:15 +02:00
Sebastian Dröge
f5e9d8bb62 audioconvert: Implement remaining conversion functions from/to doubles to orc
This requires orc 0.4.10
2010-10-08 00:01:14 +02:00
David Schleef
bec69e20ae orc: update generated files to fix MSVC compile issues 2010-09-16 18:03:23 -07:00
Sebastian Dröge
18b282e49f orc: Fix generated source files 2010-09-10 08:43:17 +02:00
Sebastian Dröge
3c43dbfc51 orc: Update generated source files everywhere 2010-09-09 10:59:59 +02:00
Sebastian Dröge
8ba4b70118 Revert "Revert "Use init functions for Orc code""
This reverts commit 93aa13639d.

Everything should work now after regenerating the disted source files.
2010-09-09 10:57:41 +02:00
Sebastian Dröge
65e5984634 audioconvert: Simplify float->s32 conversion
orc 0.4.7 is doing saturated conversion from floats to integers
and it's not necessary to do this manually anymore.
2010-09-05 12:57:36 +02:00
Sebastian Dröge
dd910ceaf4 audioconvert: Update disted orc files 2010-09-05 12:12:43 +02:00