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 764201 - video: Provide fast path for I420 to BGRA (and/or RGBA) conversion and back
video: Provide fast path for I420 to BGRA (and/or RGBA) conversion and back
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
1.8.0
Other Linux
: Normal enhancement
: 1.9.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-03-25 15:49 UTC by Alex
Modified: 2016-04-23 15:39 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Alex 2016-03-25 15:49:34 UTC
Need a way to have a faster conversion from I420 to BGRA/RGBA and back -- ideally, to match the performance of ffmpeg's swscale.

Opening per conversation in https://lists.freedesktop.org/archives/gstreamer-devel/2016-March/057430.html

It seems like there's a related issue opened already (734003), but opening this request anyway, since it's potentially a superset (or there could be a non-Orc based solution).
Comment 1 Wim Taymans 2016-03-25 17:56:55 UTC
What CPU are we talking about? there is a fast I420 -> BGRA on little-endian
Comment 2 Alex 2016-04-08 15:36:32 UTC
Running on x86_64 (virtualized). I've had a chance to narrow it down a bit. Seems like I420->BGRA is indeed quite fast. The same can't be said, however, for BGRA->I420 (with hotspots in video_converter_matrix8_table/video_chroma_down_h2_cs_u8), or I420->BGR (with hotspots in pack_BGR/video_chroma_up_h2_cs_u8).
Comment 3 Wim Taymans 2016-04-21 14:41:07 UTC
With I420 formats, quite a bit of time is spent in the restoration of the chroma samples. You can disable that with:

chroma-mode=none on videoconvert. To compare:

gst-launch-1.0 videotestsrc ! imagefreeze ! video/x-raw,format=I420 ! videoconvert ! video/x-raw,format=BGR ! fakesink num-buffers=10000 
Execution ended after 0:00:02.915934335

gst-launch-1.0 videotestsrc ! imagefreeze ! video/x-raw,format=I420 ! videoconvert chroma-mode=3 ! video/x-raw,format=BGR ! fakesink num-buffers=10000 
Execution ended after 0:00:01.964299628

And:

gst-launch-1.0 videotestsrc ! imagefreeze ! video/x-raw,format=BGRA ! videoconvert chroma-mode=0 ! video/x-raw,format=I420 ! fakesink num-buffers=10000 
Execution ended after 0:00:02.046383592

gst-launch-1.0 videotestsrc ! imagefreeze ! video/x-raw,format=BGRA ! videoconvert chroma-mode=3 ! video/x-raw,format=I420 ! fakesink num-buffers=10000 
Execution ended after 0:00:01.723934187

for comparison this is quite a bit faster:

gst-launch-1.0 videotestsrc ! imagefreeze ! video/x-raw,format=I420 ! videoconvert chroma-mode=0 ! video/x-raw,format=BGRA ! fakesink num-buffers=10000 
Execution ended after 0:00:00.850462115
Comment 4 Wim Taymans 2016-04-22 16:22:52 UTC
I'v added some more fastpaths to git:

commit a12f51c3deabb8c6c08b33d2d7a5e7d3f38df77f
Author: Wim Taymans <wtaymans@redhat.com>
Date:   Fri Apr 22 15:07:10 2016 +0200

    video-converter: add more fastpaths for I420 -> RGB
    
    Use the I420->BGRA and a new I420->ARGB to speed up any I420 to RGB
    operation.
Comment 5 Tim-Philipp Müller 2016-04-22 18:10:27 UTC
Can this be closed then?
Comment 6 Tim-Philipp Müller 2016-04-23 15:39:58 UTC
Please re-open if there's more left to do (aiui fast paths already exist in the other direction).