Mercurial > libavcodec.hg
comparison cinepak.c @ 6230:612fc0c37427 libavcodec
const
author | michael |
---|---|
date | Fri, 01 Feb 2008 04:02:28 +0000 |
parents | 2b72f9bc4f06 |
children | 814c8bd77d91 |
comparison
equal
deleted
inserted
replaced
6229:042a48b6de72 | 6230:612fc0c37427 |
---|---|
57 | 57 |
58 AVCodecContext *avctx; | 58 AVCodecContext *avctx; |
59 DSPContext dsp; | 59 DSPContext dsp; |
60 AVFrame frame; | 60 AVFrame frame; |
61 | 61 |
62 unsigned char *data; | 62 const unsigned char *data; |
63 int size; | 63 int size; |
64 | 64 |
65 int width, height; | 65 int width, height; |
66 | 66 |
67 int palette_video; | 67 int palette_video; |
70 int sega_film_skip_bytes; | 70 int sega_film_skip_bytes; |
71 | 71 |
72 } CinepakContext; | 72 } CinepakContext; |
73 | 73 |
74 static void cinepak_decode_codebook (cvid_codebook_t *codebook, | 74 static void cinepak_decode_codebook (cvid_codebook_t *codebook, |
75 int chunk_id, int size, uint8_t *data) | 75 int chunk_id, int size, const uint8_t *data) |
76 { | 76 { |
77 uint8_t *eod = (data + size); | 77 const uint8_t *eod = (data + size); |
78 uint32_t flag, mask; | 78 uint32_t flag, mask; |
79 int i, n; | 79 int i, n; |
80 | 80 |
81 /* check if this chunk contains 4- or 6-element vectors */ | 81 /* check if this chunk contains 4- or 6-element vectors */ |
82 n = (chunk_id & 0x0400) ? 4 : 6; | 82 n = (chunk_id & 0x0400) ? 4 : 6; |
119 } | 119 } |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 static int cinepak_decode_vectors (CinepakContext *s, cvid_strip_t *strip, | 123 static int cinepak_decode_vectors (CinepakContext *s, cvid_strip_t *strip, |
124 int chunk_id, int size, uint8_t *data) | 124 int chunk_id, int size, const uint8_t *data) |
125 { | 125 { |
126 uint8_t *eod = (data + size); | 126 const uint8_t *eod = (data + size); |
127 uint32_t flag, mask; | 127 uint32_t flag, mask; |
128 cvid_codebook_t *codebook; | 128 cvid_codebook_t *codebook; |
129 unsigned int x, y; | 129 unsigned int x, y; |
130 uint32_t iy[4]; | 130 uint32_t iy[4]; |
131 uint32_t iu[2]; | 131 uint32_t iu[2]; |
262 | 262 |
263 return 0; | 263 return 0; |
264 } | 264 } |
265 | 265 |
266 static int cinepak_decode_strip (CinepakContext *s, | 266 static int cinepak_decode_strip (CinepakContext *s, |
267 cvid_strip_t *strip, uint8_t *data, int size) | 267 cvid_strip_t *strip, const uint8_t *data, int size) |
268 { | 268 { |
269 uint8_t *eod = (data + size); | 269 const uint8_t *eod = (data + size); |
270 int chunk_id, chunk_size; | 270 int chunk_id, chunk_size; |
271 | 271 |
272 /* coordinate sanity checks */ | 272 /* coordinate sanity checks */ |
273 if (strip->x1 >= s->width || strip->x2 > s->width || | 273 if (strip->x1 >= s->width || strip->x2 > s->width || |
274 strip->y1 >= s->height || strip->y2 > s->height || | 274 strip->y1 >= s->height || strip->y2 > s->height || |
315 return -1; | 315 return -1; |
316 } | 316 } |
317 | 317 |
318 static int cinepak_decode (CinepakContext *s) | 318 static int cinepak_decode (CinepakContext *s) |
319 { | 319 { |
320 uint8_t *eod = (s->data + s->size); | 320 const uint8_t *eod = (s->data + s->size); |
321 int i, result, strip_size, frame_flags, num_strips; | 321 int i, result, strip_size, frame_flags, num_strips; |
322 int y0 = 0; | 322 int y0 = 0; |
323 int encoded_buf_size; | 323 int encoded_buf_size; |
324 | 324 |
325 if (s->size < 10) | 325 if (s->size < 10) |
412 return 0; | 412 return 0; |
413 } | 413 } |
414 | 414 |
415 static int cinepak_decode_frame(AVCodecContext *avctx, | 415 static int cinepak_decode_frame(AVCodecContext *avctx, |
416 void *data, int *data_size, | 416 void *data, int *data_size, |
417 uint8_t *buf, int buf_size) | 417 const uint8_t *buf, int buf_size) |
418 { | 418 { |
419 CinepakContext *s = avctx->priv_data; | 419 CinepakContext *s = avctx->priv_data; |
420 | 420 |
421 s->data = buf; | 421 s->data = buf; |
422 s->size = buf_size; | 422 s->size = buf_size; |