summaryrefslogtreecommitdiff
path: root/libavcodec/dfa.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-15 12:07:12 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-15 12:13:41 +0200
commit1557f34b10e6095a5cbf13ac5fcd3c095e2a93af (patch)
treee93ee2f5e5f73334c4daab0380ab200bbdbd1773 /libavcodec/dfa.c
parent1cb02d4fbc290c6e485fd301b902d8258d5c4994 (diff)
dfa: support decoding version=1.0
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dfa.c')
-rw-r--r--libavcodec/dfa.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c
index 32459098a7..6a095b2db9 100644
--- a/libavcodec/dfa.c
+++ b/libavcodec/dfa.c
@@ -340,6 +340,7 @@ static int dfa_decode_frame(AVCodecContext *avctx,
uint8_t *dst;
int ret;
int i, pal_elems;
+ int version = avctx->extradata_size==2 ? AV_RL16(avctx->extradata) : 0;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
@@ -374,9 +375,17 @@ static int dfa_decode_frame(AVCodecContext *avctx,
buf = s->frame_buf;
dst = frame->data[0];
for (i = 0; i < avctx->height; i++) {
- memcpy(dst, buf, avctx->width);
+ if(version == 0x100) {
+ int j;
+ for(j = 0; j < avctx->width; j++) {
+ dst[j] = buf[ (i&3)*(avctx->width /4) + (j/4) +
+ ((j&3)*(avctx->height/4) + (i/4))*avctx->width];
+ }
+ } else {
+ memcpy(dst, buf, avctx->width);
+ buf += avctx->width;
+ }
dst += frame->linesize[0];
- buf += avctx->width;
}
memcpy(frame->data[1], s->pal, sizeof(s->pal));