Commit graph

128 commits

Author SHA1 Message Date
Thibault Saunier
e0b708ea4a vpx: Fix the check to unfixed/unknown framerate to set bitrate
0/1 means unknown framerate not X/0 (which is illegal).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/782>
2020-10-22 15:53:24 -03:00
John-Mark Bell
ba4b9971e9 vp8enc: expect bps for temporal-scalability-target-bitrate.
Consistency with target-bitrate is less surprising and with
modern libvpx additional configuration is required to make
temporal scaling work.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/728>
2020-10-16 09:25:10 +00:00
John-Mark Bell
d9cedee042 vp8enc: finish support for temporally scaled encoding
- introduce two new properties:

    * temporal-scalability-layer-flags:

      Provide fine-grained control of layer encoding to the
      outside world. The flags sequence should be a multiple of
      the periodicity and is indexed by a running count of encoded
      frames modulo the sequence length.

    * temporal-scalability-layer-sync-flags:

      Specify the pattern of inter-layer synchronisation (i.e.
      which of the frames generated by the layer encoding
      specification represent an inter-layer synchronisation).
      There must be one entry per entry in
      temporal-scalability-layer-flags.

  - apply temporal scalability settings and expose as buffer
    metadata.

    This allows the codec to allocate a given frame to the correct
    internal bitrate allocator. Additionally, all the
    non-bitstream metadata needed to payload a temporally scaled
    stream is now attached to each output buffer as a
    GstVideoVP8Meta.

  - add unit test for temporally scaled encoding.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/728>
2020-10-16 09:25:10 +00:00
Haakon Sporsheim
23bb84c868 vpxdec: request a sync point on decoder errors
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/725>
2020-09-14 13:19:10 +00:00
Mathieu Duponchelle
39fcc7f58f vp9enc: expose row-mt property
With recent libvpx versions, multithreading can be enabled on
a per-tile basis, instead of on a per tile-column basis.

In combination with the new tile-rows property, this allows the
encoder to make much better use of the available CPU power.

Bump minimum libvpx version to 1.7.0

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/707>
2020-09-09 18:05:31 +00:00
Mathieu Duponchelle
fe6b59d0cc vpxenc: change default for deadline to good quality
Having the deadline set to best quality causes the encoder
to be absurdly slow, most real-life users will want the good
quality tradeoff instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/707>
2020-09-09 18:05:31 +00:00
Mathieu Duponchelle
13cf3fe2a6 vp9enc: expose tile-columns and tile-rows properties
Based on patch by Stian Selnes <stian@pexip.com>.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/707>
2020-09-09 18:05:31 +00:00
Mathieu Duponchelle
e61932c358 vpxenc: add configure_encoder virtual method
For subclasses to expose format-specific properties

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/707>
2020-09-09 18:05:31 +00:00
Jakub Adam
cce71d5cd5 vpx: Support GST_VIDEO_FORMAT_I422_10LE
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/705>
2020-09-08 21:09:09 +00:00
Jakub Adam
87d0464259 vpx: Support GST_VIDEO_FORMAT_I420_10LE
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/705>
2020-09-08 21:09:09 +00:00
Jakub Adam
5ed50669cf vp9enc: support GST_VIDEO_FORMAT_Y444
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/705>
2020-09-08 21:09:09 +00:00
Mathieu Duponchelle
1863259ab8 vpxenc: mark all properties as GST_DOC_SHOW_DEFAULT
When generating the cache we inspect the base class through
an instance of one of its subclasses. We don't want potential
assignments in subclasses initialization to leak into the
base class documentation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/641>
2020-06-24 16:45:27 +02:00
Thibault Saunier
95efaf9d56 vpx: Fix links to baseclass properties 2020-06-23 12:47:44 -04:00
Mathieu Duponchelle
c897fe2b73 docs: mark more types as plugin API 2020-06-23 10:25:55 -04:00
Mathieu Duponchelle
f63299ff2f plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:42:25 +02:00
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