After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 781039 - Implement rawvideosrc in debug utils to test raw encoder/decoder performance
Implement rawvideosrc in debug utils to test raw encoder/decoder performance
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
unspecified
Other Linux
: Low enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-04-07 17:44 UTC by sreerenj
Modified: 2018-11-03 14:06 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description sreerenj 2017-04-07 17:44:52 UTC
Just noticed the encoder pipeline is doing extra memcopy.

sample pipeline:
gst-launch-1.0 filesrc location=sample.yuv ! videoparse format=nv12 width=1280 height=720 framerate=30 ! vaapih264enc ! filesink location=sample.264

vaapiencode (precisely gst_vaapi_plugin_base_get_input_buffer() ) is not receiving buffers from the pre-allocated pool, so it end up with an extra copy and attach vaapivideometa.

It would be good to investigate it since it may significantly affect the performance.
Comment 1 Nicolas Dufresne (ndufresne) 2017-04-07 18:06:44 UTC
This isn't usually the kind of pipeline someone cares to optimize. If you feel like this is needed critically for you let us know, otherwise, don't expect anyone to look at it.

Here's the break down, and it's not vaapi related.

- filesrc copy from file to GstBuffer/Memory in 1024byte chunk
- videoparse copy the chunks into single frame, with "default" alignement"
- vaapiencoder copy the unlaligned normal memory to aligned "special" memory

An important aspect here, videoparse is now deperated, look at rawvideoparse instead. rawvideoparse could spare a copy by using vaapi buffer pool when copying the chunks (that might already be done in rawvideoparse).

Going further is more complex, would require having videoparse is some half passthrough mode. This is far from trivial, but you could get the allocation query to reach filesrc, teach filesrc to use the allocation query, set the chunk size base on the downstream reported size, and read directly in vaapidecode provided memory.

Now, do you still care optimizing this ?
Comment 2 sreerenj 2017-04-07 18:21:17 UTC
(In reply to Nicolas Dufresne (stormer) from comment #1)
> This isn't usually the kind of pipeline someone cares to optimize. If you
> feel like this is needed critically for you let us know, otherwise, don't
> expect anyone to look at it.
> 
> Here's the break down, and it's not vaapi related.
> 
> - filesrc copy from file to GstBuffer/Memory in 1024byte chunk
> - videoparse copy the chunks into single frame, with "default" alignement"
> - vaapiencoder copy the unlaligned normal memory to aligned "special" memory
> 
> An important aspect here, videoparse is now deperated, look at rawvideoparse
> instead. rawvideoparse could spare a copy by using vaapi buffer pool when
> copying the chunks (that might already be done in rawvideoparse).
> 
> Going further is more complex, would require having videoparse is some half
> passthrough mode. This is far from trivial, but you could get the allocation
> query to reach filesrc, teach filesrc to use the allocation query, set the
> chunk size base on the downstream reported size, and read directly in
> vaapidecode provided memory.
> 
> Now, do you still care optimizing this ?

Thanks for the details :), IIUC , irrespective of videoparse/rawvideoparse, filesrc  is going to do one copy. Would be a good feature if we can avoid it, right?
Comment 3 sreerenj 2017-04-11 17:50:14 UTC
Since it is not a practical use case, I lowered the priority.

But I think it is good to have a "videofilesrc" (do we have something like that already?) for zero copy testing purpose , may in in gst-plugins-bad.
Comment 4 Nicolas Dufresne (ndufresne) 2017-04-11 19:01:21 UTC
(In reply to sreerenj from comment #3)
> But I think it is good to have a "videofilesrc" (do we have something like
> that already?) for zero copy testing purpose , may in in gst-plugins-bad.

I don't think so. fakevideosink would similarly be useful (a sink that advertsize support for GstVideoMeta and any caps feature, avoiding upstream copies)
Comment 5 Nicolas Dufresne (ndufresne) 2017-04-11 19:03:14 UTC
I think lower copy for you use case would be obtained adding rawvideosrc element (a rawvideoparse but exposed as a src).
Comment 6 sreerenj 2017-04-11 21:41:58 UTC
(In reply to Nicolas Dufresne (stormer) from comment #5)
> I think lower copy for you use case would be obtained adding rawvideosrc
> element (a rawvideoparse but exposed as a src)

I hope you agree with adding a rawvideosrc and rawvideosink to gst-plugins-bad/gst/debugutils. If so I can change the bug description and assign to gst-plugins-bad.
Comment 7 Nicolas Dufresne (ndufresne) 2017-05-16 18:58:25 UTC
(In reply to sreerenj from comment #6)
> I hope you agree with adding a rawvideosrc and rawvideosink to
> gst-plugins-bad/gst/debugutils. If so I can change the bug description and
> assign to gst-plugins-bad.

Feel free do to so.
Comment 8 sreerenj 2017-06-12 21:01:18 UTC
Quick implementation (copy&paste of filesrc mostly) of rawvideosrc written for a customer in order to do the benchmarking.
https://github.com/sreerenjb/gst-rawvideosrc

Need more fixes in order to make it upstreamable, eg: properties need to be added similar to rawvideoparse(format, width, height, strides, use-sink-caps etc..).
Comment 9 Víctor Manuel Jáquez Leal 2017-06-13 14:31:36 UTC
moving to gst-plugins-bad because these elements shall be added there.
Comment 10 GStreamer system administrator 2018-11-03 14:06:50 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/541.