[FFmpeg-cvslog] avcodec/prosumer: Simplify code slightly in decompress()

Michael Niedermayer git at videolan.org
Sun Jan 20 23:22:37 EET 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Jan 12 21:56:14 2019 +0100| [d3b76c9993238508ac7e727088c2b27c46834848] | committer: Michael Niedermayer

avcodec/prosumer: Simplify code slightly in decompress()

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d3b76c9993238508ac7e727088c2b27c46834848
---

 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--;
         }



More information about the ffmpeg-cvslog mailing list