Mercurial > libavcodec.hg
comparison utils.c @ 7941:8a3f24796fa9 libavcodec
Replace second (and wrong) call to avcodec_align_dimensions() by adjusting
stride_align. This is not particularly pretty and I will gladly implement
something else if someone has an idea!
| author | michael |
|---|---|
| date | Tue, 30 Sep 2008 01:07:25 +0000 |
| parents | 673cac811afb |
| children | 64f35acc2407 |
comparison
equal
deleted
inserted
replaced
| 7940:8dc81763fb42 | 7941:8a3f24796fa9 |
|---|---|
| 227 }else{ | 227 }else{ |
| 228 int h_chroma_shift, v_chroma_shift; | 228 int h_chroma_shift, v_chroma_shift; |
| 229 int size[4] = {0}; | 229 int size[4] = {0}; |
| 230 int tmpsize; | 230 int tmpsize; |
| 231 AVPicture picture; | 231 AVPicture picture; |
| 232 int stride_align[4]; | |
| 232 | 233 |
| 233 avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift); | 234 avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift); |
| 234 | 235 |
| 235 avcodec_align_dimensions(s, &w, &h); | 236 avcodec_align_dimensions(s, &w, &h); |
| 236 | 237 |
| 237 if(!(s->flags&CODEC_FLAG_EMU_EDGE)){ | 238 if(!(s->flags&CODEC_FLAG_EMU_EDGE)){ |
| 238 w+= EDGE_WIDTH*2; | 239 w+= EDGE_WIDTH*2; |
| 239 h+= EDGE_WIDTH*2; | 240 h+= EDGE_WIDTH*2; |
| 240 } | 241 } |
| 241 avcodec_align_dimensions(s, &w, &h); | |
| 242 | 242 |
| 243 ff_fill_linesize(&picture, s->pix_fmt, w); | 243 ff_fill_linesize(&picture, s->pix_fmt, w); |
| 244 | 244 |
| 245 for (i=0; i<4; i++) | 245 for (i=0; i<4; i++){ |
| 246 picture.linesize[i] = ALIGN(picture.linesize[i], STRIDE_ALIGN); | 246 //STRIDE_ALIGN is 8 for SSE* but this does not work for SVQ1 chroma planes |
| 247 //we could change STRIDE_ALIGN to 16 for x86/sse but it would increase the | |
| 248 //picture size unneccessarily in some cases. The solution here is not | |
| 249 //pretty and better ideas are welcome! | |
| 250 #ifdef HAVE_MMX | |
| 251 if(s->codec_id == CODEC_ID_SVQ1) | |
| 252 stride_align[i]= 16; | |
| 253 else | |
| 254 #endif | |
| 255 stride_align[i] = STRIDE_ALIGN; | |
| 256 picture.linesize[i] = ALIGN(picture.linesize[i], stride_align[i]); | |
| 257 } | |
| 247 | 258 |
| 248 tmpsize = ff_fill_pointer(&picture, NULL, s->pix_fmt, h); | 259 tmpsize = ff_fill_pointer(&picture, NULL, s->pix_fmt, h); |
| 249 | 260 |
| 250 for (i=0; i<3 && picture.data[i+1]; i++) | 261 for (i=0; i<3 && picture.data[i+1]; i++) |
| 251 size[i] = picture.data[i+1] - picture.data[i]; | 262 size[i] = picture.data[i+1] - picture.data[i]; |
| 267 | 278 |
| 268 // no edge if EDEG EMU or not planar YUV, we check for PAL8 redundantly to protect against a exploitable bug regression ... | 279 // no edge if EDEG EMU or not planar YUV, we check for PAL8 redundantly to protect against a exploitable bug regression ... |
| 269 if((s->flags&CODEC_FLAG_EMU_EDGE) || (s->pix_fmt == PIX_FMT_PAL8) || !size[2]) | 280 if((s->flags&CODEC_FLAG_EMU_EDGE) || (s->pix_fmt == PIX_FMT_PAL8) || !size[2]) |
| 270 buf->data[i] = buf->base[i]; | 281 buf->data[i] = buf->base[i]; |
| 271 else | 282 else |
| 272 buf->data[i] = buf->base[i] + ALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), STRIDE_ALIGN); | 283 buf->data[i] = buf->base[i] + ALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), stride_align[i]); |
| 273 } | 284 } |
| 274 buf->width = s->width; | 285 buf->width = s->width; |
| 275 buf->height = s->height; | 286 buf->height = s->height; |
| 276 buf->pix_fmt= s->pix_fmt; | 287 buf->pix_fmt= s->pix_fmt; |
| 277 pic->age= 256*256*256*64; | 288 pic->age= 256*256*256*64; |
