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 760024 - jpegdec: Extra buffers and memcpy() overhead
jpegdec: Extra buffers and memcpy() overhead
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-12-31 09:36 UTC by Sachin Kumar Chauhan
Modified: 2018-11-03 15:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Optimize buffers and remove extra memcpy() (2.08 KB, patch)
2015-12-31 09:40 UTC, Sachin Kumar Chauhan
reviewed Details | Review

Description Sachin Kumar Chauhan 2015-12-31 09:36:18 UTC
Some extra buffers are there in jpegdec which can be optimized and avoided
Comment 1 Sachin Kumar Chauhan 2015-12-31 09:40:32 UTC
Created attachment 318062 [details] [review]
Optimize buffers and remove extra memcpy()

For jpeg files with uneven dimensions or grayscale, a different functions are used which is using the memcpy() and extra buffers.
Comment 2 Nicolas Dufresne (ndufresne) 2015-12-31 19:05:09 UTC
Review of attachment 318062 [details] [review]:

A comment that show you have researched why it was done like this before and what you are doing to avoid the issue that the copies where fixing seems rather important. You seem to simply use pointers directly and no code is adding any memory management. This is in general suspicious, I didn't look in details, but please, demonstrate that you have done some research about why it was like this, and demonstrate that you keep proper memory management without those copies.
Comment 3 Sachin Kumar Chauhan 2016-01-04 04:05:18 UTC
The jpeg_read_raw_data() function needs an array 3 pointers, each further constituting an array of 16 gpointer's which further point to actual data. By convention, a local copy of buffers was made to pass to jpeg_read_raw_data(). 

But while optimizing the jpegdec for even dimensional pictures, these memcpy() kind of overheads were removed from gst_jpeg_dec_decode_direct(). As gst_jpeg_dec_decode_indirect() was meant to be used for odd dimensional pictures, it may have been overlooked for optimization at that moment.

As for the point of usage, these array of gpointer's are used only to read actual data and hence a local copy is not necessary. Also, there is no parallel decoding going on, so underlying pointers are not meant to change, so local copy is unnecessary.
Comment 4 Sebastian Dröge (slomo) 2016-02-17 12:23:08 UTC
Nicolas, does this look good for you now?
Comment 5 Nicolas Dufresne (ndufresne) 2016-02-22 19:16:54 UTC
I would prefer give this patch some stress test with queues and specialized buffers pools before landing. I do hope this patch is fine, but there is no test to prove it. The commit comment can still be improved.
Comment 6 GStreamer system administrator 2018-11-03 15:07:01 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-good/issues/249.