From d3b76c9993238508ac7e727088c2b27c46834848 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 12 Jan 2019 21:56:14 +0100 Subject: [PATCH] avcodec/prosumer: Simplify code slightly in decompress() Signed-off-by: Michael Niedermayer --- libavcodec/prosumer.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/libavcodec/prosumer.c b/libavcodec/prosumer.c index 505de71980..3fa9986a38 100644 --- a/libavcodec/prosumer.c +++ b/libavcodec/prosumer.c @@ -84,16 +84,13 @@ static int decompress(GetByteContext *gb, int size, PutByteContext *pb, const ui if (bytestream2_get_bytes_left(gb) <= 0) { if (!a) return 0; - cnt = 4; } else { - pos = bytestream2_tell(gb) ^ 2; - bytestream2_seek(gb, pos, SEEK_SET); + pos = bytestream2_tell(gb); + bytestream2_seek(gb, pos ^ 2, SEEK_SET); AV_WN16(&a, bytestream2_peek_le16(gb)); - pos = pos ^ 2; - bytestream2_seek(gb, pos, SEEK_SET); - bytestream2_skip(gb, 2); - cnt = 4; + bytestream2_seek(gb, pos + 2, SEEK_SET); } + cnt = 4; } c--; } @@ -117,12 +114,10 @@ static int decompress(GetByteContext *gb, int size, PutByteContext *pb, const ui } return 0; } - pos = bytestream2_tell(gb) ^ 2; - bytestream2_seek(gb, pos, SEEK_SET); + pos = bytestream2_tell(gb); + bytestream2_seek(gb, pos ^ 2, SEEK_SET); AV_WN16(&a, bytestream2_peek_le16(gb)); - pos = pos ^ 2; - bytestream2_seek(gb, pos, SEEK_SET); - bytestream2_skip(gb, 2); + bytestream2_seek(gb, pos + 2, SEEK_SET); cnt = 4; idx--; }