Mercurial > mplayer.hg
comparison libmpcodecs/vf.c @ 30112:c26218c27e73
Deduplicate the mp_image planes allocation code.
The code in vf.c and mp_image.c is almost the same, though the one in vf.c
is more up-to-date/has more bug fixes and thus is used as the basis
(which is why the diff is so big).
author | reimar |
---|---|
date | Thu, 31 Dec 2009 23:09:35 +0000 |
parents | 19414a605695 |
children | bbb6ebec87a0 |
comparison
equal
deleted
inserted
replaced
30111:ee5c7a825348 | 30112:c26218c27e73 |
---|---|
370 mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) - 1)>>mpi->chroma_x_shift; | 370 mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) - 1)>>mpi->chroma_x_shift; |
371 } | 371 } |
372 } | 372 } |
373 } | 373 } |
374 | 374 |
375 // IF09 - allocate space for 4. plane delta info - unused | 375 mp_image_alloc_planes(mpi); |
376 if (mpi->imgfmt == IMGFMT_IF09) | |
377 { | |
378 mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8+ | |
379 mpi->chroma_width*mpi->chroma_height); | |
380 /* export delta table */ | |
381 mpi->planes[3]=mpi->planes[0]+(mpi->width*mpi->height)+2*(mpi->chroma_width*mpi->chroma_height); | |
382 } | |
383 else | |
384 mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8); | |
385 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
386 int bpp = IMGFMT_IS_YUVP16(mpi->imgfmt)? 2 : 1; | |
387 // YV12/I420/YVU9/IF09. feel free to add other planar formats here... | |
388 //if(!mpi->stride[0]) | |
389 mpi->stride[0]=bpp*mpi->width; | |
390 //if(!mpi->stride[1]) | |
391 if(mpi->num_planes > 2){ | |
392 mpi->stride[1]=mpi->stride[2]=bpp*mpi->chroma_width; | |
393 if(mpi->flags&MP_IMGFLAG_SWAPPED){ | |
394 // I420/IYUV (Y,U,V) | |
395 mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height; | |
396 mpi->planes[2]=mpi->planes[1]+mpi->stride[1]*mpi->chroma_height; | |
397 } else { | |
398 // YV12,YVU9,IF09 (Y,V,U) | |
399 mpi->planes[2]=mpi->planes[0]+mpi->stride[0]*mpi->height; | |
400 mpi->planes[1]=mpi->planes[2]+mpi->stride[1]*mpi->chroma_height; | |
401 } | |
402 } else { | |
403 // NV12/NV21 | |
404 mpi->stride[1]=mpi->chroma_width; | |
405 mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height; | |
406 } | |
407 } else { | |
408 //if(!mpi->stride[0]) | |
409 mpi->stride[0]=mpi->width*mpi->bpp/8; | |
410 if (mpi->flags & MP_IMGFLAG_RGB_PALETTE) | |
411 mpi->planes[1] = memalign(64, 1024); | |
412 } | |
413 // printf("clearing img!\n"); | 376 // printf("clearing img!\n"); |
414 vf_mpi_clear(mpi,0,0,mpi->width,mpi->height); | 377 vf_mpi_clear(mpi,0,0,mpi->width,mpi->height); |
415 mpi->flags|=MP_IMGFLAG_ALLOCATED; | |
416 } | 378 } |
417 } | 379 } |
418 if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK) | 380 if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK) |
419 if(vf->start_slice) vf->start_slice(vf,mpi); | 381 if(vf->start_slice) vf->start_slice(vf,mpi); |
420 if(!(mpi->flags&MP_IMGFLAG_TYPE_DISPLAYED)){ | 382 if(!(mpi->flags&MP_IMGFLAG_TYPE_DISPLAYED)){ |