aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAlberto Delmás <adelmas@gmail.com>2012-09-03 17:32:01 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2012-09-06 20:48:07 +0200
commit290d1022b2d90503735728d7feed35a53a69f631 (patch)
tree381cad882e4add9e46ea3de0dec10374032fd664 /libavcodec
parent9699b3a2d7ebc62ae58c4e70997190f5f7b45d27 (diff)
downloadffmpeg-290d1022b2d90503735728d7feed35a53a69f631.tar.gz
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 <michaelni@gmx.at> Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mss2.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c
index 9914562da6..fbdc72c5c7 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);