[vlc-devel] [PATCH] demux: es: Replace swab(3) with own implementation

CapacitorSet capacitorset at gmail.com
Mon Feb 19 12:25:25 CET 2018


I considered the idea of not operating in-place, but that would mean doing one extra allocation per block, which may be outright slower.

The implementation of swab is similar to other existing ones: glibc's (https://github.com/lattera/glibc/blob/master/string/swab.c) does it but in reverse with two temporary variables, FreeBSD's (https://github.com/ddeville/libc/blob/master/src/string/FreeBSD/swab.c) does it 8 steps at a time, but they all follow the same algorithm to a certain extent.

If anything, the compiler may replace swab with a vectorized version (it would be a good use case for a shuffle instruction from SSSE3), but I couldn't find anything from a quick Google search.

On February 19, 2018 9:43:48 AM GMT+01:00, "RĂ©mi Denis-Courmont" <remi at remlab.net> wrote:
>Hello,
>
>I don't see the point in operating in place in this case? Meanwhile
>reimplemented swab() looks much slower than swab() itself can be.
>-- 
>Remi Denis-Courmont
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20180219/73f6855a/attachment.html>


More information about the vlc-devel mailing list