comparison vmdav.c @ 6291:d498d28aa9da libavcodec

const
author michael
date Fri, 01 Feb 2008 16:06:40 +0000
parents c5c356f38cc4
children 814c8bd77d91
comparison
equal deleted inserted replaced
6290:b7045a85cd7d 6291:d498d28aa9da
59 AVCodecContext *avctx; 59 AVCodecContext *avctx;
60 DSPContext dsp; 60 DSPContext dsp;
61 AVFrame frame; 61 AVFrame frame;
62 AVFrame prev_frame; 62 AVFrame prev_frame;
63 63
64 unsigned char *buf; 64 const unsigned char *buf;
65 int size; 65 int size;
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;
72 } VmdVideoContext; 72 } VmdVideoContext;
73 73
74 #define QUEUE_SIZE 0x1000 74 #define QUEUE_SIZE 0x1000
75 #define QUEUE_MASK 0x0FFF 75 #define QUEUE_MASK 0x0FFF
76 76
77 static void lz_unpack(unsigned char *src, unsigned char *dest, int dest_len) 77 static void lz_unpack(const unsigned char *src, unsigned char *dest, int dest_len)
78 { 78 {
79 unsigned char *s; 79 const unsigned char *s;
80 unsigned char *d; 80 unsigned char *d;
81 unsigned char *d_end; 81 unsigned char *d_end;
82 unsigned char queue[QUEUE_SIZE]; 82 unsigned char queue[QUEUE_SIZE];
83 unsigned int qpos; 83 unsigned int qpos;
84 unsigned int dataleft; 84 unsigned int dataleft;
142 } 142 }
143 } 143 }
144 } 144 }
145 } 145 }
146 146
147 static int rle_unpack(unsigned char *src, unsigned char *dest, 147 static int rle_unpack(const unsigned char *src, unsigned char *dest,
148 int src_len, int dest_len) 148 int src_len, int dest_len)
149 { 149 {
150 unsigned char *ps; 150 const unsigned char *ps;
151 unsigned char *pd; 151 unsigned char *pd;
152 int i, l; 152 int i, l;
153 unsigned char *dest_end = dest + dest_len; 153 unsigned char *dest_end = dest + dest_len;
154 154
155 ps = src; 155 ps = src;
188 int i; 188 int i;
189 unsigned int *palette32; 189 unsigned int *palette32;
190 unsigned char r, g, b; 190 unsigned char r, g, b;
191 191
192 /* point to the start of the encoded data */ 192 /* point to the start of the encoded data */
193 unsigned char *p = s->buf + 16; 193 const unsigned char *p = s->buf + 16;
194 194
195 unsigned char *pb; 195 const unsigned char *pb;
196 unsigned char meth; 196 unsigned char meth;
197 unsigned char *dp; /* pointer to current frame */ 197 unsigned char *dp; /* pointer to current frame */
198 unsigned char *pp; /* pointer to previous frame */ 198 unsigned char *pp; /* pointer to previous frame */
199 unsigned char len; 199 unsigned char len;
200 int ofs; 200 int ofs;
366 return 0; 366 return 0;
367 } 367 }
368 368
369 static int vmdvideo_decode_frame(AVCodecContext *avctx, 369 static int vmdvideo_decode_frame(AVCodecContext *avctx,
370 void *data, int *data_size, 370 void *data, int *data_size,
371 uint8_t *buf, int buf_size) 371 const uint8_t *buf, int buf_size)
372 { 372 {
373 VmdVideoContext *s = avctx->priv_data; 373 VmdVideoContext *s = avctx->priv_data;
374 374
375 s->buf = buf; 375 s->buf = buf;
376 s->size = buf_size; 376 s->size = buf_size;
455 455
456 return 0; 456 return 0;
457 } 457 }
458 458
459 static void vmdaudio_decode_audio(VmdAudioContext *s, unsigned char *data, 459 static void vmdaudio_decode_audio(VmdAudioContext *s, unsigned char *data,
460 uint8_t *buf, int stereo) 460 const uint8_t *buf, int stereo)
461 { 461 {
462 int i; 462 int i;
463 int chan = 0; 463 int chan = 0;
464 int16_t *out = (int16_t*)data; 464 int16_t *out = (int16_t*)data;
465 465
473 chan ^= stereo; 473 chan ^= stereo;
474 } 474 }
475 } 475 }
476 476
477 static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, 477 static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data,
478 uint8_t *buf, int silence) 478 const uint8_t *buf, int silence)
479 { 479 {
480 int bytes_decoded = 0; 480 int bytes_decoded = 0;
481 int i; 481 int i;
482 482
483 // if (silence) 483 // if (silence)
520 return s->block_align * 2; 520 return s->block_align * 2;
521 } 521 }
522 522
523 static int vmdaudio_decode_frame(AVCodecContext *avctx, 523 static int vmdaudio_decode_frame(AVCodecContext *avctx,
524 void *data, int *data_size, 524 void *data, int *data_size,
525 uint8_t *buf, int buf_size) 525 const uint8_t *buf, int buf_size)
526 { 526 {
527 VmdAudioContext *s = avctx->priv_data; 527 VmdAudioContext *s = avctx->priv_data;
528 unsigned char *output_samples = (unsigned char *)data; 528 unsigned char *output_samples = (unsigned char *)data;
529 529
530 /* point to the start of the encoded data */ 530 /* point to the start of the encoded data */
531 unsigned char *p = buf + 16; 531 const unsigned char *p = buf + 16;
532 532
533 if (buf_size < 16) 533 if (buf_size < 16)
534 return buf_size; 534 return buf_size;
535 535
536 if (buf[6] == 1) { 536 if (buf[6] == 1) {