Commit graph

15331 commits

Author SHA1 Message Date
Wim Taymans
c36ac3ce45 audioconvert: move audio quantize code to libs
Move the audio quantize code from audioconvert to the audio library.
work on making an audio converter helper function similar to the video
converter.
Fold fastrandom directly into the quantizer, add some ORC code to
optimize this later.
2015-11-06 12:10:48 +01:00
Wim Taymans
a7789854d5 audio-channels: rename get_default_mask
Rename _get_default_mask() to _get_fallback_mask() to make it more
clear that the function only provides a fallback if nothing else can be
done. Also clarify this in the documentation.

API: gst_audio_channel_get_fallback_mask()
2015-11-05 12:50:18 +01:00
Sebastian Dröge
dd741e6412 opusdec: Update sink pad templates
We always require the channel-mapping-field. If it's 0 we require nothing
else, otherwise we need channels, stream-count and coupled count to be
available.
2015-11-05 12:11:19 +01:00
Thibault Saunier
9c7d3c8ab2 volume: Do not try to get binding value array if we are not processing any sample
In some conditions we might process empty buffers, calling
gst_control_binding_get_value_array in that case will lead
to the assertion:

  (lt-ges-launch-1.0:18859): GStreamer-CRITICAL **: gst_control_binding_get_value_array: assertion 'values' failed
2015-11-05 11:44:31 +01:00
Wim Taymans
f86ed8cdf6 audio-channels: make method to get default channel-mask
Add a new method to get the default channel-mask.
Use the new method on audiodecoder and audioconvert.

API: gst_audio_channel_get_default_mask()
2015-11-05 10:52:53 +01:00
Andreas Frisch
4a85438e5b tests: Add a test for video blending over transparent frames
And fix the test_overlay_blend test where we blend over a
transparent frame and where expecting wrong results

https://bugzilla.gnome.org/show_bug.cgi?id=681447
2015-11-04 22:17:35 +01:00
Arnaud Vrac
dfe250d17d video: blend using OVER operation
Also support all premultiplied/non-premultiplied source/destination
configurations

https://bugzilla.gnome.org/show_bug.cgi?id=681447
2015-11-04 21:58:32 +01:00
Sebastian Dröge
387839c57e opus: Remove invalid unit test
Opus headers should never be in-band, so don't test for correct
handling of that.
2015-11-04 00:14:13 +02:00
Sebastian Dröge
85984fa946 opusenc: Create an empty taglist if there is none
There always have to be 2 buffers in the streamheaders, even if
the comment buffer is basically empty.
2015-11-04 00:14:13 +02:00
Sebastian Dröge
4ca84a9b1a opus: Add proper support for multichannel audio
https://bugzilla.gnome.org/show_bug.cgi?id=757152
2015-11-03 20:35:41 +02:00
Sebastian Dröge
fc475ce01a opusdec: Handle GstAudioClippingMeta instead of the pre-skip field in the OpusHead
oggdemux is outputting the meta now, and only outputs if it should really
apply to the current buffer. Previously we would skip N samples also if we
started the decoder in the middle of the stream.

https://bugzilla.gnome.org/show_bug.cgi?id=757153
2015-11-03 20:35:41 +02:00
Sebastian Dröge
328f9088f3 opusenc: Add GstAudioClippingMeta to buffers that need to be clipped
https://bugzilla.gnome.org/show_bug.cgi?id=757153
2015-11-03 20:35:41 +02:00
Sebastian Dröge
6b751360ae opusenc: Disable granule position calculations by the base class
It is doing the wrong thing because of the Opus pre-skip: while the timestamps
are shifted by the pre-skip, the granule positions are not shifted.

oggmux is doing the right thing here already.

https://bugzilla.gnome.org/show_bug.cgi?id=757153
2015-11-03 20:35:41 +02:00
Sebastian Dröge
7773e1eb58 opusenc: Add some FIXME comments about calculating padding with LPC
https://bugzilla.gnome.org/show_bug.cgi?id=757153
2015-11-03 20:35:41 +02:00
Sebastian Dröge
4df2ffaad6 opusenc: Encode exactly the amount of samples we got as input and put correct timestamps on it
The first frame has lookahead less samples, the last frame might have some
padding or we might have to encode another frame of silence to get all our
input into the encoded data.

This is because of a) the lookahead at the beginning of the encoding, which
shifts all data by that amount of samples and b) the padding needed to fill
the very last frame completely.

Ideally we would use LPC to calculate something better than silence for the
padding to make the encoding as smooth as possible.

With this we get exactly the same amount of samples again in an
opusenc ! opusdec pipeline.

https://bugzilla.gnome.org/show_bug.cgi?id=757153
2015-11-03 20:35:41 +02:00
Sebastian Dröge
6ffb90e037 opusenc: Put lookahead/pre-skip into the OpusHead header
https://bugzilla.gnome.org/show_bug.cgi?id=757153
2015-11-03 20:35:41 +02:00
Sebastian Dröge
cab8671f0c oggdemux: Create full Opus caps with all fields
https://bugzilla.gnome.org/show_bug.cgi?id=757152
2015-11-03 20:35:33 +02:00
Sebastian Dröge
bcd7b2fff2 codec-utils: Add utilities for Opus caps and the OpusHead header
https://bugzilla.gnome.org/show_bug.cgi?id=757152
2015-11-03 20:35:33 +02:00
Sebastian Dröge
0fa8d284c7 oggmux: Use GstAudioClippingMeta for Opus for accurate end clipping
... instead of relying on the segment. For the clipping at the start we assume
a proper value in the OpusHead, as generated by opusparse or opusenc.

Transmuxing in general is not guaranteed to produce the correct values, or
even have a OpusHead (e.g. when having RTP input).

https://bugzilla.gnome.org/show_bug.cgi?id=757153
2015-11-03 20:35:33 +02:00
Sebastian Dröge
a135868262 oggdemux: Add GstAudioClippingMeta for Opus for accurate start/end clipping
https://bugzilla.gnome.org/show_bug.cgi?id=757153
2015-11-03 20:35:33 +02:00
Sebastian Dröge
35ea6fdddf audio: Add GstAudioClippingMeta for specifying clipping on encoded audio buffers
https://bugzilla.gnome.org/show_bug.cgi?id=757153
2015-11-03 20:35:33 +02:00
Sebastian Dröge
8a3be7323a oggdemux: Allow start clipping for Opus
The granulepos does not have the pre-skip subtracted while timestamps do,
and the last granulepos will be shorter by the number of samples that should
be dropped because of padding in the end.

As such, extrapolating the granule of the beginning of the first frame will
lead to a negative value, which is not a problem but intentional.

https://bugzilla.gnome.org/show_bug.cgi?id=757153
2015-11-03 20:35:33 +02:00
Tim-Philipp Müller
1f2fdd3789 audio: update disted orc backup files 2015-11-03 16:38:09 +00:00
Luis de Bethencourt
94a7f9fc4e audioclock: use GST_STIME_FORMAT for GstClockTimeDiff
GST_STIME_FORMAT is more appropriate for GstClockTimeDiff since it can
handle negative values better.

https://bugzilla.gnome.org/show_bug.cgi?id=757480
2015-11-03 14:08:29 +00:00
Luis de Bethencourt
227f1d1e0f videodecoder: Print GstClockTimeDiff as a signed integer in debug logs 2015-11-03 13:44:39 +00:00
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
914aa4aed1 audiopack: improve pack functions
Avoid shifts by using convh functions.
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
Luis de Bethencourt
fe62e797d5 audiobasesink: use GST_STIME_ARGS for GstClockTimeDiff
No need to use G_GINT64_FORMAT for potentially negative values of
GstClockTimeDiff. Since 1.6 these can be handled with GST_STIME_ARGS.
Plus it creates more readable values in the logs.

https://bugzilla.gnome.org/show_bug.cgi?id=757480
2015-11-02 17:35:20 +00:00
Luis de Bethencourt
2206ba473f oggmux: Print GstClockTimeDiff as a signed integer in debug logs 2015-11-02 16:36:35 +00:00
Luis de Bethencourt
799020804f oggdemux: Use GstClockTimeDiff and print signed integer in debug logs
Use GstClockTimeDiff and Clock macros to print signed integer time
differences in the debug logs.

https://bugzilla.gnome.org/show_bug.cgi?id=757480
2015-11-02 16:10:07 +00:00
Luis de Bethencourt
fcfb9a7794 examples: use GST_STIME_FORMAT for GstClockTimeDiff
GST_STIME_FORMAT is more appropriate for GstClockTimeDiff since it can
handle negative values better.

https://bugzilla.gnome.org/show_bug.cgi?id=757480
2015-11-02 15:50:50 +00:00
Sebastian Dröge
443171bb4c audio: Fix parameters to gst_buffer_get_audio_downmix_meta() in macro 2015-11-02 17:35:45 +02:00
Wim Taymans
bd89f2430b audiotestsrc: increase freq limit
Raise the frequency limit and try to negotiate to a samplerate of 4*freq
when larger then the default samplerate.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=754450
2015-11-02 15:54:19 +01:00
Wim Taymans
c688eb0d88 audiotestsrc: add support for unlimited number of channels
Raise the channel limit and set the channel-mask for > 2 channels.
2015-11-02 15:46:22 +01:00
Wim Taymans
b0bf294a62 audiotestsrc: add support for all formats
Use the pack functions to also support the other audio formats we
have.
2015-11-02 13:22:18 +01:00
Luis de Bethencourt
b81b3f07ec videodecoder: subtract time difference with GST_CLOCK_DIFF
To ensure the subtraction of two GstClockTime values (which are guint64)
can be negative. Use GST_CLOCK_DIFF which returns a gint64.

CID 1338049
2015-11-02 12:09:45 +00:00
Thibault Saunier
a7123ebb58 encoding-profile: Do not force user to provide an encoding profile name
And use the profile called `default` if none provided.
2015-11-02 11:35:55 +01:00
Thibault Saunier
83fa06aab5 encoding-target: Do not unconditionally break when searching for a target
Otherwise the loop is useless!

Fixes CID 1338051
2015-11-02 11:31:34 +01:00
Sebastian Dröge
e51c9a3dad audioresample: 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
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
Sebastian Dröge
736a27fe1e audiofilter: 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
Sebastian Dröge
9c195e37da opusdec: Assume 48kHz if no sample rate is given in the header 2015-11-02 09:36:46 +02:00
Sebastian Dröge
7cadfcb0b0 opusenc: Place 48kHz first in the caps
For all the other sample rates the encoder will have to resample internally.
2015-11-02 09:36:43 +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
Csaba Toth
3159501002 multisocketsink: fix "client-removed" signal on 64-bit platforms and with bindings
The client-removed signal used G_INT_TYPE instead of G_SOCKET_TYPE
in its definition leading to problems on platforms where the size
of a pointer is larger than the size of an integer, It would also
not work at all with dynamic language bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=757155
2015-10-31 11:12:38 +00:00
Joan Pau Beltran
a95a900c21 videotestsrc: fix handling of Bayer format 'gbrg'
Due to a typo, videotestsrc did not handle the Bayer
format 'gbrg' properly and reported it as invalid,
causing negotiation errors.

https://bugzilla.gnome.org/show_bug.cgi?id=757264
2015-10-30 20:29:04 +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