comparison utils.c @ 8748:eaa08ce79f9a libavcodec

Ensure that the palette is set in data[1] for all 8bit formats. Also document it.
author michael
date Fri, 06 Feb 2009 12:59:50 +0000
parents e9d9d946f213
children 2528b6a2b5d3
comparison
equal deleted inserted replaced
8747:a261e3271d1f 8748:eaa08ce79f9a
152 if(s->codec_id == CODEC_ID_RPZA){ 152 if(s->codec_id == CODEC_ID_RPZA){
153 w_align=4; 153 w_align=4;
154 h_align=4; 154 h_align=4;
155 } 155 }
156 case PIX_FMT_PAL8: 156 case PIX_FMT_PAL8:
157 case PIX_FMT_BGR8:
158 case PIX_FMT_RGB8:
157 if(s->codec_id == CODEC_ID_SMC){ 159 if(s->codec_id == CODEC_ID_SMC){
158 w_align=4; 160 w_align=4;
159 h_align=4; 161 h_align=4;
160 } 162 }
161 break; 163 break;
279 281
280 buf->base[i]= av_malloc(size[i]+16); //FIXME 16 282 buf->base[i]= av_malloc(size[i]+16); //FIXME 16
281 if(buf->base[i]==NULL) return -1; 283 if(buf->base[i]==NULL) return -1;
282 memset(buf->base[i], 128, size[i]); 284 memset(buf->base[i], 128, size[i]);
283 285
284 // no edge if EDEG EMU or not planar YUV, we check for PAL8 redundantly to protect against a exploitable bug regression ... 286 // no edge if EDEG EMU or not planar YUV
285 if((s->flags&CODEC_FLAG_EMU_EDGE) || (s->pix_fmt == PIX_FMT_PAL8) || !size[2]) 287 if((s->flags&CODEC_FLAG_EMU_EDGE) || !size[2])
286 buf->data[i] = buf->base[i]; 288 buf->data[i] = buf->base[i];
287 else 289 else
288 buf->data[i] = buf->base[i] + ALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), stride_align[i]); 290 buf->data[i] = buf->base[i] + ALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), stride_align[i]);
289 } 291 }
292 if(size[1] && !size[2])
293 ff_set_systematic_pal((uint32_t*)buf->data[1], s->pix_fmt);
290 buf->width = s->width; 294 buf->width = s->width;
291 buf->height = s->height; 295 buf->height = s->height;
292 buf->pix_fmt= s->pix_fmt; 296 buf->pix_fmt= s->pix_fmt;
293 pic->age= 256*256*256*64; 297 pic->age= 256*256*256*64;
294 } 298 }