comparison vmdav.c @ 5699:c5c356f38cc4 libavcodec

Fix decoding of VMDs representing sprites (Last Dynasty, Woodruff). Fixes issue 101
author kostya
date Sun, 23 Sep 2007 16:11:07 +0000
parents c2ab2ac31edb
children d498d28aa9da
comparison
equal deleted inserted replaced
5698:9a26cb6747a9 5699:c5c356f38cc4
66 66
67 unsigned char palette[PALETTE_COUNT * 4]; 67 unsigned char palette[PALETTE_COUNT * 4];
68 unsigned char *unpack_buffer; 68 unsigned char *unpack_buffer;
69 int unpack_buffer_size; 69 int unpack_buffer_size;
70 70
71 int x_off, y_off;
71 } VmdVideoContext; 72 } VmdVideoContext;
72 73
73 #define QUEUE_SIZE 0x1000 74 #define QUEUE_SIZE 0x1000
74 #define QUEUE_MASK 0x0FFF 75 #define QUEUE_MASK 0x0FFF
75 76
204 205
205 frame_x = AV_RL16(&s->buf[6]); 206 frame_x = AV_RL16(&s->buf[6]);
206 frame_y = AV_RL16(&s->buf[8]); 207 frame_y = AV_RL16(&s->buf[8]);
207 frame_width = AV_RL16(&s->buf[10]) - frame_x + 1; 208 frame_width = AV_RL16(&s->buf[10]) - frame_x + 1;
208 frame_height = AV_RL16(&s->buf[12]) - frame_y + 1; 209 frame_height = AV_RL16(&s->buf[12]) - frame_y + 1;
210
211 if ((frame_width == s->avctx->width && frame_height == s->avctx->height) &&
212 (frame_x || frame_y)) {
213
214 s->x_off = frame_x;
215 s->y_off = frame_y;
216 }
217 frame_x -= s->x_off;
218 frame_y -= s->y_off;
209 219
210 /* if only a certain region will be updated, copy the entire previous 220 /* if only a certain region will be updated, copy the entire previous
211 * frame before the decode */ 221 * frame before the decode */
212 if (frame_x || frame_y || (frame_width != s->avctx->width) || 222 if (frame_x || frame_y || (frame_width != s->avctx->width) ||
213 (frame_height != s->avctx->height)) { 223 (frame_height != s->avctx->height)) {