[FFmpeg-cvslog] huffyuvdec: swap code blocks

Christophe Gisquet git at videolan.org
Sun Jun 15 16:21:02 CEST 2014


ffmpeg | branch: master | Christophe Gisquet <christophe.gisquet at gmail.com> | Sun Jun 15 12:07:16 2014 +0200| [9dc17919777a637aae0cf69949c55d8186e928ce] | committer: Michael Niedermayer

huffyuvdec: swap code blocks

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 at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9dc17919777a637aae0cf69949c55d8186e928ce
---

 libavcodec/huffyuvdec.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index bc9d038..c069d00 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -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)
 



More information about the ffmpeg-cvslog mailing list