[Libva] [PATCH 1/6 v2 libva] test: fix an issue in loading NV12 surface
Zhao, Halley
halley.zhao at intel.com
Wed Jun 27 18:55:53 PDT 2012
Yeah, it is fix for YV12, not NV12.
I need change the comment.
> -----Original Message-----
> From: Xiang, Haihao
> Sent: Thursday, June 28, 2012 9:39 AM
> To: Zhao, Halley
> Cc: libva at lists.freedesktop.org
> Subject: Re: [Libva] [PATCH 1/6 v2 libva] test: fix an issue in loading
> NV12 surface
>
>
> Could you double-check the issue in loading surface ? I think you are
> fixing the issue for YV12 surface.
>
> > ---
> > test/loadsurface.h | 28 ++++++++++++++++++++++------
> > 1 files changed, 22 insertions(+), 6 deletions(-) mode change
> 100644
> > => 100755 test/loadsurface.h
> >
> > diff --git a/test/loadsurface.h b/test/loadsurface.h old mode 100644
> > new mode 100755 index 2cd09c3..2ffdc21
> > --- a/test/loadsurface.h
> > +++ b/test/loadsurface.h
> > @@ -220,21 +220,37 @@ static int upload_surface(VADisplay va_dpy,
> VASurfaceID surface_id,
> > VAImage surface_image;
> > void *surface_p=NULL, *U_start,*V_start;
> > VAStatus va_status;
> > + unsigned int pitches[3];
> >
> > va_status = vaDeriveImage(va_dpy,surface_id,&surface_image);
> > CHECK_VASTATUS(va_status,"vaDeriveImage");
> >
> > vaMapBuffer(va_dpy,surface_image.buf,&surface_p);
> > assert(VA_STATUS_SUCCESS == va_status);
> > -
> > - U_start = (char *)surface_p + surface_image.offsets[1];
> > - V_start = (char *)surface_p + surface_image.offsets[2];
> > +
> > + pitches[0] = surface_image.pitches[0];
> > + switch (surface_image.format.fourcc) {
> > + case VA_FOURCC_NV12:
> > + U_start = (char *)surface_p + surface_image.offsets[1];
> > + V_start = U_start + 1;
> > + pitches[1] = surface_image.pitches[1];
> > + pitches[2] = surface_image.pitches[1];
> > + break;
> > + case VA_FOURCC_YV12:
> > + U_start = (char *)surface_p + surface_image.offsets[2];
> > + V_start = (char *)surface_p + surface_image.offsets[1];
> > + pitches[1] = surface_image.pitches[2];
> > + pitches[2] = surface_image.pitches[1];
> > + break;
>
> Could you also add the support for I420 ?
>
> > + default:
> > + assert(0);
> > + }
> >
> > /* assume surface is planar format */
> > yuvgen_planar(surface_image.width, surface_image.height,
> > - (unsigned char *)surface_p,
> surface_image.pitches[0],
> > - (unsigned char *)U_start, surface_image.pitches[1],
> > - (unsigned char *)V_start, surface_image.pitches[2],
> > + (unsigned char *)surface_p, pitches[0],
> > + (unsigned char *)U_start, pitches[1],
> > + (unsigned char *)V_start, pitches[2],
> > (surface_image.format.fourcc==VA_FOURCC_NV12),
> > box_width, row_shift, field);
> >
>
More information about the Libva
mailing list