[FFmpeg-devel] [PATCH 1/2] avcodec/dvdsubdec: Avoid branch in decode_run_8bit()
Michael Niedermayer
michael at niedermayer.cc
Thu Sep 13 05:24:49 EEST 2018
Speed improvment 35.5 sec -> 34.7sec
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
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);
--
2.18.0
More information about the ffmpeg-devel
mailing list