[Libva] Question about YV12 frame extracted

Jean-Yves Avenard jyavenard at gmail.com
Mon Jun 9 09:08:02 PDT 2014


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)

Thank you


More information about the Libva mailing list