]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/qdrw: cleanup skip code
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 13 May 2015 19:12:28 +0000 (21:12 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 13 May 2015 19:49:21 +0000 (21:49 +0200)
Skip 512 byte sectors until a non zero resolution is found

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/qdrw.c

index 8260395c88136ff469cdac8df1ba054ed8004c52..1c3244b036c0b29497ff42fcb5d677ddb07408a6 100644 (file)
@@ -124,13 +124,9 @@ static int decode_frame(AVCodecContext *avctx,
     int w, h, ret;
 
     bytestream2_init(&gbc, avpkt->data, avpkt->size);
-    if (   avpkt->size >= 552
-        && AV_RB32(&avpkt->data[ 10]) != 0x001102FF
-        && AV_RB32(&avpkt->data[522]) == 0x001102FF)
-        bytestream2_skip(&gbc, 512);
-
-    /* PICT images start with a 512 bytes empty header */
-    if (bytestream2_peek_be32(&gbc) == 0)
+    while (   bytestream2_get_bytes_left(&gbc) >= 552
+           && (   !AV_RB16(&avpkt->data[bytestream2_tell(&gbc)+6])
+               || !AV_RB16(&avpkt->data[bytestream2_tell(&gbc)+8])))
         bytestream2_skip(&gbc, 512);
 
     /* smallest PICT header */