[FFmpeg-cvslog] avcodec/qdrw: add support for 0x0001 code

Paul B Mahol git at videolan.org
Wed Feb 22 22:25:04 EET 2017


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Feb 22 15:32:26 2017 +0100| [fb5c9be82ea870fd0a7643214ebf8728d8e29991] | committer: Paul B Mahol

avcodec/qdrw: add support for 0x0001 code

Fixes decoding of files which sets frame width/height this way.

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 libavcodec/qdrw.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c
index e3d69c2..2462e2f 100644
--- a/libavcodec/qdrw.c
+++ b/libavcodec/qdrw.c
@@ -33,6 +33,7 @@
 #include "internal.h"
 
 enum QuickdrawOpcodes {
+    CLIP = 0x0001,
     PACKBITSRECT = 0x0098,
     PACKBITSRGN,
     DIRECTBITSRECT,
@@ -309,7 +310,7 @@ static int decode_frame(AVCodecContext *avctx,
     AVFrame * const p      = data;
     GetByteContext gbc;
     int colors;
-    int w, h, ret;
+    int w, h, x0, y0, x1, y1, ret;
     int ver;
 
     bytestream2_init(&gbc, avpkt->data, avpkt->size);
@@ -353,6 +354,16 @@ static int decode_frame(AVCodecContext *avctx,
         int opcode = bytestream2_get_be16(&gbc);
 
         switch(opcode) {
+        case CLIP:
+            bytestream2_get_be16(&gbc);
+            y0 = bytestream2_get_be16(&gbc);
+            x0 = bytestream2_get_be16(&gbc);
+            y1 = bytestream2_get_be16(&gbc);
+            x1 = bytestream2_get_be16(&gbc);
+            ret = ff_set_dimensions(avctx, x1 - x0, y1 - y0);
+            if (ret < 0)
+                return ret;
+            break;
         case PACKBITSRECT:
         case PACKBITSRGN:
             av_log(avctx, AV_LOG_DEBUG, "Parsing Packbit opcode\n");



More information about the ffmpeg-cvslog mailing list