comparison cinepak.c @ 1572:860e44e2c20c libavcodec

support Cinepak files with funky (not divisible by 4) resolutions
author melanson
date Sat, 25 Oct 2003 15:22:34 +0000
parents 222643544cf1
children 932d306bf1dc
comparison
equal deleted inserted replaced
1571:aa4dc16c0f18 1572:860e44e2c20c
65 AVFrame frame; 65 AVFrame frame;
66 AVFrame prev_frame; 66 AVFrame prev_frame;
67 67
68 unsigned char *data; 68 unsigned char *data;
69 int size; 69 int size;
70
71 int width, height;
70 72
71 unsigned char palette[PALETTE_COUNT * 4]; 73 unsigned char palette[PALETTE_COUNT * 4];
72 int palette_video; 74 int palette_video;
73 cvid_strip_t strips[MAX_STRIPS]; 75 cvid_strip_t strips[MAX_STRIPS];
74 76
287 { 289 {
288 uint8_t *eod = (data + size); 290 uint8_t *eod = (data + size);
289 int chunk_id, chunk_size; 291 int chunk_id, chunk_size;
290 292
291 /* coordinate sanity checks */ 293 /* coordinate sanity checks */
292 if (strip->x1 >= s->avctx->width || strip->x2 > s->avctx->width || 294 if (strip->x1 >= s->width || strip->x2 > s->width ||
293 strip->y1 >= s->avctx->height || strip->y2 > s->avctx->height || 295 strip->y1 >= s->height || strip->y2 > s->height ||
294 strip->x1 >= strip->x2 || strip->y1 >= strip->y2) 296 strip->x1 >= strip->x2 || strip->y1 >= strip->y2)
295 return -1; 297 return -1;
296 298
297 while ((data + 4) <= eod) { 299 while ((data + 4) <= eod) {
298 chunk_id = BE_16 (&data[0]); 300 chunk_id = BE_16 (&data[0]);
299 chunk_size = BE_16 (&data[2]) - 4; 301 chunk_size = BE_16 (&data[2]) - 4;
388 unsigned char *raw_palette; 390 unsigned char *raw_palette;
389 unsigned int *palette32; 391 unsigned int *palette32;
390 */ 392 */
391 393
392 s->avctx = avctx; 394 s->avctx = avctx;
395 s->width = (avctx->width + 3) & ~3;
396 s->height = (avctx->height + 3) & ~3;
393 397
394 // check for paletted data 398 // check for paletted data
395 s->palette_video = 0; 399 s->palette_video = 0;
396 400
397 401