GNOME Bugzilla – Bug 764201
video: Provide fast path for I420 to BGRA (and/or RGBA) conversion and back
Last modified: 2016-04-23 15:39:58 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).
What CPU are we talking about? there is a fast I420 -> BGRA on little-endian
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).
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
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.
Can this be closed then?
Please re-open if there's more left to do (aiui fast paths already exist in the other direction).