shithub: mp3dec

Download patch

ref: a12d8d28026964e74e5438010432a361d3c28aa6
parent: d0beb6c4a350758dd0a8013c3f3ff6636fab869c
author: lieff <lieff@users.noreply.github.com>
date: Thu Mar 29 13:15:18 EDT 2018

optimization: ~5% speedup at skylake@192kbps, now it's faster than mpg123

--- a/minimp3.h
+++ b/minimp3.h
@@ -812,20 +812,17 @@
                 for (j = 0; j < 2; j++, dst++, leaf >>= 4)
                 {
                     int lsb = leaf & 0x0F;
-                    if (lsb)
+                    if (lsb == 15 && linbits)
                     {
-                        if (lsb == 15 && linbits)
-                        {
-                            lsb += PEEK_BITS(linbits);
-                            FLUSH_BITS(linbits);
-                            CHECK_BITS;
-                            *dst = one*L3_pow_43(lsb)*((int32_t)bs_cache < 0 ? -1: 1);
-                        } else
-                        {
-                            *dst = g_pow43_signed[lsb*2 + (bs_cache >> 31)]*one;
-                        }
-                        FLUSH_BITS(1);
+                        lsb += PEEK_BITS(linbits);
+                        FLUSH_BITS(linbits);
+                        CHECK_BITS;
+                        *dst = one*L3_pow_43(lsb)*((int32_t)bs_cache < 0 ? -1: 1);
+                    } else
+                    {
+                        *dst = g_pow43_signed[lsb*2 + (bs_cache >> 31)]*one;
                     }
+                    FLUSH_BITS(lsb ? 1 : 0);
                 }
                 CHECK_BITS;
             } while (--pairs_to_decode);