[Libva] Question about YV12 frame extracted

Xiang, Haihao haihao.xiang at intel.com
Mon Jun 9 18:30:10 PDT 2014


On Tue, 2014-06-10 at 02:08 +1000, Jean-Yves Avenard wrote:
> Hello
> 
> I'm trying to read a video frame that was extracted using VAAPI,, but
> I get rubbish
> 
> to simplify:
> vaCreateImage(m_ctx.display, &format, m_size.width(), m_size.height(),
> &m_image))
> vaSyncSurface(m_ctx.display, surf->m_id);
> va_status = vaGetImage(m_ctx.display, surf->m_id, 0, 0,
>                            m_size.width(), m_size.height(), m_image.image_id);
> vaMapBuffer(m_ctx.display, m_image.buf, &source))
> 
> And then I read the data from source.
> here I have : format ==  VA_FOURCC('Y','V','1','2')
> 
> now looking at the VAImage m_image
> 
> m_image.width = 720
> m_image.height = 576
> m_image.pitches[0] = 768
> m_image.pitches[1] = 384
> m_image.pitches[2] = 384
> m_image.offsets[0] = 0
> m_image.offsets[1] = 442368
> m_image.offsets[0] = 552960
> m_image.data_size = 663552
> 
> So the size of the image returned is indeed 720x576.
> The but data_size and the planes offsets do not make any sense for a
> 720x576 image.
> 
> Looking at pitches[0], it appears to be 768 wide instead.
> If the image was 768x576, then yes, I would have a data_size of 663552
> (width*height*3/2)
> And indeed, if I treat the image as if it was 768x576, I get something
> meaningful.
> 
> Why is the image returned a different size than what I originally
> requested (and the size of the original video)

The image is 720x576, width is 720 however pitch is 768. pitch is also
called stride. the pitch is wider than the width of the image if garbage
is added at the end of each line.

Thanks
Haihao


> 
> Thank you
> _______________________________________________
> Libva mailing list
> Libva at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libva




More information about the Libva mailing list