comparison iff.c @ 11719:30356abc8604 libavcodec

Move handling of paletted data to the IFF demuxer. This allows future handling of things such as masking/EHB/HAM for this type of data. Patch by Sebastian Vater <cdgs basty googlemail com>.
author rbultje
date Thu, 13 May 2010 15:39:40 +0000
parents f2beca0bbf98
children 92f4ca7a4002
comparison
equal deleted inserted replaced
11718:f2beca0bbf98 11719:30356abc8604
216 if (avctx->reget_buffer(avctx, &s->frame) < 0){ 216 if (avctx->reget_buffer(avctx, &s->frame) < 0){
217 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); 217 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
218 return -1; 218 return -1;
219 } 219 }
220 220
221 if (avctx->codec_tag == MKTAG('I','L','B','M')) { // interleaved
221 if (avctx->pix_fmt == PIX_FMT_PAL8) { 222 if (avctx->pix_fmt == PIX_FMT_PAL8) {
222 for(y = 0; y < avctx->height; y++ ) { 223 for(y = 0; y < avctx->height; y++ ) {
223 uint8_t *row = &s->frame.data[0][ y*s->frame.linesize[0] ]; 224 uint8_t *row = &s->frame.data[0][ y*s->frame.linesize[0] ];
224 memset(row, 0, avctx->width); 225 memset(row, 0, avctx->width);
225 for (plane = 0; plane < avctx->bits_per_coded_sample && buf < buf_end; plane++) { 226 for (plane = 0; plane < avctx->bits_per_coded_sample && buf < buf_end; plane++) {
233 memset(row, 0, avctx->width << 2); 234 memset(row, 0, avctx->width << 2);
234 for (plane = 0; plane < avctx->bits_per_coded_sample && buf < buf_end; plane++) { 235 for (plane = 0; plane < avctx->bits_per_coded_sample && buf < buf_end; plane++) {
235 decodeplane32((uint32_t *) row, buf, FFMIN(s->planesize, buf_end - buf), plane); 236 decodeplane32((uint32_t *) row, buf, FFMIN(s->planesize, buf_end - buf), plane);
236 buf += s->planesize; 237 buf += s->planesize;
237 } 238 }
239 }
240 }
241 } else if (avctx->pix_fmt == PIX_FMT_PAL8) { // IFF-PBM
242 for(y = 0; y < avctx->height; y++ ) {
243 uint8_t *row = &s->frame.data[0][y * s->frame.linesize[0]];
244 memcpy(row, buf, FFMIN(avctx->width, buf_end - buf));
245 buf += avctx->width;
238 } 246 }
239 } 247 }
240 248
241 *data_size = sizeof(AVFrame); 249 *data_size = sizeof(AVFrame);
242 *(AVFrame*)data = s->frame; 250 *(AVFrame*)data = s->frame;