From 4b28907e4a947b7697fa44d5a80b6675ab152cc0 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 13 May 2015 21:12:28 +0200 Subject: [PATCH] avcodec/qdrw: cleanup skip code Skip 512 byte sectors until a non zero resolution is found Signed-off-by: Michael Niedermayer --- libavcodec/qdrw.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c index 8260395c88..1c3244b036 100644 --- a/libavcodec/qdrw.c +++ b/libavcodec/qdrw.c @@ -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 */