Mercurial > libavcodec.hg
comparison bmp.c @ 6265:abe584ca935c libavcodec
const
author | michael |
---|---|
date | Fri, 01 Feb 2008 15:01:05 +0000 |
parents | de0e893ef264 |
children | 48759bfbd073 |
comparison
equal
deleted
inserted
replaced
6264:8f6749f5cd53 | 6265:abe584ca935c |
---|---|
32 return 0; | 32 return 0; |
33 } | 33 } |
34 | 34 |
35 static int bmp_decode_frame(AVCodecContext *avctx, | 35 static int bmp_decode_frame(AVCodecContext *avctx, |
36 void *data, int *data_size, | 36 void *data, int *data_size, |
37 uint8_t *buf, int buf_size) | 37 const uint8_t *buf, int buf_size) |
38 { | 38 { |
39 BMPContext *s = avctx->priv_data; | 39 BMPContext *s = avctx->priv_data; |
40 AVFrame *picture = data; | 40 AVFrame *picture = data; |
41 AVFrame *p = &s->picture; | 41 AVFrame *p = &s->picture; |
42 unsigned int fsize, hsize; | 42 unsigned int fsize, hsize; |
46 unsigned int ihsize; | 46 unsigned int ihsize; |
47 int i, j, n, linesize; | 47 int i, j, n, linesize; |
48 uint32_t rgb[3]; | 48 uint32_t rgb[3]; |
49 uint8_t *ptr; | 49 uint8_t *ptr; |
50 int dsize; | 50 int dsize; |
51 uint8_t *buf0 = buf; | 51 const uint8_t *buf0 = buf; |
52 | 52 |
53 if(buf_size < 14){ | 53 if(buf_size < 14){ |
54 av_log(avctx, AV_LOG_ERROR, "buf size too small (%d)\n", buf_size); | 54 av_log(avctx, AV_LOG_ERROR, "buf size too small (%d)\n", buf_size); |
55 return -1; | 55 return -1; |
56 } | 56 } |
191 ptr += linesize; | 191 ptr += linesize; |
192 } | 192 } |
193 break; | 193 break; |
194 case 16: | 194 case 16: |
195 for(i = 0; i < avctx->height; i++){ | 195 for(i = 0; i < avctx->height; i++){ |
196 uint16_t *src = (uint16_t *) buf; | 196 const uint16_t *src = (const uint16_t *) buf; |
197 uint16_t *dst = (uint16_t *) ptr; | 197 uint16_t *dst = (uint16_t *) ptr; |
198 | 198 |
199 for(j = 0; j < avctx->width; j++) | 199 for(j = 0; j < avctx->width; j++) |
200 *dst++ = le2me_16(*src++); | 200 *dst++ = le2me_16(*src++); |
201 | 201 |
203 ptr += linesize; | 203 ptr += linesize; |
204 } | 204 } |
205 break; | 205 break; |
206 case 32: | 206 case 32: |
207 for(i = 0; i < avctx->height; i++){ | 207 for(i = 0; i < avctx->height; i++){ |
208 uint8_t *src = buf; | 208 const uint8_t *src = buf; |
209 uint8_t *dst = ptr; | 209 uint8_t *dst = ptr; |
210 | 210 |
211 for(j = 0; j < avctx->width; j++){ | 211 for(j = 0; j < avctx->width; j++){ |
212 dst[0] = src[rgb[2]]; | 212 dst[0] = src[rgb[2]]; |
213 dst[1] = src[rgb[1]]; | 213 dst[1] = src[rgb[1]]; |