[FFmpeg-cvslog] avcodec/dvdsubdec: Avoid branch in decode_run_8bit()

Michael Niedermayer git at videolan.org
Sat Sep 15 21:03:06 EEST 2018


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Sep 13 04:24:49 2018 +0200| [71bf0330505e2108935d05c5c018ec65eac4b946] | committer: Michael Niedermayer

avcodec/dvdsubdec: Avoid branch in decode_run_8bit()

Speed improvment 35.5 sec -> 34.7sec

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/dvdsubdec.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index f1ac9e353e..13d52c8c68 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -83,10 +83,7 @@ static int decode_run_8bit(GetBitContext *gb, int *color)
 {
     int len;
     int has_run = get_bits1(gb);
-    if (get_bits1(gb))
-        *color = get_bits(gb, 8);
-    else
-        *color = get_bits(gb, 2);
+    *color = get_bits(gb, 2 + 6*get_bits1(gb));
     if (has_run) {
         if (get_bits1(gb)) {
             len = get_bits(gb, 7);



More information about the ffmpeg-cvslog mailing list