diff --exclude-from dontdiff -urN vanilla/main/libmpcodecs/vd.c main/libmpcodecs/vd.c --- vanilla/main/libmpcodecs/vd.c 2004-10-04 16:13:35.000000000 +0200 +++ main/libmpcodecs/vd.c 2004-11-22 23:59:24.000000000 +0100 @@ -342,6 +342,12 @@ return mpi; } +mp_image_t* mpcodecs_get_image_aligned(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h, int walign, int halign){ + mp_image_t* mpi=vf_get_image_aligned(sh->vfilter,sh->codec->outfmt[sh->outfmtidx],mp_imgtype,mp_imgflag,w,h,walign,halign); + mpi->x=mpi->y=0; + return mpi; +} + void mpcodecs_draw_slice(sh_video_t *sh, unsigned char** src, int* stride, int w,int h, int x, int y) { struct vf_instance_s* vf = sh->vfilter; diff --exclude-from dontdiff -urN vanilla/main/libmpcodecs/vd_ffmpeg.c main/libmpcodecs/vd_ffmpeg.c --- vanilla/main/libmpcodecs/vd_ffmpeg.c 2004-10-12 13:07:09.000000000 +0200 +++ main/libmpcodecs/vd_ffmpeg.c 2004-11-22 23:58:00.000000000 +0100 @@ -576,8 +576,8 @@ } #endif - mpi= mpcodecs_get_image(sh,type, flags, - (width+align)&(~align), (height+align)&(~align)); + mpi= mpcodecs_get_image_aligned(sh,type, flags, + width, height, align, align); // ok, let's see what did we get: if( mpi->flags&MP_IMGFLAG_DRAW_CALLBACK && diff --exclude-from dontdiff -urN vanilla/main/libmpcodecs/vd.h main/libmpcodecs/vd.h --- vanilla/main/libmpcodecs/vd.h 2004-02-18 16:23:41.000000000 +0100 +++ main/libmpcodecs/vd.h 2004-11-23 00:15:55.000000000 +0100 @@ -28,6 +28,7 @@ // callbacks: int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int preferred_outfmt); mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); +mp_image_t* mpcodecs_get_image_aligned(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h, int walign, int halign); void mpcodecs_draw_slice(sh_video_t *sh, unsigned char** src, int* stride, int w,int h, int x, int y); #define VDFLAGS_DROPFRAME 3 diff --exclude-from dontdiff -urN vanilla/main/libmpcodecs/vd_libmpeg2.c main/libmpcodecs/vd_libmpeg2.c --- vanilla/main/libmpcodecs/vd_libmpeg2.c 2004-11-22 17:15:14.000000000 +0100 +++ main/libmpcodecs/vd_libmpeg2.c 2004-11-22 23:58:23.000000000 +0100 @@ -183,11 +183,11 @@ MP_IMGFLAG_DRAW_CALLBACK:0; // get_buffer "callback": - mpi_new=mpcodecs_get_image(sh,MP_IMGTYPE_IPB, + mpi_new=mpcodecs_get_image_aligned(sh,MP_IMGTYPE_IPB, (type==PIC_FLAG_CODING_TYPE_B) ? use_callback : (MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE), info->sequence->picture_width, - info->sequence->picture_height ); + info->sequence->picture_height, 15, 15 ); if(!mpi_new) return 0; // VO ERROR!!!!!!!! mpeg2_set_buf(mpeg2dec, mpi_new->planes, mpi_new); diff --exclude-from dontdiff -urN vanilla/main/libmpcodecs/vd_xanim.c main/libmpcodecs/vd_xanim.c --- vanilla/main/libmpcodecs/vd_xanim.c 2003-07-03 22:22:51.000000000 +0200 +++ main/libmpcodecs/vd_xanim.c 2004-11-22 23:59:01.000000000 +0100 @@ -761,9 +761,9 @@ if(sh->codec->outflags[sh->outfmtidx] & CODECS_FLAG_STATIC){ // allocate static buffer for cvid-like codecs: - priv->mpi = mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, + priv->mpi = mpcodecs_get_image_aligned(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE, - (sh->disp_w+3)&(~3), (sh->disp_h+3)&(~3)); + sh->disp_w, sh->disp_h, 3, 3); if (!priv->mpi) return NULL; ret = priv->dec_func((uint8_t*)priv->mpi, data, len, priv->decinfo); } else { diff --exclude-from dontdiff -urN vanilla/main/libmpcodecs/vf.c main/libmpcodecs/vf.c --- vanilla/main/libmpcodecs/vf.c 2004-06-02 15:55:16.000000000 +0200 +++ main/libmpcodecs/vf.c 2004-11-23 00:11:56.000000000 +0100 @@ -236,9 +236,12 @@ } } -mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h){ +mp_image_t* vf_get_image_aligned(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, + int w, int h, + int walign, int halign){ mp_image_t* mpi=NULL; - int w2=(mp_imgflag&MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE)?((w+15)&(~15)):w; + int w2=(walign > 0)?((w+walign)&(~walign)):w; + int h2=(halign > 0)?((h+halign)&(~halign)):h; if(vf->put_image==vf_next_put_image){ // passthru mode, if the plugin uses the fallback/default put_image() code @@ -249,25 +252,25 @@ // and if not, then fallback to software buffers: switch(mp_imgtype){ case MP_IMGTYPE_EXPORT: - if(!vf->imgctx.export_images[0]) vf->imgctx.export_images[0]=new_mp_image(w2,h); + if(!vf->imgctx.export_images[0]) vf->imgctx.export_images[0]=new_mp_image(w2,h2); mpi=vf->imgctx.export_images[0]; break; case MP_IMGTYPE_STATIC: - if(!vf->imgctx.static_images[0]) vf->imgctx.static_images[0]=new_mp_image(w2,h); + if(!vf->imgctx.static_images[0]) vf->imgctx.static_images[0]=new_mp_image(w2,h2); mpi=vf->imgctx.static_images[0]; break; case MP_IMGTYPE_TEMP: - if(!vf->imgctx.temp_images[0]) vf->imgctx.temp_images[0]=new_mp_image(w2,h); + if(!vf->imgctx.temp_images[0]) vf->imgctx.temp_images[0]=new_mp_image(w2,h2); mpi=vf->imgctx.temp_images[0]; break; case MP_IMGTYPE_IPB: if(!(mp_imgflag&MP_IMGFLAG_READABLE)){ // B frame: - if(!vf->imgctx.temp_images[0]) vf->imgctx.temp_images[0]=new_mp_image(w2,h); + if(!vf->imgctx.temp_images[0]) vf->imgctx.temp_images[0]=new_mp_image(w2,h2); mpi=vf->imgctx.temp_images[0]; break; } case MP_IMGTYPE_IP: - if(!vf->imgctx.static_images[vf->imgctx.static_idx]) vf->imgctx.static_images[vf->imgctx.static_idx]=new_mp_image(w2,h); + if(!vf->imgctx.static_images[vf->imgctx.static_idx]) vf->imgctx.static_images[vf->imgctx.static_idx]=new_mp_image(w2,h2); mpi=vf->imgctx.static_images[vf->imgctx.static_idx]; vf->imgctx.static_idx^=1; break; @@ -281,10 +284,10 @@ // accept restrictions & draw_slice flags only: mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK); if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; - if(mpi->width!=w2 || mpi->height!=h){ + if(mpi->width!=w2 || mpi->height!=h2){ // printf("vf.c: MPI parameters changed! %dx%d -> %dx%d \n", mpi->width,mpi->height,w2,h); if(mpi->flags&MP_IMGFLAG_ALLOCATED){ - if(mpi->widthheightwidthheightplanes[0]); mpi->flags&=~MP_IMGFLAG_ALLOCATED; @@ -293,7 +296,7 @@ // } else { } { mpi->width=w2; mpi->chroma_width=(w2 + (1<chroma_x_shift) - 1)>>mpi->chroma_x_shift; - mpi->height=h; mpi->chroma_height=(h + (1<chroma_y_shift) - 1)>>mpi->chroma_y_shift; + mpi->height=h2; mpi->chroma_height=(h2 + (1<chroma_y_shift) - 1)>>mpi->chroma_y_shift; } } if(!mpi->bpp) mp_image_setfmt(mpi,outfmt); @@ -310,6 +313,7 @@ int align=(mpi->flags&MP_IMGFLAG_PLANAR && mpi->flags&MP_IMGFLAG_YUV) ? (8<chroma_x_shift)-1 : 15; // -- maybe FIXME + if (align < walign) align = walign; w2=((w+align)&(~align)); if(mpi->width!=w2){ // we have to change width... check if we CAN co it: @@ -383,6 +387,13 @@ return mpi; } +mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, + int w, int h){ + return vf_get_image_aligned(vf, outfmt, mp_imgtype, mp_imgflag, w, h, + (mp_imgflag&MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE)?15:0, 1); +} + + //============================================================================ // By default vf doesn't accept MPEGPES diff --exclude-from dontdiff -urN vanilla/main/libmpcodecs/vf.h main/libmpcodecs/vf.h --- vanilla/main/libmpcodecs/vf.h 2004-10-11 11:57:39.000000000 +0200 +++ main/libmpcodecs/vf.h 2004-11-22 23:48:17.000000000 +0100 @@ -73,6 +73,7 @@ // functions: void vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h); mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h); +mp_image_t* vf_get_image_aligned(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h, int walign, int halign); vf_instance_t* vf_open_plugin(vf_info_t** filter_list, vf_instance_t* next, char *name, char **args); vf_instance_t* vf_open_filter(vf_instance_t* next, char *name, char **args); diff --exclude-from dontdiff -urN vanilla/main/libmpcodecs/vf_pp.c main/libmpcodecs/vf_pp.c --- vanilla/main/libmpcodecs/vf_pp.c 2003-09-01 00:18:27.000000000 +0200 +++ main/libmpcodecs/vf_pp.c 2004-11-23 00:00:49.000000000 +0100 @@ -113,11 +113,11 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ // no DR, so get a new image! hope we'll get DR buffer: - vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, + vf->dmpi=vf_get_image_aligned(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE, // MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, -// mpi->w,mpi->h); - (mpi->w+7)&(~7),(mpi->h+7)&(~7)); + mpi->w,mpi->h,15,7); +// (mpi->w+7)&(~7),(mpi->h+7)&(~7)); vf->dmpi->w=mpi->w; vf->dmpi->h=mpi->h; // display w;h }