Mercurial > libavcodec.hg
comparison 8bps.c @ 6268:ce3cc7f7fb53 libavcodec
const
| author | michael |
|---|---|
| date | Fri, 01 Feb 2008 15:11:24 +0000 |
| parents | 2b72f9bc4f06 |
| children | 48759bfbd073 |
comparison
equal
deleted
inserted
replaced
| 6267:8af6a717f905 | 6268:ce3cc7f7fb53 |
|---|---|
| 55 /* | 55 /* |
| 56 * | 56 * |
| 57 * Decode a frame | 57 * Decode a frame |
| 58 * | 58 * |
| 59 */ | 59 */ |
| 60 static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) | 60 static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) |
| 61 { | 61 { |
| 62 EightBpsContext * const c = avctx->priv_data; | 62 EightBpsContext * const c = avctx->priv_data; |
| 63 unsigned char *encoded = (unsigned char *)buf; | 63 const unsigned char *encoded = buf; |
| 64 unsigned char *pixptr, *pixptr_end; | 64 unsigned char *pixptr, *pixptr_end; |
| 65 unsigned int height = avctx->height; // Real image height | 65 unsigned int height = avctx->height; // Real image height |
| 66 unsigned int dlen, p, row; | 66 unsigned int dlen, p, row; |
| 67 unsigned char *lp, *dp; | 67 const unsigned char *lp, *dp; |
| 68 unsigned char count; | 68 unsigned char count; |
| 69 unsigned int px_inc; | 69 unsigned int px_inc; |
| 70 unsigned int planes = c->planes; | 70 unsigned int planes = c->planes; |
| 71 unsigned char *planemap = c->planemap; | 71 unsigned char *planemap = c->planemap; |
| 72 | 72 |
| 95 | 95 |
| 96 /* Decode a plane */ | 96 /* Decode a plane */ |
| 97 for(row = 0; row < height; row++) { | 97 for(row = 0; row < height; row++) { |
| 98 pixptr = c->pic.data[0] + row * c->pic.linesize[0] + planemap[p]; | 98 pixptr = c->pic.data[0] + row * c->pic.linesize[0] + planemap[p]; |
| 99 pixptr_end = pixptr + c->pic.linesize[0]; | 99 pixptr_end = pixptr + c->pic.linesize[0]; |
| 100 dlen = be2me_16(*(unsigned short *)(lp+row*2)); | 100 dlen = be2me_16(*(const unsigned short *)(lp+row*2)); |
| 101 /* Decode a row of this plane */ | 101 /* Decode a row of this plane */ |
| 102 while(dlen > 0) { | 102 while(dlen > 0) { |
| 103 if(dp + 1 >= buf+buf_size) return -1; | 103 if(dp + 1 >= buf+buf_size) return -1; |
| 104 if ((count = *dp++) <= 127) { | 104 if ((count = *dp++) <= 127) { |
| 105 count++; | 105 count++; |
