[FFmpeg-devel] [PATCH 2/4] avcodec/prosumer: Simplify code slightly in decompress()
Michael Niedermayer
michael at niedermayer.cc
Sun Jan 13 00:28:01 EET 2019
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
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--;
}
--
2.20.1
More information about the ffmpeg-devel
mailing list