GNOME Bugzilla – Bug 767350
jpegdec: Internal parser map/unmap the same buffer multiple time
Last modified: 2018-11-03 15:09:39 UTC
The parse in jpegdec rely on gst_adapter_masked_scan_uint32() to find few 2 bytes sequences in the stream. The problem is that the adapter variant of this function will, for every call, map/unmap the GstBuffer. If you combined with a non-sysmem memory (like dmabuf) this will cause a huge performance hit. With 720p@30 video, I get a full i7 core being used with (if I force parsing obviously): v4l2src ! jpegdec ! fakesink I didn't look how to fix it really, one could map the buffer in the adapter before using that function. This would bring the performance to what the byte_scanner version would give. Though, there is probably something even smarter we could do.
Looking at pngdec, what they do there is map from the adapter (which merges) the accumulated size and use a ByteReader to actually parse. This makes sense, since fist thing we do with the buffer in handle_frame() is to map it entirely, which will result in a merge anyway. Though, one could argue that we could implement a per Memory streaming to jpeg library instead, and that would be slightly faster,
-- 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-good/issues/277.