Commit fb5c9be8 authored by Paul B Mahol's avatar Paul B Mahol

avcodec/qdrw: add support for 0x0001 code

Fixes decoding of files which sets frame width/height this way.
Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent 2c583925
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "internal.h" #include "internal.h"
enum QuickdrawOpcodes { enum QuickdrawOpcodes {
CLIP = 0x0001,
PACKBITSRECT = 0x0098, PACKBITSRECT = 0x0098,
PACKBITSRGN, PACKBITSRGN,
DIRECTBITSRECT, DIRECTBITSRECT,
...@@ -309,7 +310,7 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -309,7 +310,7 @@ static int decode_frame(AVCodecContext *avctx,
AVFrame * const p = data; AVFrame * const p = data;
GetByteContext gbc; GetByteContext gbc;
int colors; int colors;
int w, h, ret; int w, h, x0, y0, x1, y1, ret;
int ver; int ver;
bytestream2_init(&gbc, avpkt->data, avpkt->size); bytestream2_init(&gbc, avpkt->data, avpkt->size);
...@@ -353,6 +354,16 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -353,6 +354,16 @@ static int decode_frame(AVCodecContext *avctx,
int opcode = bytestream2_get_be16(&gbc); int opcode = bytestream2_get_be16(&gbc);
switch(opcode) { 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 PACKBITSRECT:
case PACKBITSRGN: case PACKBITSRGN:
av_log(avctx, AV_LOG_DEBUG, "Parsing Packbit opcode\n"); av_log(avctx, AV_LOG_DEBUG, "Parsing Packbit opcode\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment