Mercurial > libavcodec.hg
comparison bmp.c @ 9261:931bb51f060e libavcodec
Merge some cases for reading raw data with different bit depths in BMP
author | kostya |
---|---|
date | Fri, 27 Mar 2009 16:31:47 +0000 |
parents | 3ce78c919959 |
children | 54bc8a2727b0 |
comparison
equal
deleted
inserted
replaced
9260:762d7bc58fb6 | 9261:931bb51f060e |
---|---|
242 if(comp == BMP_RLE4 || comp == BMP_RLE8){ | 242 if(comp == BMP_RLE4 || comp == BMP_RLE8){ |
243 ff_msrle_decode(avctx, (AVPicture*)p, depth, buf, dsize); | 243 ff_msrle_decode(avctx, (AVPicture*)p, depth, buf, dsize); |
244 }else{ | 244 }else{ |
245 switch(depth){ | 245 switch(depth){ |
246 case 1: | 246 case 1: |
247 case 8: | |
248 case 24: | |
247 for(i = 0; i < avctx->height; i++){ | 249 for(i = 0; i < avctx->height; i++){ |
248 memcpy(ptr, buf, n); | 250 memcpy(ptr, buf, n); |
249 buf += n; | 251 buf += n; |
250 ptr += linesize; | 252 ptr += linesize; |
251 } | 253 } |
255 int j; | 257 int j; |
256 for(j = 0; j < n; j++){ | 258 for(j = 0; j < n; j++){ |
257 ptr[j*2+0] = (buf[j] >> 4) & 0xF; | 259 ptr[j*2+0] = (buf[j] >> 4) & 0xF; |
258 ptr[j*2+1] = buf[j] & 0xF; | 260 ptr[j*2+1] = buf[j] & 0xF; |
259 } | 261 } |
260 buf += n; | |
261 ptr += linesize; | |
262 } | |
263 break; | |
264 case 8: | |
265 for(i = 0; i < avctx->height; i++){ | |
266 memcpy(ptr, buf, avctx->width); | |
267 buf += n; | |
268 ptr += linesize; | |
269 } | |
270 break; | |
271 case 24: | |
272 for(i = 0; i < avctx->height; i++){ | |
273 memcpy(ptr, buf, avctx->width*(depth>>3)); | |
274 buf += n; | 262 buf += n; |
275 ptr += linesize; | 263 ptr += linesize; |
276 } | 264 } |
277 break; | 265 break; |
278 case 16: | 266 case 16: |