Commit graph

113 commits

Author SHA1 Message Date
Mikhail Fludkov
7b390a8bbd vpxenc: Add new bit-per-pixel property to select a better "default" bitrate
As part of this also change the default bitrate value to 0. The default
value was 256000 previously. In reality, if the property was not set the
bitrate value would be scaled according to the resolution which is not
very intuitive behavior. It is better to use 0 for this purpose. Now
together with newly introduced property "bits-per-pixel" 0 means to
assign the bitrate according to resolution/framerate.

The default bitrates are now
 - 1.2Mbps for VP8 720p@30fps
 - 0.8Mbps for VP9 720p@30fps
and scaled accordingly for different resolutions/framerates.

Previously the default bitrate was also not scaled according to the
framerate but only took the resolution into account.

This also fixes the side effect of setting bitrate to 0. Previously
encoder would not produce any data at all.

Addition from Sebastian Dröge <sebastian@centricular.com> to assume
30fps if no framerate is given in the caps instead of not calculating
any bitrate at all.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/611>
2020-06-04 20:14:03 +00:00
Mathieu Duponchelle
37c619f995 plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-03 22:44:09 -04:00
Stian Selnes
44e4de43da vpxdec: Check that output width and height != 0
For VP8 it's possible to signal width or height to be 0, but it does
not make sense to do so. For VP9 it's impossible. Hence, we most
likely have a corrupt stream. Trying to negotiate caps downstream with
either width or height as 0 will fail with something like

gst_video_decoder_negotiate_default: assertion 'GST_VIDEO_INFO_WIDTH (&state->info) != 0' failed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/610>
2020-06-02 23:59:20 +03:00
Niels De Graef
34a934d8d4 vpx: Use G_DECLARE_FINAL_TYPE 2020-03-16 12:35:42 +01:00
Julien Isorce
88ce7397fc vp8enc/vp8enc: set 1 for the default value of VP8E_SET_STATIC_THRESHOLD
In Google webrtc, the setting VP8E_SET_STATIC_THRESHOLD is set to 1
(except when the content is known to be static very often in which
case it is set to 100, i.e. when sharing screen with Google Hangouts).

The cpu usage drops a lot when using 1 for above setting because it
allows the encoder to skip static/low content blocks. The current
0 default value uses too much cpu and confuses the user regarding
the cpu usage expectations. User expects vp8enc to use low cpu by
default.

Documentation of VP8E_SET_STATIC_THRESHOLD:
  https://github.com/webmproject/libvpx/blob/master/vpx/vp8cx.h#L188

chromium/webrtc:
  b484ec0082/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc (822)

Closes #58
2020-01-28 02:41:50 +00:00
Seungha Yang
4333774c2c vp9dec: Fix broken 4:4:4 8bits decoding
VPX_IMG_FMT_I444 pixel format with sRGB colorspace means
GBR data.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/651
2019-11-29 21:42:47 +00:00
Nirbheek Chauhan
212d0ca3cb vpx: Error out if enabled and no features found
Seee: https://gitlab.freedesktop.org/gstreamer/cerbero/issues/200
2019-11-05 21:42:12 +05:30
Tim-Philipp Müller
c9a47c0c8d Remove autotools build system 2019-10-14 11:04:18 +01:00
Matthew Waters
0017115494 vpx: fix macos werror build
../ext/vpx/gstvpxenc.c:1723:49: error: format specifies type 'long' but the argument has type 'vpx_codec_pts_t' (aka 'long long') [-Werror,-Wformat]
          ", gst frame pts: %" G_GINT64_FORMAT, pkt->data.frame.pts, pts);
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Frameworks/GStreamer.framework/Versions/1.0/include/gstreamer-1.0/gst/gstinfo.h:1065:96: note: expanded from macro 'GST_TRACE_OBJECT'
#define GST_TRACE_OBJECT(obj,...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   obj,  __VA_ARGS__)
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/Library/Frameworks/GStreamer.framework/Versions/1.0/include/gstreamer-1.0/gst/gstinfo.h:646:31: note: expanded from macro 'GST_CAT_LEVEL_LOG'
        (GObject *) (object), __VA_ARGS__);                             \
                              ^~~~~~~~~~~
../ext/vpx/gstvpxenc.c:1723:70: error: format specifies type 'long' but the argument has type 'vpx_codec_pts_t' (aka 'long long') [-Werror,-Wformat]
          ", gst frame pts: %" G_GINT64_FORMAT, pkt->data.frame.pts, pts);
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/Library/Frameworks/GStreamer.framework/Versions/1.0/include/gstreamer-1.0/gst/gstinfo.h:1065:96: note: expanded from macro 'GST_TRACE_OBJECT'
#define GST_TRACE_OBJECT(obj,...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   obj,  __VA_ARGS__)
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/Library/Frameworks/GStreamer.framework/Versions/1.0/include/gstreamer-1.0/gst/gstinfo.h:646:31: note: expanded from macro 'GST_CAT_LEVEL_LOG'
        (GObject *) (object), __VA_ARGS__);                             \
                              ^~~~~~~~~~~
2019-08-30 14:12:29 +10:00
Mathieu Duponchelle
3429ddde38 docstrings: port ulinks to markdown links 2019-08-23 18:56:01 +02:00
Tim-Philipp Müller
61bd613de3 vpx: bump libvpx requirement to 1.5.0
Was released in Nov 2015.
2019-08-19 11:09:47 +01:00
Tim-Philipp Müller
e40ba71824 vpx: avoid confusing meson configure output when checking for vpx versions
Used to print:
|Run-time dependency vpx found: YES 1.7.0
|Message: libvpx provides VP8 encoder interface (vpx_codec_vp8_cx_algo)
|Message: libvpx provides VP8 decoder interface (vpx_codec_vp8_dx_algo)
|Message: libvpx provides VP9 encoder interface (vpx_codec_vp9_cx_algo)
|Message: libvpx provides VP9 decoder interface (vpx_codec_vp9_dx_algo)
|Dependency vpx found: YES (cached)
|Dependency vpx found: NO found '1.7.0' but need: '>=1.8.0'
|Run-time dependency vpx found: NO (tried pkgconfig and cmake)

We can check the version of the found dep in a way that
doesn't produce this confusing output.
2019-08-19 11:09:19 +01:00
Mathieu Duponchelle
d704790519 doc: fix element section documentations
Element sections were not rendered anymore after the hotdoc
port, fixing this revealed a few incorrect links.
2019-05-25 16:57:31 +02:00
Thibault Saunier
af01988534 doc: Port documentation to hotdoc 2019-05-13 11:34:56 -04:00
Thibault Saunier
0a6a62aa76 docs: Port all docstring to gtk-doc markdown 2019-05-13 10:24:40 -04:00
Jan Alexander Steffens (heftig)
b6e6f1ae73 vpx: Fix build against libvpx 1.8
The deprecated debug visualizer was removed.
2019-02-07 11:17:39 +00:00
Nirbheek Chauhan
8f807477eb meson: Add feature options for all plugins
Checks for GL, Qt5, and C++ are still automagic. FIXMEs have been
added for these so they can be fixed later.

https://bugzilla.gnome.org/show_bug.cgi?id=795107
2018-07-27 18:42:54 +05:30
Xavier Claessens
edd9c8f6b8 Meson: Generate pc file for all plugins in good
https://bugzilla.gnome.org/show_bug.cgi?id=794568
2018-04-25 11:07:06 +01:00
Oleksij Rempel
1bb4b83e9a vpx: add VP8_DEBUG_TXT_* flags for postprocessing
https://bugzilla.gnome.org/show_bug.cgi?id=641399
2018-01-25 19:42:07 +00:00
George Kiagiadakis
36fc2a747a vpxenc: discard frames that have been dropped by libvpx
This fixes a memory leak. When dropframe-threshold has been set,
libvpx may output less frames than the input ones, which causes
some GstVideoCodecFrames to queue up in GstVideoEncoder's internal
frame queue with no chance of ever being all released. And because
the frames keep references to the input buffers, the input buffer
pool keeps allocating new buffers and memory usage grows very fast.
For example the following pipeline's memory usage grows at a rate
of about 1GB per minute!

videotestsrc ! capsfilter caps=video/x-raw,width=1920,height=1080,framerate=30/1,format=I420 ! \
  vp8enc target-bitrate=1000000 end-usage=cbr dropframe-threshold=95 ! fakesink

https://bugzilla.gnome.org/show_bug.cgi?id=783086
2017-08-11 14:32:37 +03:00
Nicolas Dufresne
b68d936ae0 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:41:19 -04:00
Sebastian Dröge
e4cbefcb6c vpxdec: Set fb->priv to NULL after freeing just in case
https://bugzilla.gnome.org/show_bug.cgi?id=782359
2017-05-09 11:41:25 +02:00
Tim-Philipp Müller
55c7e77d2c vpx: fix build against older libvpx versions
Such as 1.3.0 as on raspbian.
2017-05-08 16:07:32 +01:00
Jan Schmidt
cd309f31a0 vp9dec: Add warnings for unsupported frame formats
At least output an element warning on the bus when we
encounter a frame format GStreamer doesn't currently support.
2017-04-05 16:09:53 +10:00
Thibault Saunier
9d1942f286 meson: Install presets files 2017-01-05 09:49:21 -03:00
Sebastian Dröge
ae2dd54a24 vpxdec: libvpx's release buffer is sometimes called with fb->priv==NULL
Don't assert on this but just ignore these cases.
2016-11-22 20:33:29 +02:00
Tim-Philipp Müller
787f47604d meson: add unit tests
Only works properly in an installed setup currently, most
likely won't work with a subprojects setup yet.
2016-09-26 14:31:09 +01:00
Tim-Philipp Müller
2179b9b9d6 meson: fix build with vpx 1.3.x
vpx >= 1.4.0 is optional
2016-09-18 20:55:31 +01:00
Stian Selnes
195d181828 vp9enc: Fix leak of vpx_image_t 2016-08-26 11:57:15 -04:00
Nirbheek Chauhan
b09f478e80 Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
2016-08-20 11:21:12 +01:00
Mario Sanchez Prada
8740313504 vpxenc: Properly handle frames with too low duration
When a frame's duration is too low, calling gst_util_uint64_scale()
to scale its value can result into it being truncated to zero, which
will cause the vpx encoder to return an VPX_CODEC_INVALID_PARAM error
when trying to encode.

To prevent this from happening, we simply ignore the duration when
encoding if it becomes zero after scaling, logging a warning message.

https://bugzilla.gnome.org/show_bug.cgi?id=765391
2016-04-23 13:56:56 +01:00
Nicolas Dufresne
284d723a9a vpxdec: Use threads on multi-core systems
This is a redo of commit b848c1b6ff. The
code was lost when the elements where ported to use a baseclass.

https://bugzilla.gnome.org/show_bug.cgi?id=764169
2016-03-24 19:30:44 -04:00
Vineeth TM
1071309870 good: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763076
2016-03-24 14:32:20 +02:00
Sebastian Dröge
70db210315 vp8enc: Ensure that we always have valid frame user data before using it
Otherwise we're going to dereference NULL pointers.
2016-01-20 13:41:33 +02:00
Sebastian Dröge
7eee775d5f vpxdec: Unref frame in all code paths of handle_frame()
https://bugzilla.gnome.org/show_bug.cgi?id=760666
2016-01-20 10:02:48 +02:00
Thibault Saunier
01f995b8dd vpxenc: Unref frame on ERROR
All code paths for handle_frame() must somehow take ownership of the frame, be
it by actually unreffing, forwarding the frame elsewhere or storing it for
later.

http://bugzilla.gnome.org/show_bug.cgi?id=760666
2016-01-20 10:02:44 +02:00
Thibault Saunier
17838829eb vp8enc: Return FLOW_ERROR when an error accures
FALSE would mean FLOW_OK

https://bugzilla.gnome.org/show_bug.cgi?id=760666
2016-01-16 08:58:48 +01:00
Sebastian Dröge
bed1f0a0a6 vpxdec: Initialize buffer variable to NULL
False positive but trivial to fix and possibly causing compiler warnings at
some point in the future too.

CID 1346535
2015-12-29 17:58:38 +02:00
Nicolas Dufresne
9808cff566 vpx: Add missing headers in Makefile.am
This fixes distcheck.

https://bugzilla.gnome.org/show_bug.cgi?id=755510
2015-12-15 14:27:22 -05:00
Prashant Gotarne
5c7eb0f886 vpx: created common baseclass GstVPXEnc
GstVP8Enc and GstVP9Enc has almost 80% code in common.
created common baseclass GstVPXEnc for GstVP8Enc and GstVP9Enc

https://bugzilla.gnome.org/show_bug.cgi?id=755510
2015-12-15 14:03:29 -05:00
Nicolas Dufresne
90dcc3921a vpxdec: Remove unneeded add video_meta
This also remove copies for VP8, which was not correctly in place
in previous related patch.
2015-12-15 12:57:53 -05:00
Prashant Gotarne
75fb614c1e vpx: created common base class GstVPXdec for vpx decoders
Base class for the vp8dec and vp9dec.

https://bugzilla.gnome.org/show_bug.cgi?id=755510
2015-12-15 12:06:45 -05:00
Nicolas Dufresne
189c291805 vpxdec: Use GstMemory to avoid copies
With the VPX decoders it's not simple to use downstream buffer pool,
because we don't know the image size and alignment when buffers get
allocated. We can though use GstAllocator (for downstream, or the system
allocator) to avoid a copy before pushing if downstream supports
GstVideoMeta. This would still cause a copy for sink that requires
specialized memory and does not have a GstAllocator for that, though
it will greatly improve performance for sink like glimagesink and
cluttersink. To avoid allocating for every buffer, we also use a
internal buffer pool.

https://bugzilla.gnome.org/show_bug.cgi?id=745372
2015-12-04 17:29:15 -05:00
Nicolas Dufresne
b848c1b6ff vpxdec: Use threads on multi-core systems
This adds an automatic mode to the threads property of vpxdec in order to
use as many threads as there is CPU on the platform. This brings back
GStreamer VPX decoding performance closer to what is achieved by other
players, including Chromium.

https://bugzilla.gnome.org/show_bug.cgi?id=758195
2015-11-17 12:27:31 -05:00
Reynaldo H. Verdejo Pinochet
2b7a1b4bb9 vp9enc: remove unnecessary NULL check before g_free() 2015-11-15 01:43:08 -08:00
Reynaldo H. Verdejo Pinochet
97a94b02ae vp8enc: remove unnecessary NULL check before g_free() 2015-11-15 01:43:08 -08:00
Thiago Santos
1b27badcfd videoencoders: use template subset check for accept-caps
It is faster than doing a query that propagates downstream and
should be enough

Elements: jpegenc, pngenc, vp8enc, vp9enc, y4menc
2015-08-16 14:30:57 -03:00
Thiago Santos
16fbd4f86f videodecoders: use default pad accept-caps handling
Avoids useless check of downstream caps when handling an
accept-caps query

Elements: jpegdec, pngdec, vp8dec, vp9dec
2015-08-15 11:46:32 -03:00
Tim-Philipp Müller
98527a6ea2 vp8enc, vp9enc: reset multipass file index when stopping encoder
Fixes multipass encoding when re-using the same element/pipeline
for subsequent encoding runs.

https://bugzilla.gnome.org/show_bug.cgi?id=747728
2015-08-15 11:21:02 +01:00
Tim-Philipp Müller
0e10e92953 vp9enc: provide support for multiple pass cache files
Some files may provide different caps insight of one stream. Since
vp9enc support caps reinit, we should support cache reinit too.
If more then file cache file will be created, the naming will be:
cache cache.1 cache.2 ...

Based on patch by: Oleksij Rempel <linux@rempel-privat.de>

https://bugzilla.gnome.org/show_bug.cgi?id=747728
2015-08-15 11:09:42 +01:00