comparison libmpcodecs/vd.c @ 4899:c84d841ef43b

fixed stride for packed formats, more detailed printf at image allocation
author arpi
date Fri, 01 Mar 2002 00:20:11 +0000
parents fbafa2f216f5
children f6990fad0ab3
comparison
equal deleted inserted replaced
4898:a6b9c1fc6ee9 4899:c84d841ef43b
78 if(!mpi->bpp){ 78 if(!mpi->bpp){
79 mp_image_setfmt(mpi,sh->codec->outfmt[sh->outfmtidx]); 79 mp_image_setfmt(mpi,sh->codec->outfmt[sh->outfmtidx]);
80 if(!(mpi->flags&(MP_IMGFLAG_ALLOCATED|MP_IMGFLAG_DIRECT)) 80 if(!(mpi->flags&(MP_IMGFLAG_ALLOCATED|MP_IMGFLAG_DIRECT))
81 && mpi->type>MP_IMGTYPE_EXPORT){ 81 && mpi->type>MP_IMGTYPE_EXPORT){
82 // non-direct and not yet allocaed image. allocate it! 82 // non-direct and not yet allocaed image. allocate it!
83 printf("*** Allocating mp_image_t, %d bytes\n",mpi->bpp*mpi->width*mpi->height/8); 83 printf("*** Allocating mp_image_t, %dx%dx%dbpp %s %s, %d bytes\n",
84 mpi->width,mpi->height,mpi->bpp,
85 (mpi->flags&MP_IMGFLAG_YUV)?"YUV":"RGB",
86 (mpi->flags&MP_IMGFLAG_PLANAR)?"planar":"packed",
87 mpi->bpp*mpi->width*mpi->height/8);
84 mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*mpi->height/8); 88 mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*mpi->height/8);
85 if(!mpi->stride[0]) mpi->stride[0]=mpi->width;
86 if(mpi->flags&MP_IMGFLAG_PLANAR){ 89 if(mpi->flags&MP_IMGFLAG_PLANAR){
87 // YV12/I420. feel free to add other planar formats here... 90 // YV12/I420. feel free to add other planar formats here...
91 if(!mpi->stride[0]) mpi->stride[0]=mpi->width;
88 if(!mpi->stride[1]) mpi->stride[1]=mpi->stride[2]=mpi->width/2; 92 if(!mpi->stride[1]) mpi->stride[1]=mpi->stride[2]=mpi->width/2;
89 mpi->planes[1]=mpi->planes[0]+mpi->width*mpi->height; 93 mpi->planes[1]=mpi->planes[0]+mpi->width*mpi->height;
90 mpi->planes[2]=mpi->planes[1]+mpi->width*mpi->height/4; 94 mpi->planes[2]=mpi->planes[1]+mpi->width*mpi->height/4;
95 } else {
96 if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8;
91 } 97 }
92 mpi->flags|=MP_IMGFLAG_ALLOCATED; 98 mpi->flags|=MP_IMGFLAG_ALLOCATED;
93 } 99 }
94 } 100 }
95 } 101 }