[MPlayer-dev-eng] [PATCH] Add IMGFMT_444P and IMGFMT_422P to vo_md5sum.c

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Jun 8 20:50:35 CEST 2010


On Tue, Jun 08, 2010 at 05:18:42PM +0200, Giorgio wrote:
> Yes, I looked there, but I didn't understand completely what "stored
> dimensions" and "visible dimensions" meant in that context.

"stored dimensions" means basically how much memory is allocated,
the "visible dimensions" indicates how much of that is supposed
to be visible.
A stored dimension od 320x240 with a visible dimension of 320x200
would mean the last 40 lines should not be displayed.
I agree with you though that it's a mess and hard to understand
because (probably) quite a bit of code does not do this distinction
properly (mostly because for filters it does not matter or might
even be better to ignore the "visible area" cropping.

> There are lines like this: "vf.c: MPI parameters changed!  400x240 ->
> 320x240", but also in vf.c there is this piece of code for handling
> this case:
> 
> 	if(mpi->flags&MP_IMGFLAG_ALLOCATED){
> 	    if(mpi->width<w2 || mpi->height<h){
> 		// need to re-allocate buffer memory:
> 		av_free(mpi->planes[0]);
> 		mpi->flags&=~MP_IMGFLAG_ALLOCATED;
> 		mp_msg(MSGT_VFILTER,MSGL_V,"vf.c: have to REALLOCATE buffer memory :(\n");
> 	    }
> //	} else {
> 	} {
> 	    mpi->width=w2; mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) -
> 1)>>mpi->chroma_x_shift;
> 	    mpi->height=h; mpi->chroma_height=(h + (1<<mpi->chroma_y_shift) -
> 1)>>mpi->chroma_y_shift;
> 	}
>     }
> 
> so it might work just fine.

You are getting close.
Let's take some different parts of this function:

  assert(w == -1 || w >= vf->w);
  assert(h == -1 || h >= vf->h);
  assert(vf->w > 0);
  assert(vf->h > 0);
[...]
  if (w == -1) w = vf->w;
  if (h == -1) h = vf->h;
[...]
  mpi->w=vf->w; mpi->h=vf->h;
[...]
            mpi->width=w2; mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) - 1)>>mpi->chroma_x_shift;
            mpi->height=h; mpi->chroma_height=(h + (1<<mpi->chroma_y_shift) - 1)>>mpi->chroma_y_shift;

w and h are set to vf->w and vf->h, which are the actual dimensions that should be visible
(i.e. processed by the vos), whereas width/height can be larger (to enable certain
optimizations).

> So Reimar, if you think it could be an
> useful addition, please fix it and commit it. If not, sorry for the
> noise. Thank  you.

I'll try to find the time, thanks for trying :-)



More information about the MPlayer-dev-eng mailing list