Skip to content
  • Petr Kulhavy's avatar
    audio-converter: optimize endian conversion · 010b9547
    Petr Kulhavy authored and Sebastian Dröge's avatar Sebastian Dröge committed
    Optimize LE<->BE conversion by adding a dedicated fast path instead of
    using the generic converter. Implement transform_ip function in order to do the
    endian swap in place.
    
    This saves buffer allocation for the intermediate format, can be done in place
    and also performs the conversion in one step instead of unpack-convert-pack.
    
    For all bit widths the naive algorithm is implemented, which provides the best
    performance when compiled with -O3. ORC was considered but eventually removed
    as it requires a dedicated function for in-place conversion (due to the
    "restrict" parameters).
    
    A more complex algorithm for the 24-bit conversion with unrolled loop and
    32-bit processing is implemented in the #if 0 section. It performs better if
    compiled with -O2. With -O3 however the naive algorithm performs better.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773073
    010b9547