]> git.sesse.net Git - ffmpeg/commitdiff
huffyuvdec: swap code blocks
authorChristophe Gisquet <christophe.gisquet@gmail.com>
Sun, 15 Jun 2014 10:07:16 +0000 (12:07 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 15 Jun 2014 13:13:28 +0000 (15:13 +0200)
The effect is not really deterministic, as it seems to be a combination
on x86_64 of fewer registers used, different jump offsets and, for all
archs, of likely branches.

Speedup is around 15%.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/huffyuvdec.c

index bc9d038dcedfeafd943008f36d4bf4659cea6112..c069d00b4eda56760b9dd8700ef08e66b0ff556d 100644 (file)
@@ -591,17 +591,17 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
         unsigned int index = SHOW_UBITS(name, gb, bits);            \
         int          code, n = dtable[index][1];                    \
                                                                     \
-        if (n>0) {                                                  \
-            code = dtable[index][0];                                \
-            OP(dst0, dst1, code);                                   \
-            LAST_SKIP_BITS(name, gb, n);                            \
-        } else {                                                    \
+        if (n<=0) {                                                 \
             int nb_bits;                                            \
             VLC_INTERN(dst0, table1, gb, name, bits, max_depth);    \
                                                                     \
             UPDATE_CACHE(re, gb);                                   \
             index = SHOW_UBITS(name, gb, bits);                     \
             VLC_INTERN(dst1, table2, gb, name, bits, max_depth);    \
+        } else {                                                    \
+            code = dtable[index][0];                                \
+            OP(dst0, dst1, code);                                   \
+            LAST_SKIP_BITS(name, gb, n);                            \
         }                                                           \
     } while (0)