Module: libav
Branch: master
Commit: 290d1022b2d90503735728d7feed35a53a69f631

Author:    Alberto Delmás <[email protected]>
Committer: Kostya Shishkov <[email protected]>
Date:      Mon Sep  3 17:32:01 2012 +0200

mss2: simplify loop in decode_rle()

It calculates the sum of power of two series, which can be done in one step.

Suggested by Michael Niedermayer <[email protected]>

Signed-off-by: Kostya Shishkov <[email protected]>

---

 libavcodec/mss2.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c
index 9914562..fbdc72c 100644
--- a/libavcodec/mss2.c
+++ b/libavcodec/mss2.c
@@ -335,8 +335,7 @@ static int decode_rle(GetBitContext *gb, uint8_t *pal_dst, 
int pal_stride,
                     else
                         repeat = get_bits(gb, b);
 
-                    while (b--)
-                        repeat += 1 << b;
+                    repeat += (1 << b) - 1;
 
                     if (last_symbol == -2) {
                         int skip = FFMIN(repeat, pal_dst + w - pp);

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to